Virtual Keyboard On/Off toggle for WinCE

// KeyBoard.cpp : 응용 프로그램에 대한 진입점을 정의합니다.
// Code writed by Kjwon15
// (Kjwon15's K is Capital K)

#include "stdafx.h"
#include "KeyBoard.h"

//#include <ShellAPI.h>

#define MAX_LOADSTRING 100

// 전역 변수:
HINSTANCE			g_hInst;			// 현재 인스턴스입니다.
HWND				g_hWndCommandBar;	// 명령 모음 핸들입니다.


// 이 코드 모듈에 들어 있는 함수의 정방향 선언입니다.
ATOM			MyRegisterClass(HINSTANCE, LPTSTR);
BOOL			InitInstance(HINSTANCE, int);
LRESULT CALLBACK	WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK	About(HWND, UINT, WPARAM, LPARAM);

BOOL CheckSip()
{
	HWND hWnd=NULL;
	for(int i=0;i<3&&hWnd==NULL;i++)
	{
		hWnd=FindWindow(_T("SipWndClass"),NULL);
		Sleep(150);
	}
	if(hWnd==NULL)
		return FALSE;
	
	LONG winstyle=GetWindowLong(hWnd,GWL_STYLE);
	if((winstyle&WS_VISIBLE) == WS_VISIBLE)
		return TRUE;
	else
		return FALSE;
}
void ShowSip(BOOL show)
{
	HWND hWnd=NULL;
	for(int i=0;i<3&&hWnd==NULL;i++)
	{
		hWnd=FindWindow(_T("SipWndClass"),NULL);
		Sleep(150);
	}
	if(hWnd==NULL)
		return;

	if(show==TRUE)
		ShowWindow(hWnd,SW_SHOW);
	else
		ShowWindow(hWnd,SW_HIDE);
}


int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
	ShowSip(!CheckSip());
	return 0;
}