CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: MFC C++

  1. #1
    Guest

    MFC C++

    Can someone please tell me why is that whenever I use SetWindowText or TextOut in my source code, I get compiler complain of :
    "SetWindowTextA is not a member of HWND" and,
    "TextOutA is not a member of HWND" ?? Where does the "A" comes from.
    I have no such problem if the same function calls are use in the context of the dialog code. Example under MyClass::OnInitDialog() or MyClass::OnOK()


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: MFC C++

    take a look at winuser.h

    WINUSERAPI
    BOOL
    WINAPI
    SetWindowTextA(
    HWND hWnd,
    LPCSTR lpString);
    WINUSERAPI
    BOOL
    WINAPI
    SetWindowTextW(
    HWND hWnd,
    LPCWSTR lpString);
    #ifdef UNICODE
    #define SetWindowText SetWindowTextW
    #else
    #define SetWindowText SetWindowTextA
    #endif // !UNICODE

    A is for ANSI, W (wide chars) for Unicode


  3. #3
    Guest

    Re: MFC C++

    Thanks Lothar,
    I have used SetWindowText(pwnd, "Some Text"), of which pwnd was obtained from HWND pwnd = ::FindWindow(MyDialog, NULL)...something like that !!
    But the compiler complains anyway. (By the way, I was trying to change the text on a Button)
    How can the problem be solved ?


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: MFC C++

    if you need to call the API function instead of the class member method, you should use ::SetWindowText instead. Did you try that?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured