当前位置:网站首页>还原窗口位置的微妙之处
还原窗口位置的微妙之处
2022-07-04 03:47:00 【拓扑梅尔-漫漫开发路】
很多应用程序都实现了这样一个特性:它们会记录窗口关闭时最后在屏幕上的位置,并尝试在应用程序重新启动的时候恢复这些位置。如果只是简单的实现这个功能,则大多数开发者会无条件的记录窗口的最后显示位置,并在程序重新启动是恢复窗口到这个位置。
但是,这可能会给你的程序带来可用性方面的问题,此话怎讲?
如果用户运行了你的程序的两个实例,则两个窗口最终会出现在屏幕上完全相同的位置。 除非用户仔细地观察了任务栏,否则运行第二个实例的时候,看起来似乎没有任何效果。
现在事情开始变得有趣了。取决于程序所做的事情,第二个实例可能会遇到共享冲突,或者它可能只是打开文档的第二个副本进行编辑,或者可能会开始播放歌曲的两个副本,从而导致奇怪的回声效果,因为这两个实例在时间上是不同步的。
更有趣的是,如果用户点击停止按钮,音乐反而继续播放!为什么? 因为只有第二个实例的播放被停止了,第一个实例仍在运行。 我知道一个用户经常会运行多达四个多媒体标题的程序实例,这会导致可怕的杂音,因为他们都同时播放吸引人的音乐,然后在用户试图解决问题时引起大量混乱,这通常包括在最上面的实例上敲击“停止”按钮。
但是,这只会停止最顶层的那个实例,但其他三个仍在运行……如果打开文档的第二个副本,用户可能会从编辑器切换,然后切换回第一个实例,并认为所有更改都丢失了。 或者用户可能没有注意到这一点并且对第一个实例进行了一组冲突的更改。 然后,当保存同一文档的两个副本时,会发生各种有趣的事情。
故事的寓意:如果你的程序保存并恢复其屏幕位置,你可能需要检查该程序的另外一个实例是否已经在该屏幕位置运行。 如果是这样,则将第二个窗口移动到其他位置,使其不会占据完全相同的坐标。
总结
请勿担心,TopomelBox全程仅允许开启一个实例,如果用户第二次点击程序图标,则会自动激活前一个实例。
为什么不支持多个实例运行,实则是小弟能力不济,等以后翅膀硬了再说吧。
最后
Raymond Chen的《The Old New Thing》是我非常喜欢的博客之一,里面有很多关于Windows的小知识,对于广大Windows平台开发者来说,确实十分有帮助。
本文来自:《A subtlety in restoring previous window position》
边栏推荐
- 智慧地铁| 云计算为城市地铁交通注入智慧
- Learning video website
- Es network layer
- pytest多进程/多线程执行测试用例
- 疫情来袭--远程办公之思考|社区征文
- Want to do something in production? Then try these redis commands
- ctf-pikachu-CSRF
- My opinion on how to effectively telecommute | community essay solicitation
- MySQL one master multiple slaves + linear replication
- SDP中的SPA
猜你喜欢
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
图解网络:什么是热备份路由器协议HSRP?
MySQL is dirty
How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
Don't disagree, this is the most powerful "language" of the Internet
New year's first race, submit bug reward more!
'2'>' 10'==true? How does JS perform implicit type conversion?
My opinion on how to effectively telecommute | community essay solicitation
What are the virtual machine software? What are their respective functions?
Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
随机推荐
Learning video website
How to pipe several commands in Go?
Is it safe to buy insurance for your children online? Do you want to buy a million dollar medical insurance for your children?
SQL語句加强練習(MySQL8.0為例)
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
Consul of distributed service registration discovery and unified configuration management
潘多拉 IOT 开发板学习(HAL 库)—— 实验6 独立看门狗实验(学习笔记)
Penetration practice - sqlserver empowerment
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
Select sorting and bubble sorting template
XSS prevention
【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
Defensive programming skills
Deep thinking on investment
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
Want to do something in production? Then try these redis commands
Katalon framework tests web (XXI) to obtain element attribute assertions
Mindmanager2022 efficient and easy to use office mind map MindManager
Leecode 122. Zuijia timing of buying and selling stocks ②
MySQL is dirty