菜鸟提问:FormatMessage()格式化GetLastError()见得多了,但不知提取资源中的数据?望赐教!

解决方案 »

  1.   

    LPVOID lpMsgBuf;
    FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (LPTSTR) &lpMsgBuf,0,NULL );
    MessageBox( NULL, lpMsgBuf, "提示", MB_OK|MB_ICONSTOP );
    LocalFree( lpMsgBuf );
      

  2.   

    据说FormatMessage()还可格式化资源中的数据,不知如何?
      

  3.   

    CString str;
    str.FormatMessage( IDS_MESSAGE );
    MessageBox( str );
      

  4.   

    CString str;
    str.FormatMessage( IDS_MESSAGE );
    MessageBox( str );
      

  5.   

    Sorry, 我指的是那个SDK API函数::FormatMessage(...),
    后面带一大堆参数的