Results 1 to 4 of 4

Thread: WM_COPYDATA Help Please

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    148

    WM_COPYDATA Help Please

    i'm using vc6

    i'm trying to make SendMessage with WM_COPYDATA send to other application
    but dont' know how to do struct

    this is the info i'm trying to send

    (WPARAM) (HWND) (LPARAM)

    how do i make this into string like -> 26589|2134|122345

    thankx

  2. #2
    Member
    Join Date
    Aug 2009
    Posts
    55

    Re: WM_COPYDATA Help Please

    Hey,

    Code:
    string myString;
    myString = "26589|2134|122345";
    
    COPYDATASTRUCT cds;
    cds.cdData = sizeof(myString);
    cds.lpData = &myString;
    cds.dwData = 0x1234;
    
    
    HWND hHwnd;
    hHwnd = FindWindow("Notepad", NULL);
    SendMessage(hHwnd, WM_COPYDATA, (WPARAM)"SOMETHINGHERE", (LPARAM)&cds);
    It depends on what the application is expecting as to what you should send it. If it's expecting a string, then something like that would work, although you're going to have to set your string up the way you want it.
    If it's expecting a custom struct then something different would be required.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    148

    Re: WM_COPYDATA Help Please

    26589<---hwnd
    2134<----wparam
    122345<--lparam

    how to get them into string?

  4. #4
    Member
    Join Date
    Aug 2009
    Posts
    55

    Re: WM_COPYDATA Help Please

    Code:
    	HWND hWnd = (HWND)26589;
    	WPARAM wParam = (WPARAM)2134;
    	LPARAM lParam = (LPARAM)122345;
    	
    	char pString[256] = "";
    	sprintf(pString, "&#37;i|%i|%i", hWnd, wParam, lParam);
    
    	COPYDATASTRUCT cds;
    	cds.cbData = sizeof(pString);
    	cds.lpData = &pString;
    	cds.dwData = 0x1234;
    
    	HWND hHwnd;
    	hHwnd = FindWindow("Notepad", NULL);
    	SendMessage(hHwnd, WM_COPYDATA, (WPARAM)"SOMETHINGHERE", (LPARAM)&cds);

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