|
//***********************************************************
// SIP Style Control Sample Application //
// //
// Author : C. Chris //
// http://www.PassportONE.com //
// Email: chris@PassportONE.com //
// � Sept 2002 //
// //
//***********************************************************
#include "SipStyle.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// PURPOSE:
// Main application message dispatch routing.
// Check for previous instance.
// PARAMETERS:
// - HINSTANCE
// - hPreviousInstance
// - pCmdLine
// - nCmdShow
// OPERATION:
// - Dispatch the received windows message
// RETURN VALUE:
// 0/1
MSG msg;
// Backup the application instance value
hInst = hInstance;
// Create the main dialouge
hWndMain = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DlgProc);
if (!hWndMain)
{
// Ensure the dialouge is created
MessageBox(NULL, TEXT("Could not create dialogue."), TEXT("Error"), MB_OK);
// Set the return value
return FALSE;
}
else
// Display the dialouge
ShowWindow(hWndMain, SW_SHOW);
// Main message loop:
while (GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
// PURPOSE:
// - Main dialouge CALLBACK procedure.
// PARAMETERS:
// - HWND
// - message
// - wParam
// - lParam
// OPERATION:
// - Any dialouge related function/application functioncalling.
// RETURN VALUE:
// 0/1
switch (message)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
DestroyWindow(hWnd);
break;
case IDC_BUTTON1:
// Hide the SIP control title-bar
SaveDWORD(HKEY_CURRENT_USER, TEXT("ControlPanel\\Sip"), TEXT("DragStyle"), 1);
// Soft reset the device
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
break;
case IDC_BUTTON2:
// Show the SIP control title-bar
SaveDWORD(HKEY_CURRENT_USER, TEXT("ControlPanel\\Sip"), TEXT("DragStyle"), 0);
// Soft reset the device
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
break;
case IDC_BUTTON3:
// Show the SIP control
SipShowIM(SIPF_ON);
break;
case IDC_BUTTON4:
// Hide the SIP control
SipShowIM(SIPF_OFF);
break;
}
break;
case WM_CLOSE:
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Passion to be a software architect and solution researcher in enterprise solutions by simplify and unify the existing complex manual paper works into an automated environment friendly, comprehensive and dynamic workflow process system.