Sign in to follow this  

Windows message Hell

This topic is 3587 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

Hello, lately ive been working on a "plug-in" for a program called Ventrilo(voice-chat). Heres the situation. There is a Treeview of a bunch of usernames(Clicky), and if you right click on these usernames, a drop-down list will pop up with a bunch of possible options(mute, etc). Well, im trying to simulate right-clicking on one of these usernames so the drop-down window will pop up. It seems like ive tried endless combinations of Windows messages, sifting through spy++ for and hints, but no luck.
#include <windows.h>
#include <commctrl.h>

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)
{
    HWND Vent = FindWindow( NULL, "Ventrilo" );//parent most window
    HWND Tree = FindWindowEx( Vent, NULL, "SysTreeView32", NULL );//this is the 
                                                                  //treeview
    
    if( !Tree )
    {
        MessageBox( NULL, "Tree: Failed", "Error", MB_OK );
        return 0;
    }
    
    POINT FinalPos;
    FinalPos.x = 35;//this is the hard coded position of the username(relative 
    FinalPos.y = 24;//to the window)
    
    int Param = MAKELPARAM( (short)FinalPos.x, (short)FinalPos.y );
    
    SendMessage( Tree, WM_RBUTTONDOWN, VK_RBUTTON, Param );
    SendMessage( Tree, WM_RBUTTONUP, 0, Param );
}





Right now, all it does is highlight the username, as if i have left clicked on it. Any ideas? thanks a bunch.

Share this post


Link to post
Share on other sites
Try sending it to the main message queue

SendMessage( Vent, WM_RBUTTONDOWN, VK_RBUTTON, Param );
SendMessage( Vent, WM_RBUTTONUP, 0, Param );





Edit:
That has some quirks, it would pop up the menu wherever your mouse is, so you need to move the mouse (if you want..)

Share this post


Link to post
Share on other sites
I tried using SendIput before, but for some reason, it would always be undefined when i included <windows.h. I scavanged the interweb, and found out i had to #define #define _WIN32_WINNT 0x0501 for it to work, Thanks a bunch .

Share this post


Link to post
Share on other sites

This topic is 3587 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this