Hi, can someone write me a code to use window MessageBoxA()
Just write a code display "Hi there" using window dll MessageBoxA()
I really confuse how to import dll staticlly.
Thanks
this is my code(not working)
int __cdecl MessageBoxA(int a,char *s1,char *s2,int b);
#include <stdio.h>
/* entry point */
int main(void)
{
MessageBoxA(0,"Hi there","Hi there",0);
return 0;
}
MessageBoxA is __stdcall not __cdecl but you don't need to know that. Include the right header file and library and the import is done for you.
//int __cdecl MessageBoxA(int a,char *s1,char *s2,int b);
#include <windows.h>
#include <stdio.h>
/* entry point */
int main(void)
{
MessageBoxA(0,"Hi there","Hi there",0);
return 0;
}
Project Options Linker Library and Object Files: Add USER32.LIB
You do not need to use MessageBoxA, MessageBox will do, the header file will decide which version to use, ANSI or UNICODE, based on the setting of a variable.
Check the Windows header for the variables name.