简体   繁体   English

确保Windows Mobile应用程序未运行-从桌面应用程序

[英]Ensuring Windows Mobile application is not running - From a desktop app

I have a windows mobile 5.0 application (smartphone) that contains a flat data file (CSV), which contains a header row (two doubles), and a list of entries (two doubles, DateTime, and a string). 我有一个Windows Mobile 5.0应用程序(智能手机),其中包含一个平面数据文件(CSV),其中包含一个标题行(两个双打)和一个条目列表(两个双打,DateTime和一个字符串)。

Occasionally, I need to "sync" the mobile application with a desktop application. 有时,我需要将移动应用程序与桌面应用程序“同步”。 The desktop application should read the CSV from the mobile device, and replace it with a new CSV file, based on the contents of the old one. 桌面应用程序应从移动设备读取CSV,并根据旧内容将其替换为新的CSV文件。

This seems pretty easy via RAPI (I'm guessing), but I need to ensure that the mobile application is not running. 通过RAPI(我猜)这似乎很容易,但是我需要确保移动应用程序未运行。 Is there a way to do this? 有没有办法做到这一点?

Mutex? 互斥? Remote Process Viewer like stuff? 远程进程查看器之类的东西? File locking? 文件锁定?

Thanks for any help you have 多谢您的协助

Mike 麦克风

For whatever reason, the built-in RAPI Functions don't have anything for checking running processes like the ToolHelp API's . 无论出于何种原因, 内置的RAPI函数都无法检查正在运行的进程,例如ToolHelp API的 With C you could create a set of custom functions in a device library that call the ToolHelp APIs and in turn are called through CeRapiInvoke (which is a generic catch-all entry point for custom RAPI functions). 使用C,您可以在设备库中创建一组自定义函数,这些函数调用ToolHelp API,然后通过CeRapiInvoke (这是自定义RAPI函数的通用捕获点)进行调用。 Unfortunately there's no simple mechanism to do this in managed code. 不幸的是,在托管代码中没有简单的机制可以做到这一点。

Just use a simple file locking mechanism for the file being read/updated. 只需对读取/更新的文件使用简单的文件锁定机制。

Either rename the file before use or create a second 'lock' file which you can check for the existence of. 在使用前重命名该文件或创建另一个“锁定”文件,您可以检查该文件是否存在。

Just thought of an easy way. 只是想到了一种简单的方法。

Every 3 seconds the program is running, update a registry key with the current datetime. 程序运行每3秒钟,请使用当前日期时间更新注册表项。

When I want to sync, check the mobile registry, check it again 5 seconds later. 当我要同步时,请检查移动注册表,然后在5秒钟后再次检查它。 If the values changed, the program is still running. 如果值更改,则程序仍在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从桌面应用程序获取“现代”Windows应用程序的图标? - Getting icon of “modern” Windows app from a desktop application? 从桌面应用程序运行Windows 10的Camera App - Run Camera App of Windows 10 from Desktop Application 在Windows桌面应用程序和Windows Mobile客户端应用程序之间同步数据 - Sync data between a windows desktop app and windows mobile client app 如何从Windows CE移动设备访问文件到我的桌面应用程序? - How Can I access File from Windows CE mobile to my desktop application? 从现有的Silverlight应用程序开发Windows移动应用程序 - Develop a Windows mobile app from existing silverlight application 运行 Windows Mobile 应用程序时出错 - Error when running Windows Mobile application 桌面应用程序和Windows Mobile Compact Framework c#之间的通信 - Communication between Desktop Application and Windows Mobile Compact Framework c# Xaml桌面应用程序连接到Windows Azure移动服务 - Xaml desktop application connect to Windows Azure Mobile Services 从Windows应用商店应用调用桌面应用 - Invoking desktop app from Windows Store app 桌面到Windows移动通信 - desktop to windows mobile communication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM