Advertisement Jump to content
Sign in to follow this  

SendMessage() fails with Error 183

This topic is 4984 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This makes no sense.. I have the following code:
bool val = SendMessage(hTargetApp, WM_KEYDOWN, VK_SPACE, 1);
if (!val) SysError("SendMessage_Space_Down");
The SysError function is a modified version of ErrorExit from MSDN:
void SysError(LPTSTR lpszFunction) 
    TCHAR szBuf[256]; 
    LPVOID lpMsgBuf;
    DWORD dw = GetLastError(); 

        (LPTSTR) &lpMsgBuf,
        0, NULL );

        "%s failed with error %d: %s", 
        lpszFunction, dw, lpMsgBuf); 

And this is the result in the log:
SendMessage_Space_Down failed with error 183: Cannot create a file when that file already exists.
This makes no sense to me, because using SendMessage() has nothing to do with writing files. Also, it cannot be a problem the logging function, because as you can see, the SysError function traps the error right away, so the only thing it can be is SendMessage().

Share this post

Link to post
Share on other sites
SendMessage() does not return 0 on error. Its return value depends on the message being sent. In the case of WM_KEYDOWN I believe 0 is the normal return value.

Share this post

Link to post
Share on other sites
SendMessage's return value is not a success or error code. It's depending on the message and can be anything.
Also, it's not a bool, but a LRESULT.

The return value could be 0 if the user processes WM_KEYDOWN, but could be anything else as well.
The only thing you can tell from a returned value, that the target app processed the message. If it didn't you would get stuck in SendMessage.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!