zoukankan      html  css  js  c++  java
  • LPCTSTR /Data Types/ cannot convert parameter 1 from 'const char [5]' to 'LPCTSTR'

    LPCTSTR   A 32-bit pointer to a constant character string that is portable for Unicode and DBCS.

    CButton::Create

    BOOL Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );

    若:

    CButton m_btn;

    m_btn.Create("按钮",WS_CHILD|BS_DEFPUSHBUTTON,CRect(0,0,100,100),this,123);

    提示:error C2664: 'CButton::Create' : cannot convert parameter 1 from 'const char [5]' to 'LPCTSTR'

    修改:

    m_btn.Create(L"按钮",WS_CHILD|BS_DEFPUSHBUTTON,CRect(0,0,100,100),this,123);

    //把字符串 "按钮" 定义为宽字符串 L"按钮"

  • 相关阅读:
    343. Integer Break
    338. Counting Bits
    322. Coin Change
    304. Range Sum Query 2D
    303. Range Sum Query
    221. Maximal Square
    213. House Robber II
    cf
    poj2478欧拉函数
    lightoj1138
  • 原文地址:https://www.cnblogs.com/ezhong/p/2171501.html
Copyright © 2011-2022 走看看