开发者

How to detect application launch type (auto-start or manual)?

开发者 https://www.devze.com 2022-12-10 22:05 出处:网络
How can I detect that application开发者_开发知识库 was automatically started (auto-start when device turned on) or user has started it manually (from Programs etc)?

How can I detect that application开发者_开发知识库 was automatically started (auto-start when device turned on) or user has started it manually (from Programs etc)?

Thanks


Quick hint: You can use Arguments to distinguish between both, and put those arguments in the shortcut.
check Command Line Argument to know how to use arguments, and in the shortcut write

path\executable.exe autostart

for the shortcut in startup folder, after that in your application check this...

EDIT1: the path in windows mobile start from \ this is the root, now to get the startup folder you can write:

\widnows\startup

and the complete path will be

\widnows\startup\executable.exe autostart

Edit2: Open the setup project, right click on "file system and target machine, then "Add Special Folder" then choose "startup Folder", after that put your shortcut with arguments there...

Edit3:

you are right, there is no place to put arguments, so we should create the shortcut manually:

1- create text file and change the extension to be lnk

2- edit the file by drag& drop it to notepad, and write inside it the following line:

43#"\widnows\startup\executable.exe autostart"

3- take care about the first number, it's the character count after the #, if you change the path so you should recalculate the character count again and put it in the first. 4- add this file to the start up folder in VS....

0

精彩评论

暂无评论...
验证码 换一张
取 消