开发者

Can't get GetModuleFileNameA to work, keep getting error 'missing type specifier...'

开发者 https://www.devze.com 2023-02-01 15:10 出处:网络
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 u

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号