Convert char[] to LPCWSTR

前端 未结 5 903
轻奢々
轻奢々 2020-11-30 13:05

Can anyone help me to correct this code:

    char szBuff[64];
    sprintf(szBuff, \"%p\", m_hWnd);
    MessageBox(NULL, szBuff, L\"Test print handler\", MB_O         


        
5条回答
  •  渐次进展
    2020-11-30 13:17

    Since your tag suggests VC++, I am suggesting CString. If yes, then the following snippet will also work for your case:

    CString szBuff;
    
    szBuff.Format(_T("%p"), m_hWnd);
    MessageBox(NULL, szBuff, L"Test print handler", MB_OK);
    

提交回复
热议问题