• Advertisement
Sign in to follow this  

In need of tips/comments regarding lpcmdline code

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 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); } (Z)

Share this post


Link to post
Share on other sites
Advertisement
Problem solved:

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

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

//Do something with [ObjectFileName]

GlobalFree(szArglist);
}

It took some while but the process is functional now.

(Z)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement