Click here to Skip to main content
15,914,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSumit-s solution Pin
Sumit Kapoor13-Dec-03 5:29
Sumit Kapoor13-Dec-03 5:29 
GeneralRe: Sumit-s solution Pin
SiddharthAtw14-Dec-03 18:10
SiddharthAtw14-Dec-03 18:10 
GeneralNeed help in putting this function Pin
percyvimal12-Dec-03 19:33
percyvimal12-Dec-03 19:33 
GeneralRe: Need help in putting this function Pin
l a u r e n12-Dec-03 20:20
l a u r e n12-Dec-03 20:20 
GeneralAgent Control Pin
nileshp412-Dec-03 18:54
nileshp412-Dec-03 18:54 
GeneralRe: Agent Control Pin
Ravi Bhavnani12-Dec-03 20:50
professionalRavi Bhavnani12-Dec-03 20:50 
GeneralSeting image to CListCtrl..... Pin
YanBin12-Dec-03 16:27
YanBin12-Dec-03 16:27 
GeneralParsing the command line Pin
Ernesto D.12-Dec-03 14:52
Ernesto D.12-Dec-03 14:52 
Hi, im writting a small W32 application (non MFC) and i need to parse the command line for passed arguments, and since the app MUST be compiled for unicode, the MSDN docs say i should use the GetCommandLine() function to get a unicode version of it, and it also suggests using CommandLineToArgvW() to get a main() style array of arguments and a count.
inside my winmain(), heres what i do:

<br />
// get the arguments<br />
int argcount=0;<br />
LPWSTR* arguments=CommandLineToArgvW(GetCommandLine(), &argcount);<br />
<br />
// do stuff with arguments<br />
.<br />
.<br />
.<br />
<br />
// release the memory use for arguments(¿?)<br />
if(arguments)<br />
   GlobalFree((HGLOBAL)arguments);


the problem is that in the GlobalFree() line, the app takes an exception and crashes. but MSDN sais i should do the GlobalFree!
i quote:
"It is the caller's responsibility to free the memory used by the argument list when it is no longer needed. To free the memory, use a single call to the GlobalFree function."

any idea of what im doing wrong?
thanks!
GeneralRe: Parsing the command line Pin
Michael Dunn12-Dec-03 19:03
sitebuilderMichael Dunn12-Dec-03 19:03 
GeneralRe: Parsing the command line Pin
Ernesto D.13-Dec-03 10:13
Ernesto D.13-Dec-03 10:13 
General.cpp .dsp .dsw Pin
Leoanrd Fear12-Dec-03 14:23
sussLeoanrd Fear12-Dec-03 14:23 
GeneralRe: .cpp .dsp .dsw Pin
Michael Dunn12-Dec-03 14:51
sitebuilderMichael Dunn12-Dec-03 14:51 
QuestionWhy doesn't this work? Pin
Snyp12-Dec-03 13:45
Snyp12-Dec-03 13:45 
AnswerRe: Why doesn't this work? Pin
valikac13-Dec-03 5:31
valikac13-Dec-03 5:31 
GeneralSendMessage Problem Pin
impeham12-Dec-03 13:45
impeham12-Dec-03 13:45 
GeneralRe: SendMessage Problem Pin
Ernesto D.12-Dec-03 15:28
Ernesto D.12-Dec-03 15:28 
GeneralRe: SendMessage Problem Pin
impeham12-Dec-03 22:03
impeham12-Dec-03 22:03 
GeneralProblem reading field in .ini file Pin
IrishSonic12-Dec-03 13:29
IrishSonic12-Dec-03 13:29 
GeneralRe: Problem reading field in .ini file Pin
Roger Stewart12-Dec-03 15:23
professionalRoger Stewart12-Dec-03 15:23 
Generalencrypted data and strings Pin
(Steven Hicks)n+112-Dec-03 12:56
(Steven Hicks)n+112-Dec-03 12:56 
GeneralRe: encrypted data and strings Pin
l a u r e n12-Dec-03 20:23
l a u r e n12-Dec-03 20:23 
GeneralRe: encrypted data and strings Pin
(Steven Hicks)n+113-Dec-03 7:55
(Steven Hicks)n+113-Dec-03 7:55 
GeneralRe: encrypted data and strings Pin
l a u r e n13-Dec-03 7:58
l a u r e n13-Dec-03 7:58 
GeneralRe: encrypted data and strings Pin
(Steven Hicks)n+113-Dec-03 8:14
(Steven Hicks)n+113-Dec-03 8:14 
GeneralRe: encrypted data and strings Pin
l a u r e n13-Dec-03 8:17
l a u r e n13-Dec-03 8:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.