static int createAboutBox( HINSTANCE hInstance, HWND hwnd ) { WORD* p, *pdlgtemplate; int nchar; DWORD lStyle; HWND hwndReturn; /* * Allocate some memory to play with */ pdlgtemplate = p = ( PWORD ) LocalAlloc( LPTR, 1000 ); /* * Start to fill in the dlgtemplate information. addressing by WORDs */ lStyle = WS_DLGFRAME | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | DS_SETFONT; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; /* LOWORD (lExtendedStyle) */ *p++ = 0; /* HIWORD (lExtendedStyle) */ *p++ = 7; /* Number Of Items */ *p++ = 210; /* x */ *p++ = 10; /* y */ *p++ = 200; /* cx */ *p++ = 100; /* cy */ *p++ = 0; /* Menu */ *p++ = 0; /* Class */ /* * Copy the title of the dialog */ nchar = nCopyAnsiToWideChar( p, "GoAhead WebServer" ); p += nchar; /* * Font information because of DS_SETFONT */ *p++ = 11; /* point size */ nchar = nCopyAnsiToWideChar( p, T( "Arial Bold" ) ); p += nchar; /* * Make sure the first item starts on a DWORD boundary */ p = lpwAlign( p ); /* * Now start with the first item (Product Identifier) */ lStyle = SS_CENTER | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; /* LOWORD (lExtendedStyle) */ *p++ = 0; /* HIWORD (lExtendedStyle) */ *p++ = 10; /* x */ *p++ = 10; /* y */ *p++ = 180; /* cx */ *p++ = 15; /* cy */ *p++ = 1; /* ID */ /* * Fill in class i.d., this time by name */ nchar = nCopyAnsiToWideChar( p, TEXT( "STATIC" ) ); p += nchar; /* * Copy the text of the first item */ nchar = nCopyAnsiToWideChar( p, TEXT( "GoAhead WebServer 2.1.8" ) ); p += nchar; /* * Advance pointer over nExtraStuff WORD */ *p++ = 0; /* * Make sure the next item starts on a DWORD boundary */ p = lpwAlign( p ); /* * Next, the Copyright Notice. */ lStyle = SS_CENTER | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; /* LOWORD (lExtendedStyle) */ *p++ = 0; /* HIWORD (lExtendedStyle) */ *p++ = 10; /* x */ *p++ = 30; /* y */ *p++ = 180; /* cx */ *p++ = 15; /* cy */ *p++ = 1; /* ID */ /* * Fill in class i.d. by name */ nchar = nCopyAnsiToWideChar( p, TEXT( "STATIC" ) ); p += nchar; /* * Copy the text of the item */ nchar = nCopyAnsiToWideChar( p, GOAHEAD_COPYRIGHT ); p += nchar; /* * Advance pointer over nExtraStuff WORD */ *p++ = 0; /* * Make sure the next item starts on a DWORD boundary */ p = lpwAlign( p ); /* * Add third item ("Version:") */ lStyle = SS_RIGHT | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; *p++ = 0; *p++ = 28; *p++ = 50; *p++ = 70; *p++ = 10; *p++ = 1; nchar = nCopyAnsiToWideChar( p, T( "STATIC" ) ); p += nchar; nchar = nCopyAnsiToWideChar( p, T( "Version:" ) ); p += nchar; *p++ = 0; /* * Add fourth Item (IDC_VERSION) */ p = lpwAlign( p ); lStyle = SS_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; *p++ = 0; *p++ = 102; *p++ = 50; *p++ = 70; *p++ = 10; *p++ = IDC_VERSION; nchar = nCopyAnsiToWideChar( p, T( "STATIC" ) ); p += nchar; nchar = nCopyAnsiToWideChar( p, T( "version" ) ); p += nchar; *p++ = 0; /* * Add fifth item ("Build Date:") */ p = lpwAlign( p ); lStyle = SS_RIGHT | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; *p++ = 0; *p++ = 28; *p++ = 65; *p++ = 70; *p++ = 10; *p++ = 1; nchar = nCopyAnsiToWideChar( p, T( "STATIC" ) ); p += nchar; nchar = nCopyAnsiToWideChar( p, T( "Build Date:" ) ); p += nchar; *p++ = 0; /* * Add sixth item (IDC_BUILDDATE) */ p = lpwAlign( p ); lStyle = SS_LEFT | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; *p++ = 0; *p++ = 102; *p++ = 65; *p++ = 70; *p++ = 10; *p++ = IDC_BUILDDATE; nchar = nCopyAnsiToWideChar( p, T( "STATIC" ) ); p += nchar; nchar = nCopyAnsiToWideChar( p, T( "Build Date" ) ); p += nchar; *p++ = 0; /* * Add seventh item (IDOK) */ p = lpwAlign( p ); lStyle = BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP; *p++ = LOWORD( lStyle ); *p++ = HIWORD( lStyle ); *p++ = 0; *p++ = 0; *p++ = 80; *p++ = 80; *p++ = 40; *p++ = 10; *p++ = IDOK; nchar = nCopyAnsiToWideChar( p, T( "BUTTON" ) ); p += nchar; nchar = nCopyAnsiToWideChar( p, T( "OK" ) ); p += nchar; *p++ = 0; hwndReturn = CreateDialogIndirect( hInstance, ( LPDLGTEMPLATE ) pdlgtemplate, hwnd, ( DLGPROC ) websAboutProc ); LocalFree( LocalHandle( pdlgtemplate ) ); return 0; }
HWND CreateCancelDialog(void) { HWND hwndButton,dlgHdl; WORD *p, *pdlgtemplate,baseunitX,baseunitY; int nchar; int scrnWidth,scrnHeight; int buttonX, buttonY, buttonWidth, buttonHeight; int textX, textY, textWidth, textHeight; DWORD lStyle,baseunits; HDC screen; LOGFONT lf; /* allocate some memory to play with */ pdlgtemplate = p = (PWORD) rmalloc (1000); screen = CreateDC ("DISPLAY", NULL, NULL, NULL); scrnWidth = GetDeviceCaps (screen, HORZRES); scrnHeight = GetDeviceCaps (screen, VERTRES); DeleteDC (screen); baseunits = GetDialogBaseUnits(); /* start to fill in the dlgtemplate information. addressing by WORDs */ lStyle = WS_CAPTION | DS_MODALFRAME | WS_SYSMENU; baseunitX=LOWORD(baseunits); baseunitY=HIWORD(baseunits); *p++ = LOWORD (lStyle); *p++ = HIWORD (lStyle); *p++ = 0; /* LOWORD (lExtendedStyle) */ *p++ = 0; /* HIWORD (lExtendedStyle) */ *p++ = 0; /* NumberOfItems */ *p++ = ((scrnWidth*4)/3)/baseunitX; // x *p++ = ((scrnHeight*8)/3)/baseunitY; // y *p++ = DIALOG_WIDTH; /* cx */ *p++ = DIALOG_HEIGHT; /* cy */ *p++ = 0; /* Menu */ *p++ = 0; /* Class */ /* copy the title of the dialog */ nchar = nCopyAnsiToWideChar (p, (char *) "Printing in Progress"); p += nchar; dlgHdl = CreateDialogIndirectParam (ghInst, (LPDLGTEMPLATE) pdlgtemplate, ghMainWindow, (DLGPROC) PrintDlgProc, (LPARAM) 0); rfree(pdlgtemplate); // Add a text field textWidth = 19*baseunitX; textHeight = baseunitY; textX = (((DIALOG_WIDTH*baseunitX)/4) - textWidth) / 2; textY = (((DIALOG_HEIGHT*baseunitY)/8) - textHeight) / 4; hwndText = CreateWindow ("static", "",WS_VISIBLE | WS_CHILD | SS_CENTER, textX, textY, textWidth, textHeight, dlgHdl, (HMENU) 0, ghInst, 0); // Add a Cancel button: buttonWidth = 10*baseunitX; buttonHeight = (3*baseunitY)/2; buttonX = (((DIALOG_WIDTH*baseunitX)/4) - buttonWidth) / 2; buttonY = (3 * (((DIALOG_HEIGHT*baseunitY)/8) - buttonHeight)) / 5; hwndButton = CreateWindow ("button", "Cancel", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, buttonX, buttonY, buttonWidth, buttonHeight, dlgHdl, (HMENU) 0, ghInst, 0); SetLogFontData (&lf,"MS Sans Serif",0,8); SendMessage(hwndButton,WM_SETFONT,(WPARAM)CreateFontIndirect (&lf),MAKELPARAM (TRUE,0)); SendMessage(hwndText,WM_SETFONT,(WPARAM)CreateFontIndirect (&lf),MAKELPARAM (TRUE,0)); ShowWindow (dlgHdl,SW_SHOWNORMAL); return dlgHdl; }