Hello,

Does anyone know which GDI API is called to draw menus and menu items on windows? I know its not DrawText, DrawTextEx, TextOut or ExtTextOut.

You need to study a windows tutorial to understand that. There is no single function. This tutorial will tell you how to add menus to your windows programs.

Thank you for your reply,

I think my original post wasn't too descriptive.

I know about win32 api. I'm using Detours (a library that Microsoft Research released for "detouring" a function in a given application. I don't mean to explain this with detail but what is does is to call your own function anytime the application you "detoured" calls the desired function (usually an api function). This can be used to get notified when a certain program wants to read/write values to and from the registry, files in your hard drive, etc.

I wrote a program that "detours" DrawText, DrawTextEx, TextOut or ExtTextOut (in fact their W versions) and calls the original functions with other parameters (so the given hDC gets drawn with whatever text i want).

The problem i have is that menus stay with their original text (my functions are not called) so I need to know which function(s) windows calls internally to draw menus.

By this i don't mean AppendMenu nor InsertMenuItem. I need the function(s) these call to draw text on screen.

I hope it's better explained now.

>>I hope it's better explained now.
Yes it does. I think you want hooks into those functions. I don't know the internal function names, but seems like what you need is Undocumented Windows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.