I want to call the MessageBox () function this way:
1). Download the required library
2). get the address of the function
3). call him
So, for this purpose, as I understand it, I have to define a new type with all types of arguments in the MessageBox function.
It returns an INT and accepts: HWND, LPCSTR, LPCSTR, UNIT.
So, I registered a new type:
typedef int(__stdcall *msgbox)(HWND, LPCSTR, LPCSTR, UINT);
I have problems calling such a function. Is this method used for all functions or only for export?
How can I call a MessageBox exactly this way?
Full code:
#include <iostream>
#include <windows.h>
using namespace std;
typedef int(__stdcall *msgbox)(HWND, LPCSTR, LPCSTR, UINT);
int main(void)
{
HINSTANCE__ *hModule = LoadLibrary(L"\\Windows\\System32\\User32.dll");
msgbox *me = 0;
if(hModule != 0)
{
me = (msgbox*)GetProcAddress(hModule, "MessageBox");
}
return 0;
}
Thanks,
Best regards!
user1131997
source
share