char array to LPCTSTR conversion in c

前端 未结 8 871

Does anyone know how to convert a char array to a LPCTSTR in c?

Edit:

For more reference, I need to add an integer to a string then convert that string to LP

8条回答
  •  心在旅途
    2021-01-02 03:48

    It is an old classical question. I use it in UNICODE.

    char *pChar = "My Caption of My application";
        WCHAR wsz[512];
        swprintf(wsz, L"%S", pChar);
        SetWindowText(hWnd,         // ウィンドウまたはコントロールのハンドル
            wsz   // タイトルまたはテキスト
        );
    

提交回复
热议问题