GetModuleFileName returning blank!
-
I am running in the debugger and find that sPath = "" !!
VERIFY(::GetModuleFileName(AfxGetInstanceHandle(), szBuffer, \_MAX\_PATH)); sPath = (CString)szBuffer; //sPath returns blank! sPath = sPath.Left(sPath.ReverseFind('\\\\'));
What am I doing wrong? Many thanks, ns I just found out that I get the sPath if I run the debug config, butr I have setup my release config to allow debugging too, and when that version runs I get blank!
-
I am running in the debugger and find that sPath = "" !!
VERIFY(::GetModuleFileName(AfxGetInstanceHandle(), szBuffer, \_MAX\_PATH)); sPath = (CString)szBuffer; //sPath returns blank! sPath = sPath.Left(sPath.ReverseFind('\\\\'));
What am I doing wrong? Many thanks, ns I just found out that I get the sPath if I run the debug config, butr I have setup my release config to allow debugging too, and when that version runs I get blank!
For me, these lines
CString filenname;
::GetModuleFileName(AfxGetApp()->m_hInstance, filenname.GetBuffer(MAX_PATH+1), MAX_PATH);
filenname.ReleaseBuffer();do work. You might want to check the return-code and
GetLastErr()
ofGetModuleFileName
.
Who is 'General Failure'? And why is he reading my harddisk?!?
-
For me, these lines
CString filenname;
::GetModuleFileName(AfxGetApp()->m_hInstance, filenname.GetBuffer(MAX_PATH+1), MAX_PATH);
filenname.ReleaseBuffer();do work. You might want to check the return-code and
GetLastErr()
ofGetModuleFileName
.
Who is 'General Failure'? And why is he reading my harddisk?!?
-
For me, these lines
CString filenname;
::GetModuleFileName(AfxGetApp()->m_hInstance, filenname.GetBuffer(MAX_PATH+1), MAX_PATH);
filenname.ReleaseBuffer();do work. You might want to check the return-code and
GetLastErr()
ofGetModuleFileName
.
Who is 'General Failure'? And why is he reading my harddisk?!?
Hello! Use _pgmptr or _wpgmptr Hope that helps :)