Tj Keel
Tj Keel

Reputation: 89

Changing MS Access Control box with WinAPI

In an Access form control box, there are only 5 elements. From left to right: application icon, title, minimize, maximize and close.

Using VBA to call Access properties, it is impossible to alter this control box in a way that adds additional elements. My goal is to use a Win32 API call to add a question mark to this control box, which points to a webpage (url destination is specific for each form). I believe this is possible, because there are many Windows forms outside of Access that have this question mark in what is the equivalent of a control box.

Here's a cropped image of one of my forms illustrating what I'm trying to do:

image

Here's an image of a form from Word that has the question mark, leading me to believe it's possible:

image

I've spoken to one other person who told me he thought this was possible, but had no idea how. I've scoured the Internet trying to find anybody talking about it, but there's nothing.

Any advice?

Upvotes: 0

Views: 238

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598414

The question mark is created by giving a window the WS_EX_CONTEXTHELP extended window style, or the DS_CONTEXTHELP dialog box style:

WS_EX_CONTEXTHELP
0x00000400L

The title bar of the window includes a question mark. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.

WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.

DS_CONTEXTHELP

Note that DS_CONTEXTHELP is only a placeholder. When the dialog box is created, the system checks for DS_CONTEXTHELP and, if it is there, adds WS_EX_CONTEXTHELP to the extended style of the dialog box.

Window styles are applied when a window is created with the CreateWindow/Ex() or DialogBox... () function, or by using SetWindowLong/Ptr() on an existing window.

Upvotes: 2

Related Questions