Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Blaze on April 17, 2005, 02:08 PM

Title: Plugin Problem
Post by: Blaze on April 17, 2005, 02:08 PM
Okay, I am making plugins for my bot, and they create menus on the main form of my bot. I need to make that menu's onclick goto code in the plugin, how would I go about doing this?
Title: Re: Plugin Problem
Post by: UserLoser. on April 17, 2005, 04:20 PM
Just have the plugin hook the main window and the plugin create the menu.  In your message hook, watch for WM_COMMAND message and look for when your menu is commanded (clicked, pressed) then do the appropriate actions in your plugin
Title: Re: Plugin Problem
Post by: Networks on April 17, 2005, 04:38 PM
Out of curiosity how exactly does your plugin create a menu? What did you do to do this?
Title: Re: Plugin Problem
Post by: UserLoser. on April 17, 2005, 04:42 PM
The plugins I write are BinaryChat Plugins (http://www.valhallalegends.com/pub/BCP/SDK/EmptyPlugin/EmptyPlugin.zip), which I use on SphtBot (http://www.valhallalegends.com/spht/SphtBotv3/).  All I simply do is: API.GetMenu(PluginAPI::MainWindowMenu), and from I use the PluginMenu (http://www.valhallalegends.com/pub/bcp/SDK/PluginMenu/PluginMenu.zip) package inside the plugin to do whatever you wish.

Otherwise, pass the window handle over to your plugin, then use GetMenu (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuFunctions/GetMenu.asp), AppendMenu (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuFunctions/AppendMenu.asp), CreateMenu (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuFunctions/CreateMenu.asp), InsertMenuItem (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Menus/MenuReference/MenuFunctions/InsertMenuItem.asp), etc (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/menus.asp).  Also, use SetWindowsHookEx (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp) and UnhookWindowsHookEx (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/unhookwindowshookex.asp) to hook and unhook the window.