Sign in to follow this  

In need of tips/comments regarding lpcmdline code

Recommended Posts

Ok, the problem i have is that i'm stuck trying to copy the command line argument from szArglist[1] to a suitable variable. The problem is that i tend to mix the types and suitable function for doing so. Anyone got any tips/comments regarding this process, its going to send a filename to a proper opening function. I've been working with this so i can use double-klick to open certain files. btw, laugh all you want at my code =P [CODE] if(lpCmdLine[0] != L'\0') { LPWSTR *szArglist; int nArgs; LPTSTR CommandLineList = NULL; CommandLineList = GetCommandLine(); szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); //ProcessFileName(insert file dir here, TCHAR, char[512]) ProcessMsg(TEXT("File: %ws"), szArglist[1]); GlobalFree(szArglist); } [/CODE] (Z)

Share this post

Link to post
Share on other sites
Problem solved:

if(lpCmdLine[0] != L'\0')
LPWSTR *szArglist;
int nArgs;

szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
wsprintf(ObjectFileName, "%ws", szArglist[1]);

//Do something with [ObjectFileName]


It took some while but the process is functional now.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this