Jump to content

How to add an arrow for a menu item without GDIPlus?


Recommended Posts

I'm using _GUICtrlMenu_AddMenuItem() and it works great!

But I want to add a simple arrow to the menu item. Now the problem is that special characters aren't allowed, at least, ChrW(<code>) doesn't do the job for me (using Windows XP).

So I decided to use _GUICtrlMenu_SetItemBmp() as well, but I'm having trouble using this. But I do not want to use GDIPlus just for a simple arrow. I just want a single colour very simple 11 by 11 bitmap, no other advanced stuff.

Amongst other things, I tried the following to create the bitmap:

$tAsc = DllStructCreate($tagBITMAPINFO)

DllStructSetData($tAsc,"Size",DllStructGetSize($tAsc)-4)

DllStructSetData($tAsc,"Width",11)

DllStructSetData($tAsc,"Height",11)

DllStructSetData($tAsc,"Planes",1)

DllStructSetData($tAsc,"BitCount",24) ; also tried 16

DIM $aAsc[11] = ; tried various things like strings and binary values

$hDC = _WinAPI_CreateCompatibleDC(0)

$hAsc = _WinAPI_CreateCompatibleBitmap($hDC,11,11)

_WinAPI_SelectObject($hDC,$hAsc) ; also tried omitting whole line

_WinAPI_SetDIBits($hDC,$hAsc,0,11,$aAsc,$tAsc,1) ; also tried omitting last parameter

The menu shows either with a full block or no bitmap at all. What am I doing wrong?

Link to comment
Share on other sites

Got it fixed now, so no more need for help.

Numerous issues with Dll*functions geez, they didn't make it easy.

In addition, _GUICtrlMenu_SetItemBmp() doesn't do the trick, gotto use _GUICtrlMenu_SetItemBitmaps() instead.

Link to comment
Share on other sites

Might have been easier to use

$Menu = GUICtrlCreateMenu("&File")
$Menu_1 = GUICtrlCreateMenu("Next Menu" & @Tab & ">>", $menu)

Or

$Menu = GUICtrlCreateMenu("&File")
$Menu_1 = GUICtrlCreateMenu("Next Menu" & @Tab & "->", $menu)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...