WM_CHAR(AND TCHAR) Help!

This is a discussion on WM_CHAR(AND TCHAR) Help! within the Windows Programming forums, part of the Platform Specific Boards category; With my program, I can send keys to Notepad when it's open: I have this code for an AIM window: ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question WM_CHAR(AND TCHAR) Help!

    With my program, I can send keys to Notepad when it's open:

    I have this code for an AIM window:

    szIndex=SendMessage(listWin, LB_GETCURSEL, 0, 0);
    SendMessage(listWin, LB_GETTEXT, (LPARAM)szIndex, (WPARAM)szWinName);

    GetWindowText(kSend, winText, 1284);

    while(szFindWin==0)
    szFindWin=FindWindow(szWinName, 0);

    while(szFindWin_Chld==0)
    szFindWin_Chld=FindWindowEx(szFindWin, 0, "edit", 0);

    SendMessage(szFindWin_Chld, WM_CHAR, (WPARAM)winText, (LPARAM)0);
    break;

    And winText is declared first with TCHAR. When I want it to send to an AIM window, it doesn't and it freezes and I have to restart my program. How would I find the edit box to send key in an AIM window?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    It may be freezing your program because FindWindowEx() never finds an editbox so searches forever, maybe AIM doesn't use editboxes. If you've verfied that you have a valid handle to the main AIM window, you could try searching for other types of control that accept text input (Richedit control), or use EnumChildWindows() to enumerate all of AIM's child windows and see if you can find a way to write to any of them.
    zen

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Wink Thanks...

    Thanks zen. I'll try it!
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question What is---

    What is the class name for a Rich Edit? "rich", "richedit" what?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21