开发者

File as argument for Win32 application

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜