| | |
nid help in using dialog box
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2004
Posts: 2
Reputation:
Solved Threads: 0
i have a sample program,can someone help to find the error of this program or someone to correct this program coz i don't know what is the error of this program
this is the sample program of mine
this is the sample program of mine
C++ Syntax (Toggle Plain Text)
#include<windows.h> #include<string.h> #include<strstrea.h> #include"mydialog.h" void main() { LONG FAR PASCAL _export WindowFunc(HWND hwnd, unsigned message, WORD wParam, LONG lParam); BOOL FAR PASCAL _export DialogFunc(HWND hdwnd, unsigned message, WORD wParam, LONG lParam); char szWinName[] = "MyWin"; HANDLE hInst; int PASCAL WinMain(HANDLE hThisInst, HANDLE hPrevInst, LPSTR lpszArgs, int nWinMode); } { HWND hwnd; MSG msg; WNDCLASS wcl; HANDLE hAccel; if(!hPrevInst){ wcl.hInstance = hThisInst; wcl.lpszClassName = szWinName; wcl.lpfnWndProc =WindowFunc; wcl.style = NULL; wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION); wcl.hCursor = LoadCursor(NULL, IDC_ARROW); wcl.lpszMenuName = "MYMENU"; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hbrBackground = GetStockObject(LTGRAY_BRUSH); if(!RegisterClass (&wcl)) return 0; } hwnd=CreateWindow ( szWinName, "Dialog Boxes", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hThisInst, NULL ); hAccel = LoadAccelerators(hThisInst, "MYMENU"); hInst = hThisInst; ShowWindow(hwnd, nWinMode); while(GetMessage(&msg, NULL, 0, 0)) { if(!TranslateAccelerator(hwnd, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } { return msg.wParam; long FAR PASCAL WindowFunc(HWND hwnd, WORD message, WORD wParam, LONG lParam) { FARPROC lpDlg; int response; switch(message) { case WM_COMMAND: switch(wParam) { case IDM_DIALOG1: lpDlg = MakeProcInstance ((FARPROC) DialogFunc, hInst); DialogBox(hInst,"MYDB", hwnd, lpDlg; FreeProcInstance(lpDlg); break; case IDM_DIALOG2: MessageBox(hwnd, "Not Implemented", "", MB_OK); break; case IDM_HELP: MessageBox(hwnd, "Not Impelemented", "HELP", MB_OK); break; } break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hwnd, message, wParam, lParam); } BOOL FAR PASCAL DialogFunc(HWND hdwnd, unsigned message, WORD wParam, LONG lParam) { switch(message){ case WM_COMMAND: switch(wParam) { case IDCANCEL: EndDialog(hdwnd, NULL); return 1; case IDD_RED: MessageBox(hdwnd,"You Picked Red", "RED", MB_OK); return 1; case IDD_GREEN: MessageBox(hdwnd,"You Picked Green", "GREEN", MB_OK); return 1; } } return 0; }
Last edited by alc6379; Mar 15th, 2005 at 10:23 am. Reason: added [code] tags
![]() |
Similar Threads
- changing color of a pushbutton on a dialog box (C)
- open save dialog box error (PHP)
- Dialog box missing when sending attachments. (Windows NT / 2000 / XP)
- dialog box question (C)
- Dialog box wrong size (Windows NT / 2000 / XP)
- Common Open dialog box (C++)
- Dialog Box alongwith Form (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: Sorting
- Next Thread: C++ Reorder random numbers
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





