15,471
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
#include <stdio.h>
typedef int (WINAPI *PMessageBox)(
HWND hWnd, // handle to owner window
LPCTSTR lpText, // text in message box
LPCTSTR lpCaption, // message box title
UINT uType // message box style
);
int main(int argc, char* argv[])
{
char szText[128] = "HelloWorld!";
char szCaption[10] = "Hi";
PMessageBox MsgBox = (PMessageBox)GetProcAddress(LoadLibrary("User32.dll"), "MessageBoxA");
if (MsgBox)
{
MsgBox(NULL, szText, szCaption, 0);
}
else
{
printf("MsgBox is NULL\n");
}
return 0;
}