I am trying to use 'GetModuleFileNameA' but I keep getting the error 'c4430: missing type specifier - int assumed'. From reading the results from my google search I am guessing that it is from my use of NULL:
c开发者_如何学运维har Filename[MAX_PATH]; //this is a char buffer
GetModuleFileNameA(NULL, Filename, sizeof(Filename));
NULL is supposedly defined in #include stdio.h which I have included in my project, what am I doing wrong?
Thanks.
Have you tried GetModuleFileNameA(GetModuleHandle(0),Filename,sizeof(Filename)) ?
From MSDN GetModuleFileName description
The global variable _pgmptr is automatically initialized to the full path of the executable file, and can be used to retrieve the full path name of an executable file.
You might want to check if this value out, and if you need it, how does it behave in multi-library environment.
精彩评论