Subj : Re: beginning dialog boxes (3) To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Thu Sep 18 2003 09:29 pm The compiler documentation documents the compiler and tools. That is a large enough job in itself. It is not intended as a tutorial on how to write programs for Windows. It would probably be best to buy a book on Windows. Petzold's series of books "Programming Windows *" where the '*' varies with editions is a good one. One gentleman already told you about the examples using OWL, Object Windows Library. An example of a straight Windows API program with a dialog box is below. Create a project for a Win32 target, add these files to the project, build and run it. -----File DEMO.CPP------ #define STRICT #include #include "demo.rh" BOOL CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM) { static char endmsg[132] = ""; switch (msg) { case WM_INITDIALOG : { SetDlgItemText(hwnd, IDC_EDIT1, "Write something into this control"); break; } case WM_COMMAND : { switch (LOWORD(wParam)) { case IDC_PUSHBUTTON1 : { MessageBox(hwnd, "You pressed the middle button", "", MB_OK); break; } case IDOK : { lstrcpy(endmsg, "You pressed Ok"); } // fall through case IDCANCEL : { if (!endmsg[0]) lstrcpy(endmsg, "You pressed Esc or Cancel"); MessageBox(hwnd, endmsg, "", MB_OK); GetDlgItemText(hwnd, IDC_EDIT1, endmsg, sizeof(endmsg) - 1); EndDialog(hwnd, (int) endmsg); break; } } break; } } return FALSE; } int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int) { char *s = (char *) DialogBox(hInst, MAKEINTRESOURCE(DIALOG_1), HWND_DESKTOP, DlgProc); MessageBox(HWND_DESKTOP, s, "You typed in this", MB_OK); return 0; } -----File DEMO.RC------- #include "demo.rh" DIALOG_1 DIALOG 6, 15, 194, 119 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "Dialog Box Caption" FONT 8, "MS Sans Serif" { DEFPUSHBUTTON "OK", IDOK, 27, 94, 50, 14 PUSHBUTTON "Cancel", IDCANCEL, 110, 94, 50, 14 PUSHBUTTON "Push Me", IDC_PUSHBUTTON1, 72, 48, 50, 14 EDITTEXT IDC_EDIT1, 42, 20, 126, 12 } -----File DEMO.RH------- #define DIALOG_1 1 #define IDC_PUSHBUTTON1 101 #define IDC_EDIT1 102 ------------------- .. Ed > Rob C wrote in message > news:3f6a264f$1@newsgroups.borland.com... > > Am I in the right group for this question??? > > target type - application //these are my settings. Are they > right? > platform - win32 > > This is very frustrating! I feel that I can create/design a > dialog boxes (*.rc file), but I still can’t figure out how to > put them into my program. Is there an example program somebody > else wrote that I could study? There should be a basic, step-by- > step tutorial for beginners like me. If there is, where is it? .