当前位置:网站首页>还原窗口位置的微妙之处
还原窗口位置的微妙之处
2022-07-04 03:47:00 【拓扑梅尔-漫漫开发路】
很多应用程序都实现了这样一个特性:它们会记录窗口关闭时最后在屏幕上的位置,并尝试在应用程序重新启动的时候恢复这些位置。如果只是简单的实现这个功能,则大多数开发者会无条件的记录窗口的最后显示位置,并在程序重新启动是恢复窗口到这个位置。
但是,这可能会给你的程序带来可用性方面的问题,此话怎讲?
如果用户运行了你的程序的两个实例,则两个窗口最终会出现在屏幕上完全相同的位置。 除非用户仔细地观察了任务栏,否则运行第二个实例的时候,看起来似乎没有任何效果。
现在事情开始变得有趣了。取决于程序所做的事情,第二个实例可能会遇到共享冲突,或者它可能只是打开文档的第二个副本进行编辑,或者可能会开始播放歌曲的两个副本,从而导致奇怪的回声效果,因为这两个实例在时间上是不同步的。
更有趣的是,如果用户点击停止按钮,音乐反而继续播放!为什么? 因为只有第二个实例的播放被停止了,第一个实例仍在运行。 我知道一个用户经常会运行多达四个多媒体标题的程序实例,这会导致可怕的杂音,因为他们都同时播放吸引人的音乐,然后在用户试图解决问题时引起大量混乱,这通常包括在最上面的实例上敲击“停止”按钮。
但是,这只会停止最顶层的那个实例,但其他三个仍在运行……如果打开文档的第二个副本,用户可能会从编辑器切换,然后切换回第一个实例,并认为所有更改都丢失了。 或者用户可能没有注意到这一点并且对第一个实例进行了一组冲突的更改。 然后,当保存同一文档的两个副本时,会发生各种有趣的事情。
故事的寓意:如果你的程序保存并恢复其屏幕位置,你可能需要检查该程序的另外一个实例是否已经在该屏幕位置运行。 如果是这样,则将第二个窗口移动到其他位置,使其不会占据完全相同的坐标。
总结
请勿担心,TopomelBox全程仅允许开启一个实例,如果用户第二次点击程序图标,则会自动激活前一个实例。
为什么不支持多个实例运行,实则是小弟能力不济,等以后翅膀硬了再说吧。
最后
Raymond Chen的《The Old New Thing》是我非常喜欢的博客之一,里面有很多关于Windows的小知识,对于广大Windows平台开发者来说,确实十分有帮助。
本文来自:《A subtlety in restoring previous window position》
边栏推荐
- Calculate the odd sum of 1~n (1~100 as an example)
- Defensive programming skills
- 【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
- [paddleseg source code reading] paddleseg calculation dice
- Katalon framework test web (XXVI) automatic email
- Select sorting and bubble sorting template
- Storage of MySQL database
- Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
- MySQL maxscale realizes read-write separation
- Webhook triggers Jenkins for sonar detection
猜你喜欢
三年进账35.31亿,这个江西老表要IPO了
MySQL data query optimization -- data structure of index
Third party login initial version
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
PostgreSQL users cannot create table configurations by themselves
Wechat official account web page authorization
New year's first race, submit bug reward more!
Summary of Chinese remainder theorem
MySQL one master multiple slaves + linear replication
Getting started with the go language is simple: go implements the Caesar password
随机推荐
JDBC advanced
Smart subway | cloud computing injects wisdom into urban subway transportation
warning: LF will be replaced by CRLF in XXXXXX
2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。
JDBC 进阶
vue多级路由嵌套怎么动态缓存组件
[untitled]
STM32外接DHT11显示温湿度
1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
图解网络:什么是热备份路由器协议HSRP?
Add IDM to Google browser
【读书会第十三期】视频文件的封装格式
Epidemic strikes -- Thinking about telecommuting | community essay solicitation
Package details_ Four access control characters_ Two details of protected
Which product is better if you want to go abroad to insure Xinguan?
Add token validation in swagger
[.NET + mqtt]. Mise en œuvre de la communication mqtt dans l'environnement net 6 et démonstration de code pour l'abonnement et la publication de messages bilatéraux du serveur et du client
Audio and video technology development weekly | 232
Support the first triggered go ticker
Explain AI accelerator in detail: why is this the golden age of AI accelerator?