qq_37362700
qq_37362700
2017-10-16 18:07

格式化的消息框_MessageBoxPrintf使用报错

  • 格式化
  • winapi
  • windows核心编程5
 //#include <stdio.h>
#include <windows.h>

int CDECL MessageBoxPrintf(TCHAR *szCaption,TCHAR *szFormat)
{
    TCHAR szBUffer[1024];
    va_list pArgList;
    va_start(pArgList,szFormat);
    _vsntprintf(szBUffer,sizeof(szBUffer)/sizeof(TCHAR),szFormat,pArgList);
    va_end(pArgList);
    return MessageBox(NULL,szBUffer,szCaption,0);
}

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
    int cxScreen,syScreen;
    cxScreen=GetSystemMetrics(SM_CXSCREEN);
    syScreen=GetSystemMetrics(SM_CYSCREEN);
    MessageBoxPrintf(TEXT("Scrnsize"),TEXT("the screen is %i pixels wide by %i pixels hight"),cxScreen,syScreen);
    return 0;
}

图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答