Software Archive
Read-only legacy content
17061 Discussions

F1 key WinHelp and QuickWin problems

isn-removed200637
273 Views
I have an application which uses the default QuickWin menus and appends and inserts new menu items.


To add F1 key help to the menus, I



replaced the default window procedure DefWindowProc with MyWndProc using SetWindowLong


determined the control IDs(ctrlid) that each menu item sent when F1 is pressed with the menu item highlighted with the mouse by intercepting the WM_HELP command in MyWndProc


Generated help topics (HIDM_menuname ) for the menu items in my help file


added #define HIDM_menuname menucontrol_ID to the [MAP]


section of the Help file to ensure that the number sent by WinHelp(menucontrol_ID) is mapped to the correct help topic


added the following call to WinHelp in MyWNdProc


   
rethelp=WINHELP(hWnd,           &    
	'WIREFRAME.HLP'C,	 &   
	HELP_CONTEXTPOPUP, ctrlid  )   
MyWndProc = rethelp     
    case default   
MyWndProc = CallWindowProc(hWndProc, hWnd, mesg, wParam, lParam )  


What happens is that when I highlight a menu item with the mouse and press F1, I get the help topic appearing in the pop-up window BUT this is accompanied by the appearance of a message box. The message box appearance depends on whether one of my added menu items is highlighted or one of the default QuickWin menu items .



In the first case, the title bar contains the application's name and the message is 'Help not available for this menu item' and the OK button.


In the second case, the title bar is 'Windows Help' and the message is 'The topic does not exist. Contact your application vendor for an updated Help file (129)' with the OK button.



There is sometimes a second or two delay between the diagnostic message box appearing and the pop-up window appearing.



Can anyone supply an explanation?



As a final twist, I have found that adding a diagnostic call to MESSAGEBOXQQ (to output the HELPINFO structure contents that the WM_HELP message supplies) just before the call to WinHelp suppresses this weird behaviour. I get MY messagebox ok, followed by the help topic pop-up window, with no additional message box.
0 Kudos
2 Replies
isn-removed200637
273 Views
A P.S to my message.


The problem described occurs if the menu item is higlighted with the mouse BUT NO MOUSE BUTTON IS PRESSED when I press F1.
If I hold the LEFT mouse buton down, then press F1, the pop-up appears correctly, with no other message box.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
273 Views
Um,... what do you get as ctrlID in the first case? And how do you get it? I tried it in this way:

 
TYPE(T_HELPINFO)::      HI;      POINTER(lpHI,HI) 
... 
CASE (WM_HELP) 
      lpHI=lParam 


Your error message looks as if ctrlID contains an invalid value (ID of the frame window, maybe?). However, on my Win2000 system, I get correct HI%iCtrlID on F1 regardless of whether the mouse button is down, up, or if the menu item is accessed by the keyboard. Try to track it -- if it's not so on Win9x, please repost so we could make up a workaround.

Regards

Jugoslav
0 Kudos
Reply