Click here to Skip to main content
15,896,408 members
Articles / Mobile Apps / Windows Mobile

Enable floating SIP control in IPAQ/Windows CE .NET

Rate me:
Please Sign up or sign in to vote.
3.60/5 (5 votes)
10 Dec 2002CPOL2 min read 120.6K   176   23  
Enable floating SIP control in iPAQ/Windows CE .NET devices.
//***********************************************************
//	         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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Australia Australia
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.

Comments and Discussions