当前位置:网站首页>还原窗口位置的微妙之处
还原窗口位置的微妙之处
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
- Apple submitted the new MAC model to the regulatory database before the spring conference
- Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
- “软硬皆施”,助力建成新型云计算数据中心
- CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
- Eh, the log time of MySQL server is less than 8h?
- STM32外接DHT11显示温湿度
- SQL语句加强练习(MySQL8.0为例)
- Katalon framework tests web (XXI) to obtain element attribute assertions
- Smart subway | cloud computing injects wisdom into urban subway transportation
猜你喜欢

Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡

Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi

SQL語句加强練習(MySQL8.0為例)

Getting started with the go language is simple: go implements the Caesar password

MySQL one master multiple slaves + linear replication

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?

Why is it recommended that technologists write blogs?

postgresql 用户不能自己创建表格配置

MySQL data query optimization -- data structure of index

Sales management system of lightweight enterprises based on PHP
随机推荐
vue多级路由嵌套怎么动态缓存组件
Package details_ Four access control characters_ Two details of protected
static hostname; transient hostname; pretty hostname
CSP drawing
Summary of Chinese remainder theorem
【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
STM32外接DHT11显示温湿度
System integration meets the three business needs of enterprises
Database SQL statement summary, continuous update
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Objective-C string class, array class
[untitled]
Calculate the odd sum of 1~n (1~100 as an example)
微信公众号网页授权
Is it really so difficult to learn redis? Today, a fan will share his personal learning materials!
PostgreSQL users cannot create table configurations by themselves
JSON string conversion in unity
Value transfer communication between components (parent to child, child to parent, brother component to value)
Which product is better for 2022 annual gold insurance?
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush