当前位置:网站首页>还原窗口位置的微妙之处
还原窗口位置的微妙之处
2022-07-04 03:47:00 【拓扑梅尔-漫漫开发路】
很多应用程序都实现了这样一个特性:它们会记录窗口关闭时最后在屏幕上的位置,并尝试在应用程序重新启动的时候恢复这些位置。如果只是简单的实现这个功能,则大多数开发者会无条件的记录窗口的最后显示位置,并在程序重新启动是恢复窗口到这个位置。
但是,这可能会给你的程序带来可用性方面的问题,此话怎讲?
如果用户运行了你的程序的两个实例,则两个窗口最终会出现在屏幕上完全相同的位置。 除非用户仔细地观察了任务栏,否则运行第二个实例的时候,看起来似乎没有任何效果。
现在事情开始变得有趣了。取决于程序所做的事情,第二个实例可能会遇到共享冲突,或者它可能只是打开文档的第二个副本进行编辑,或者可能会开始播放歌曲的两个副本,从而导致奇怪的回声效果,因为这两个实例在时间上是不同步的。
更有趣的是,如果用户点击停止按钮,音乐反而继续播放!为什么? 因为只有第二个实例的播放被停止了,第一个实例仍在运行。 我知道一个用户经常会运行多达四个多媒体标题的程序实例,这会导致可怕的杂音,因为他们都同时播放吸引人的音乐,然后在用户试图解决问题时引起大量混乱,这通常包括在最上面的实例上敲击“停止”按钮。
但是,这只会停止最顶层的那个实例,但其他三个仍在运行……如果打开文档的第二个副本,用户可能会从编辑器切换,然后切换回第一个实例,并认为所有更改都丢失了。 或者用户可能没有注意到这一点并且对第一个实例进行了一组冲突的更改。 然后,当保存同一文档的两个副本时,会发生各种有趣的事情。
故事的寓意:如果你的程序保存并恢复其屏幕位置,你可能需要检查该程序的另外一个实例是否已经在该屏幕位置运行。 如果是这样,则将第二个窗口移动到其他位置,使其不会占据完全相同的坐标。
总结
请勿担心,TopomelBox全程仅允许开启一个实例,如果用户第二次点击程序图标,则会自动激活前一个实例。
为什么不支持多个实例运行,实则是小弟能力不济,等以后翅膀硬了再说吧。
最后
Raymond Chen的《The Old New Thing》是我非常喜欢的博客之一,里面有很多关于Windows的小知识,对于广大Windows平台开发者来说,确实十分有帮助。
本文来自:《A subtlety in restoring previous window position》
边栏推荐
- Graduation summary
- [.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
- SQL语句加强练习(MySQL8.0为例)
- Webhook triggers Jenkins for sonar detection
- 【读书会第十三期】视频文件的封装格式
- Typical applications of minimum spanning tree
- SDP中的SPA
- How much does it cost to open a futures account in China? Where is it safe to open an account at present?
- Recent learning fragmentation (14)
- SQL語句加强練習(MySQL8.0為例)
猜你喜欢
pytest多进程/多线程执行测试用例
Pytest multi process / multi thread execution test case
三年进账35.31亿,这个江西老表要IPO了
Leetcode51.n queen
Consul of distributed service registration discovery and unified configuration management
National standard gb28181 protocol platform easygbs fails to start after replacing MySQL database. How to deal with it?
JSON string conversion in unity
用于TCP协议交互的TCPClientDemo
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
MySQL one master multiple slaves + linear replication
随机推荐
Third party login initial version
EV6 helps the product matrix, and Kia is making efforts in the high-end market. The global sales target in 2022 is 3.15 million?
[paddleseg source code reading] paddleseg custom data class
ctf-pikachu-CSRF
CSP drawing
新型数据中心,助力加快构建以数据为关键要素的数字经济
Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
National standard gb28181 protocol platform easygbs fails to start after replacing MySQL database. How to deal with it?
Illustrated network: what is the hot backup router protocol HSRP?
Solve the problems encountered by the laravel framework using mongodb
[paddleseg source code reading] paddleseg calculates Miou
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
Add IDM to Google browser
A review of reverse reinforcement learning at Virginia Tech (VT)
[.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
Learning video website
Monitoring - Prometheus introduction
Leecode 122. Zuijia timing of buying and selling stocks ②