Sign in to follow this  
Followers 0


3 posts in this topic

Another DLLCALL.... ENJOY!

#include <GUIConstants.au3>

Global Const $MF_BYCOMMAND = 0x00000000
Global Const $MF_BYPOSITION = 0x00000400
Global Const $IMAGE_BITMAP = 0
Global Const $LR_LOADMAP3DCOLORS = 0x00001000
Global Const $LR_LOADFROMFILE = 0x0010


$trackmenu = GuiCtrlCreateContextMenu()

GuiCtrlCreateMenuItem("Item 1",$trackmenu)
GuiCtrlCreateMenuItem("Item 2",$trackmenu)
GuiCtrlCreateMenuItem("Item 3",$trackmenu)

AddImageToMenu($trackmenu, $MF_BYPOSITION, 1, ".\AddImageToMenu.bmp")


While GUIGetMsg() <> -3

Func AddImageToMenu($ParentMenu, $IndexType, $MenuIndex, $BitmapMenu)
    $hBmpMenu = DllCall("user32.dll", "hwnd", "LoadImage", "hwnd", 0, _
                                                           "str", $BitmapMenu, _
                                                           "int", $IMAGE_BITMAP, _
                                                           "int", 0, _
                                                           "int", 0, _
                                                           "int", BitOR($LR_LOADFROMFILE, $LR_LOADMAP3DCOLORS))
    $hBmpMenu = $hBmpMenu[0]
    DllCall("user32.dll", "int", "SetMenuItemBitmaps", "hwnd", GUICtrlGetHandle($ParentMenu), _
                                                       "int",  $MenuIndex, _
                                                       "int",  $IndexType, _
                                                       "hwnd", $hBmpMenu, _
                                                       "hwnd", $hBmpMenu)



Share this post

Link to post
Share on other sites

Nice one Scopinho... tested in a regular Menu and 'Context' :lmao: ... Good work!

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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  
Followers 0