当前位置:网站首页>还原窗口位置的微妙之处
还原窗口位置的微妙之处
2022-07-04 03:47:00 【拓扑梅尔-漫漫开发路】
很多应用程序都实现了这样一个特性:它们会记录窗口关闭时最后在屏幕上的位置,并尝试在应用程序重新启动的时候恢复这些位置。如果只是简单的实现这个功能,则大多数开发者会无条件的记录窗口的最后显示位置,并在程序重新启动是恢复窗口到这个位置。
但是,这可能会给你的程序带来可用性方面的问题,此话怎讲?
如果用户运行了你的程序的两个实例,则两个窗口最终会出现在屏幕上完全相同的位置。 除非用户仔细地观察了任务栏,否则运行第二个实例的时候,看起来似乎没有任何效果。
现在事情开始变得有趣了。取决于程序所做的事情,第二个实例可能会遇到共享冲突,或者它可能只是打开文档的第二个副本进行编辑,或者可能会开始播放歌曲的两个副本,从而导致奇怪的回声效果,因为这两个实例在时间上是不同步的。
更有趣的是,如果用户点击停止按钮,音乐反而继续播放!为什么? 因为只有第二个实例的播放被停止了,第一个实例仍在运行。 我知道一个用户经常会运行多达四个多媒体标题的程序实例,这会导致可怕的杂音,因为他们都同时播放吸引人的音乐,然后在用户试图解决问题时引起大量混乱,这通常包括在最上面的实例上敲击“停止”按钮。
但是,这只会停止最顶层的那个实例,但其他三个仍在运行……如果打开文档的第二个副本,用户可能会从编辑器切换,然后切换回第一个实例,并认为所有更改都丢失了。 或者用户可能没有注意到这一点并且对第一个实例进行了一组冲突的更改。 然后,当保存同一文档的两个副本时,会发生各种有趣的事情。
故事的寓意:如果你的程序保存并恢复其屏幕位置,你可能需要检查该程序的另外一个实例是否已经在该屏幕位置运行。 如果是这样,则将第二个窗口移动到其他位置,使其不会占据完全相同的坐标。
总结
请勿担心,TopomelBox全程仅允许开启一个实例,如果用户第二次点击程序图标,则会自动激活前一个实例。
为什么不支持多个实例运行,实则是小弟能力不济,等以后翅膀硬了再说吧。
最后
Raymond Chen的《The Old New Thing》是我非常喜欢的博客之一,里面有很多关于Windows的小知识,对于广大Windows平台开发者来说,确实十分有帮助。
本文来自:《A subtlety in restoring previous window position》
边栏推荐
- GUI Graphical user interface programming (XIV) optionmenu - what do you want your girlfriend to wear on Valentine's day
- Which product is better if you want to go abroad to insure Xinguan?
- 【读书会第十三期】多媒体处理工具 FFmpeg 工具集
- [database I] database overview, common commands, view the table structure of 'demo data', simple query, condition query, sorting data, data processing function (single row processing function), groupi
- Getting started with the go language is simple: go implements the Caesar password
- 智慧地铁| 云计算为城市地铁交通注入智慧
- '2'>' 10'==true? How does JS perform implicit type conversion?
- Zlmediakit compilation and webrtc push-pull flow testing
- 2022-07-03: there are 0 and 1 in the array. Be sure to flip an interval. Flip: 0 becomes 1, 1 becomes 0. What is the maximum number of 1 after turning? From little red book. 3.13 written examination.
- Leecode 122. Zuijia timing of buying and selling stocks ②
猜你喜欢
三年进账35.31亿,这个江西老表要IPO了
微信公众号网页授权
National standard gb28181 protocol platform easygbs fails to start after replacing MySQL database. How to deal with it?
Session learning diary 1
Explain AI accelerator in detail: why is this the golden age of AI accelerator?
Mindmanager2022 efficient and easy to use office mind map MindManager
1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
Select sorting and bubble sorting template
ctf-pikachu-CSRF
随机推荐
Nbear introduction and use diagram
Infiltration practice guest account mimikatz sunflower SQL rights lifting offline decryption
Future源碼一觀-JUC系列
[PaddleSeg 源码阅读] PaddleSeg Transform 的 Normalize操作
Introduction to asynchronous task capability of function calculation - task trigger de duplication
Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
Katalon framework test web (XXVI) automatic email
Webhook triggers Jenkins for sonar detection
Slurm view node configuration information
what does ctrl + d do?
Database SQL statement summary, continuous update
Illustrated network: what is the hot backup router protocol HSRP?
基于PHP的轻量企业销售管理系统
Katalon框架测试web(二十六)自动发邮件
【华为云IoT】读书笔记之《万物互联:物联网核心技术与安全》第3章(上)
The new data center helps speed up the construction of a digital economy with data as a key element
static hostname; transient hostname; pretty hostname
JDBC advanced
Epidemic strikes -- Thinking about telecommuting | community essay solicitation
Object oriented -- encapsulation, inheritance, polymorphism