Graphics and Cosmetics | Tools and Utilities | System | Internet and Web Integration |
Animated menu and windows | System Information | Win32 Driver Model | Active Desktop shell |
Multimonitor support | Version Conflicts Checker | FAT32 | Web-based UI |
DirectX 5.0 | Registry Checker | Task Scheduler | Personal Web Server |
Digital Video Disc (DVD) | Maintenance Wizard | Enhanced Display change | Email and news reader |
HTML Help | Disk Cleanup | Universal Serial Bus (USB) | Windows Update |
Paint and Imaging | FAT32 Converter | Windows Scripting Host | NetMeeting |
Full MMX support | Dr. Watson | Infrared support | NetShow |
Figure 11 Windows 98 Demo Program
/////////////////////////////////////////////////
//
// Windows 98 demo
// AnimateWindow() and GradientFill()
//
//
#include "APPdefs.h"
// data
static HICON g_hIconLarge;
static HICON g_hIconSmall;
// functions
static VOID MPF_OnInitDialog( HWND );
static VOID MPF_OnOK( HWND );
// callbacks
LRESULT CALLBACK APP_DlgProc( HWND, UINT, WPARAM, LPARAM );
/*-----------------------------------------------------------*/
// WinMain()
/*-----------------------------------------------------------*/
INT APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevious,
LPSTR lpsz, INT iCmd )
{
BOOL b;
UINT u;
u = MessageBox( 0,
"If you're not running Windows 98 this program will fail. Continue?",
"Attention", MB_YESNO );
if( u==IDNO )
return 0;
// save global data
g_hIconLarge = LoadImage( hInstance, "APP_ICON", IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CXICON), 0 );
g_hIconSmall = LoadImage( hInstance, "APP_ICON", IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CXSMICON), 0 );
// run main dialog
b = DialogBox( hInstance, "DLG_MAIN", NULL, (DLGPROC)APP_DlgProc );
// exit
DestroyIcon( g_hIconLarge );
DestroyIcon( g_hIconSmall );
return b;
}
/*------------------------------------------------------------*/
// APP_DlgProc()
/*------------------------------------------------------------*/
LRESULT CALLBACK APP_DlgProc( HWND hDlg, UINT uiMsg,
WPARAM wParam, LPARAM lParam )
{
switch( uiMsg )
{
case WM_INITDIALOG:
MPF_OnInitDialog( hDlg );
break;
case WM_COMMAND:
switch( wParam )
{
case IDOK:
MPF_OnOK( hDlg );
break;
case IDCANCEL:
EndDialog( hDlg, FALSE );
return 0;
}
break;
}
return 0;
}
/*------------------------------------------------------------*/
// MPF_OnInitDialog()
/*------------------------------------------------------------*/
VOID MPF_OnInitDialog( HWND hDlg )
{
HINSTANCE h;
FARPROC p;
// set the icons for the dialog window
SendMessage( hDlg, WM_SETICON, FALSE, (LPARAM)g_hIconSmall );
SendMessage( hDlg, WM_SETICON, TRUE, (LPARAM)g_hIconLarge );
// animate the window
h = LoadLibrary( "user32.dll" );
p = (FARPROC) GetProcAddress( h, "AnimateWindow" );
p( hDlg, 100, AW_CENTER );
FreeLibrary( h );
// set the focus
SetFocus( hDlg );
}
/*------------------------------------------------------------*/
// MPF_OnOK()
/*------------------------------------------------------------*/
VOID MPF_OnOK( HWND hDlg )
{
HDC hdc;
TRIVERTEX vert[2];
GRADIENT_RECT gRect;
RECT rc;
HINSTANCE h;
FARPROC p;
// get the client rect and the DC
GetClientRect( hDlg, &rc );
hdc = GetDC( hDlg );
// set the parameters to have
// the lowest half of the window fading
// from white to blue.
vert [0] .x = rc.left;
vert [0] .y = (rc.bottom-rc.top)/2;
vert [0] .Red = 0xff00;
vert [0] .Green = 0xff00;
vert [0] .Blue = 0xff00;
vert [0] .Alpha = 0x0000;
vert [1] .x = rc.right-rc.left;
vert [1] .y = rc.bottom-rc.top;
vert [1] .Red = 0x0000;
vert [1] .Green = 0x0000;
vert [1] .Blue = 0xff00;
vert [1] .Alpha = 0x0000;
gRect.UpperLeft = 0;
gRect.LowerRight = 1;
// fill the area
h = LoadLibrary( "msimg32.dll" );
p = (FARPROC) GetProcAddress( h, "GradientFill" );
p( hdc, vert, 2, &gRect, 1, GRADIENT_FILL_RECT_H );
FreeLibrary( h );
// exit
ReleaseDC( hDlg, hdc );
}
/* End of file: APPmain.c */