PostMessage Help

Please help me,

I am try to write a C++ application that I need to work with a VB application I already have. I want to allow the applications to talk to each other via the post message function.

When I try to call the postmessage function in my C++ application I get the following error:

error C2660: 'PostMessageA' : function does not take 4 parameters

but it in fact does take 4 the parameter browser says it only takes 3 parameters, but every other piece of documetation for this points to four parameters. Please help
ce34llAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
MFC CWnd::PostMessage:

BOOL PostMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );

PostMessage API (without MFC):

BOOL PostMessage(
  HWND hWnd,      // handle to destination window
  UINT Msg,       // message
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);

If you call PostMessage from CWnd-derived class in MFC application, you should use MFC function (without first hWnd parameter) or non-MFC function with "::"

PostMessage(nMessage, 0, 0);  // MFC function
::PostMessage(hwnd, nMessage, 0, 0);  // API
0
ce34llAuthor Commented:
I tried to put the two : in front of it, still got this response

error C2660: 'PostMessageA' : function does not take 4 parameters
0
AlexFMCommented:
Please show your code.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

ce34llAuthor Commented:
I dont have any code, nothing will compile right.

This will not work

::PostMessage(hwnd,WM_USER + 1,0,0)

not does this
PostMessage(hwnd,WM_USER + 1,0,0)

I have included the windows.h file which includes the winuser.h file and has the dec in it:

WINUSERAPI
BOOL
WINAPI
PostMessageA(
    HWND hWnd,
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam);
WINUSERAPI
BOOL
WINAPI
PostMessageW(
    HWND hWnd,
    UINT Msg,
    WPARAM wParam,
    LPARAM lParam);
#ifdef UNICODE
#define PostMessage  PostMessageW
#else
#define PostMessage  PostMessageA
#endif // !UNICODE
0
AlexFMCommented:
Show your code which is not compiled.
0
ce34llAuthor Commented:
PostMessage is the first line of my code, I have nothing to show at this point. Show me a win32 dll where this message does work, and I'll give the question to you, better yet, show me a vb application sending and receiving strings using the post message API and I will open 4 more questions, each worth 250 points and award them all to you.
0
ce34llAuthor Commented:
PostMessage is the first line of my code, I have nothing to show at this point. Show me a win32 dll where this message does work, and I'll give the question to you, better yet, show me a vb application sending and receiving strings using the post message API and I will open 4 more questions, each worth 250 points and award them all to you.
0
ZoppoCommented:
Hi ce34ll,

this DLL can be compiled:

// test.h file
#ifdef TEST_EXPORTS
#define TEST_API __declspec(dllexport)
#else
#define TEST_API __declspec(dllimport)
#endif

TEST_API void func(void); // declaration


// test.cpp file
#include <windows.h>
#include "test.h"

// This is an example of an exported function.
TEST_API void func(void)
{
     ::PostMessage( HWND_BROADCAST, WM_USER + 1000, 0, 0 );
}

ZOPPO


PS: You really should post the code which cannot be compiled ...
it's really hard to find the problem by just guessing how
you code may look like.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ce34llAuthor Commented:
thanks I will try this later and let you know....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.