Thread: Wide char problems

  1. #1
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214

    Wide char problems

    ok well what im doing is making a program that sends text to a program..
    the thing is i need it to be able to send unicode chares like

    and so on
    heres what i have so far

    Code:
      case WM_COMMAND:
        if ( (HWND) lParam == hwndButton1 ) {
    		POINT pt;
    
    		char go[] = "hook set";
    
    		MessageBox(0,"test","test",0);
    		GetCursorPos(&pt);
    		hackedh = WindowFromPoint(pt);
    		SendMessage(hwndEdit, WM_SETTEXT, (WPARAM) sizeof(""), (LPARAM) "");
    		SendMessage(hackedh, WM_SETTEXT, (WPARAM) sizeof(go), (LPARAM) go);
    
    		PostMessage(hackedh, WM_KEYUP, (WPARAM)VK_RETURN, (LPARAM)0);
    
    
    		}
    	if ( (HWND) lParam == hwndButton2 ) {
    
    		WCHAR TextBuffer[128];
    
    		SendMessageW(hwndEdit, WM_GETTEXT, (WPARAM) sizeof(TextBuffer), (LPARAM) TextBuffer);
    
    		SendMessageW(hackedh, WM_SETTEXT, (WPARAM) sizeof(TextBuffer), (LPARAM) TextBuffer);
    		PostMessage(hackedh, WM_KEYUP, (WPARAM)VK_RETURN, (LPARAM)0);
    }
    now when ii try to send chars like that it comes up as ?

    also hwndEdit is a rich text box

    please help..thanks

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Well do you have UNICODE defined? I don't usually use WCHAR, I use TCHAR. In non unicode it evalutes to a char and in unicode, a wide char. Maybe that is what is happening. Also don't explicitly call the Wide versions of functions, the compiler will call the correct version for you. Just use SendMessage.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214

    got it

    ah thanks for the reply..i worked it out thou
    needed to use GETTEXTEX to read from the rtf box

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. convering char to int problems
    By ominub in forum C Programming
    Replies: 5
    Last Post: 04-01-2009, 12:02 PM
  2. The Interactive Animation - my first released C program
    By ulillillia in forum A Brief History of Cprogramming.com
    Replies: 48
    Last Post: 05-10-2007, 02:25 AM
  3. Replies: 7
    Last Post: 06-16-2006, 09:23 PM
  4. How do i un-SHA1 hash something..
    By willc0de4food in forum C Programming
    Replies: 4
    Last Post: 09-14-2005, 05:59 AM
  5. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM