开发者

File as argument for Win32 application

开发者 https://www.devze.com 2023-02-28 13:59 出处:网络
How can I make a Win32 application open a fi开发者_开发百科le at startup when calling it like this (e.g. with a shortcut or via command line)?

How can I make a Win32 application open a fi开发者_开发百科le at startup when calling it like this (e.g. with a shortcut or via command line)?

program.exe "document.txt"


This link shows how to retrieve command line arguments and turn them into an array of string

Even though it is written in a main, it works equally well in WinMain or any other function


If you have a Unicode program use lpCmdLine, otherwise use GetCommandLineW and pass the result to CommandLineToArgvW to get a list of strings for the arguments to the program, then it works just like with a command-line program.

0

精彩评论

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