CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Posts
    3

    WM_SETTEXT in Wind\ows 7

    Trying to use

    SendMessage(hwnd_child,WM_SETTEXT,0,(LPARAM)"Test");


    It is finding the child fine, I can read text of off it till I'm blue in the face, but I can't seem to get SetText to work.
    I've seen posts that say SETTEXT doesn't work between apps in Windows 7, even with elevated priveleges. Is there some other way to set text in a seperate app? It's a vb.net app, that I'm coding.
    Sending Settext from a C++ non-visual app.

  2. #2
    Join Date
    Oct 2005
    Location
    Minnesota, U.S.A.
    Posts
    680

    Re: WM_SETTEXT in Wind\ows 7

    One immediate thought, WM_SETTEXT is UNICODE, you need to send a UNICODE string. Try:

    SendMessage(hwnd_child,WM_SETTEXT,0,(LPARAM)L"Test");

    If that doesn't work, post what you are getting for output.

    -Erik

  3. #3
    Join Date
    Dec 2011
    Posts
    3

    Re: WM_SETTEXT in Wind\ows 7

    Yup, still not working.
    lResult = SendMessage(hwnd_child,WM_SETTEXT,0,(LPARAM)L"Test");

    Returns true, but nothing is changed in the receiving app.

  4. #4
    Join Date
    Dec 2011
    Posts
    3

    Re: WM_SETTEXT in Wind\ows 7

    SendMessageA works, it doesn't update graphically but it's a hidden window, reading the text off it displays the expected information.

    =) thanks

  5. #5
    Join Date
    Oct 2005
    Location
    Minnesota, U.S.A.
    Posts
    680

    Re: WM_SETTEXT in Wind\ows 7

    Sounds like you are using MBCS code and UNICODE flags.

    WM_SETTEXT also comes in rootbeer versions WM_SETTEXTA and WM_SETTEXTW.

    Try specifying which one.

    -Erik

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