源码
1 #include<Windows.h> 2 #include<stdio.h> 3 4 int MessageBoxPrint(char *szFormat, ...); 5 6 int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR strCmd, int nShow) 7 { 8 char str[1024]; 9 MessageBoxPrint("%p", hInst); 10 return 0; 11 } 12 13 int MessageBoxPrint(char *szFormat, ...) 14 { 15 char buf[1024]; 16 va_list va; 17 va_start(va, szFormat); 18 vsnprintf(buf, sizeof(buf), szFormat, va); 19 va_end(va); 20 return MessageBox(NULL,buf,"printf",MB_OK); 21 }