Jump to content
Sign in to follow this  
Pa Callender

Left-Click context menu AND Bitmap/Icon on button on shaped GUI

Recommended Posts

Pa Callender

A: Could you possibly tell me how, or suggest how to open a context menu on a PRIMARY mouse button click - tried

; Script generated by GUIBuilder 9.4

#include "CoreIncludes.sin";GUIConstants, Chris Haney's Database, and my GetUser, GetDir and ModuleStart functions

$GUI_Handle = GuiCreate("SSIP Anchor", 120, 120,(@DesktopWidth-170), (@DesktopHeight-170), $WS_POPUP)

$Button_1 = GuiCtrlCreateButton("", 0, 0, 120, 120, BitOr($BS_ICON, $BS_FLAT))
GUICtrlSetTip(-1, "Click Here to open the SSIP menu")
GUICtrlSetBkColor(-1, 0x0000FF)
$menu = GUICtrlCreateContextMenu()
$exit = GUICtrlCreateMenuItem("Exit",$menu)

_GuiRoundCorners($GUI_Handle, 0, 0, 120, 120, 120, 120)

While 1
 $msg = GuiGetMsg()
 Case $msg = $GUI_EVENT_CLOSE
 Case $msg = $Button_1
 Case Else



B: In the above program the button loses the image when RoundCorners is applied. Can someone help me solve this?

Sorry if this is any inconvenience or really annoying, but I want this information so I can create a School Information Portal (just as a fun project). This code is for the "anchor" or core of the project.


[size="4"]YOU SHALL NOT PARSE!![/size]

Share this post

Link to post
Share on other sites

#include <GUIConstants.au3>


$hwnd = GUICreate("", 300, 300)
$mybutt = GUICtrlCreateButton("Clickalicious", 50, 50, 100, 40)
$context = GUICtrlCreateContextMenu($mybutt)
GUICtrlCreateMenuitem("item1", $context)


While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If $msg = $mybutt Then DllCall("user32.dll", "ptr", "SendMessage", "hwnd", ControlGetHandle($hwnd, "", $mybutt), "int", $WM_CONTEXTMENU, "int", $mybutt, "int", 0)

The DLLCall is something LazyCat put together some time I believe..

Share this post

Link to post
Share on other sites
Pa Callender

DllCall("user32.dll", "ptr", "SendMessage", "hwnd", ControlGetHandle($hwnd, "", $mybutt), "int", $WM_CONTEXTMENU, "int", $mybutt, "int", 0)
Thankyou very much Helge. I will test the code and reply in a few minutes.

EDIT: This piece of code is wonderful! Thankyou very much!

Edited by Pa Callender

[size="4"]YOU SHALL NOT PARSE!![/size]

Share this post

Link to post
Share on other sites

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.