I am new to Win32 API and am having trouble setting up the menu. Here is what I have at the moment (my new way of doing the main.cpp code is from another member) but I cannot understand where to put in the function call for the menu..
main.cpp
#include <windows.h>
#include <string>
#include "resource.h"
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
// Initiate what loads when the application starts
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_LATE_BREAK_BTN:
return TRUE;
case IDCANCEL:
EndDialog(hWndDlg, 0);
return TRUE;
}
break;
}
return FALSE;
}
int APIENTRY
WinMain (HINSTANCE hInst, HINSTANCE unused, LPSTR cmdLine, int cmdShow)
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_CONTROLS_DLG), 0, (DLGPROC)(DlgProc));
return 0;
}
#include "resource.h"
#include <afxres.h>
IDD_CONTROLS_DLG DIALOG DISCARDABLE 0, 0, 132, 180
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "HSBC Break Clock"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Current Time is: ",IDC_STATIC,10,10,55,12
LTEXT "Meeting Time: ",IDC_STATIC,10,30,45,12
LTEXT "Start Time: ",IDC_STATIC,10,50,45,12
LTEXT "Break 1 Start: ",IDC_STATIC,10,70,45,12
LTEXT "Lunch Start: ",IDC_STATIC,10,90,45,12
LTEXT "Break 2 Start: ",IDC_STATIC,10,110,45,12
LTEXT "End Time: ",IDC_STATIC,10,130,45,12
EDITTEXT IDC_CURRENT_TIME,80,10,45,12, ES_AUTOHSCROLL
EDITTEXT IDC_MEETING_TIME,80,30,45,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT IDC_START_TIME,80,50,45,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT IDC_BREAK1,80,70,45,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT IDC_LUNCH,80,90,45,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT IDC_BREAK2,80,110,45,12,ES_RIGHT | ES_AUTOHSCROLL
EDITTEXT IDC_LEAVE_TIME,80,130,45,12,ES_RIGHT | ES_AUTOHSCROLL
PUSHBUTTON "Late Break",IDC_LATE_BREAK_BTN,20,150,40,18
PUSHBUTTON "Quit",IDCANCEL,70,150,40,18
END
IDR_MAIN_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "Se&lect a Sound", IDM_FILE_SOUND
MENUITEM "E&xit", IDM_FILE_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About...\tF1", IDM_HELP_ABOUT
END
END
resource.h
#define IDD_CONTROLS_DLG 101
#define IDR_MAIN_MENU 102
#define IDR_POPUP 103
#define IDC_CURRENT_TIME 1002
#define IDC_MEETING_TIME 1003
#define IDC_START_TIME 1004
#define IDC_BREAK1 1005
#define IDC_LUNCH 1006
#define IDC_BREAK2 1007
#define IDC_LEAVE_TIME 1008
#define IDC_LATE_BREAK_BTN 1009
#define IDM_FILE_SOUND 2001
#define IDM_FILE_EXIT 2002
#define IDM_HELP_ABOUT 2003