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

Thread: PostMessage

  1. #1
    Join Date
    Apr 2001
    Location
    taiwan
    Posts
    28

    PostMessage

    Why error when I call the PostMessage?

    Below is my code at DLL.

    extern "C" __declspec( dllexport ) int CallApp()
    {
    COPYDATASTRUCT cds;
    cds.dwData = 1;
    cds.lpData = (LPVOID)(LPCTSTR)"DLL FuncCall";
    cds.cbData = 5;
    HWND hwnd = FindWindow(NULL,"AppService");
    if(hwnd)
    {
    if(!PostMessage(hwnd,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds))
    {
    DWORD dwErr = GetLastError();
    MessageBox(NULL,"PostMessage ERROR","EnvoxDLL ALERT",MB_OK);
    }
    }
    else MessageBox(NULL,"NO APP","EnvoxDLL ALERT",MB_OK);
    return 0;
    }

    Best Regards

    alan
    2001/4/20

  2. #2
    Join Date
    Apr 2000
    Location
    San Francisco, California, USA
    Posts
    4,467

    Re: PostMessage

    What is the value returned by GetLastError?

    Russian Software Development Network -- http://www.rsdn.ru

  3. #3
    Join Date
    May 2001
    Location
    South Korea
    Posts
    150

    Re: PostMessage

    You cannot use PostMessage with WM_COPYDATA message. Use SendMessage instead.


    Best regards. Alex.

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