I'm using Dev-C++ for several month to develop small utilities, all simple dialog applications.
Until now I did this with simple Win32 API programming without really using the features of C++.
But as the amount of program grows I wanted to do so, without starting over with MS VC++ and MFC.
I tried to do the basics of a simple dialog window in C++, but I got stuck.
Can anyone teach me how to convert the following piece of code for a simple dialog, so that I can use functions as On_Init(), On_Command(), On_Close(), ...,
so that I can create a kind of template for creating new projects.
IDD_DLG DIALOG 0, 0, 100, 50
STYLE DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif"
PUSHBUTTON "Button", ID_BUTTON, 30, 18, 40, 14
/ Declare dialog procedure /
BOOL CALLBACK DlgProc (HWND, UINT, WPARAM, LPARAM);
/ Windows main function /
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG), NULL, DlgProc);
/ Implementation of dialog procedure /
BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
switch (message) // Handle messages
case WM_INITDIALOG: // Dialog is created
case WM_COMMAND: // Operate command
case WM_CLOSE: // Dialog is closed
I think I would not be the only one who is interested in this.
I'm looking forward to any explanations or hints!
Excuse my obviosly bad english, hope you understood what I wrote.
You can look in the forum faq useful links section for some tutorials, there should be one called something like foosyerdoos that I think has stuff about classes for Windows, might be a few other useful ones too.
You might also want to look into message crackers and the windowsx.h file which defines a whole bunch of macros for handling messages.