Windows message Hell

Started by
3 comments, last by fitfool 16 years, 2 months ago
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.
Advertisement
:/
Have you tried SendInput?
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..)
--------------------------------------"Those alien bastards are gonna pay for ruining my ride !"
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 .

This topic is closed to new replies.

Advertisement