Skip to content

Commit

Permalink
Fix Natlink message window pop-up menu initialization
Browse files Browse the repository at this point in the history
Re: dictation-toolbox#184.

The message window's pop-up menu is now loaded from the executable
resource data.  It is easier to change now.
  • Loading branch information
drmfinlay committed Oct 17, 2024
1 parent 5d61154 commit 08f1c16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions NatlinkSource/MessageWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ INT_PTR CALLBACK dialogProc(

return TRUE;
case WM_INITDIALOG:
HMENU hMenu, hSubMenu;

hMenu = CreateMenu();
hSubMenu = CreatePopupMenu();
AppendMenu(hSubMenu, MF_STRING, IDD_RELOAD, L"&Reload");
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"&File");
HMENU hMenu, hSubMenu;
HINSTANCE hInstance;

// Save a pointer to the message window for later.
s_pSecdThrd = (MessageWindow *)lParam;

// Load the popup menu.
hInstance = _Module.GetModuleInstance();
hMenu = LoadMenu( hInstance, MAKEINTRESOURCE( IDR_MENU ) );

SetMenu(hWnd, hMenu);
s_pSecdThrd = (MessageWindow *)lParam;
// Assign IDR_MENU to the window and hide it.
SetMenu( hWnd, hMenu );
ShowWindow( hWnd, SW_HIDE );
return TRUE;

Expand Down
2 changes: 1 addition & 1 deletion NatlinkSource/natlink.rc.in
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ IDR_APPSUPP REGISTRY "appsupp.reg"
IDD_STDOUT DIALOGEX 0, 25, 285, 135
STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Messages from Natlink"
//MENU IDR_MENU
MENU IDR_MENU
FONT 9, "Courier New", 0, 0, 0x0
BEGIN
CONTROL "",IDC_RICHEDIT,"RICHEDIT",TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_TABSTOP,5,5,275,125
Expand Down

0 comments on commit 08f1c16

Please sign in to comment.