⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startdlg.cpp

📁 基于WinCE5.0操作系统
💻 CPP
字号:
// startDlg.cpp : implementation file
//

#include "stdafx.h"
#include "start.h"
#include "startDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStartDlg dialog
HANDLE handle;
CStartDlg::CStartDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStartDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStartDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CStartDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStartDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CStartDlg, CDialog)
	//{{AFX_MSG_MAP(CStartDlg)
	ON_WM_LBUTTONDBLCLK()
	ON_WM_LBUTTONDOWN()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStartDlg message handlers

BOOL CStartDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen

	// TODO: Add extra initialization here
	int iFullWidth = GetSystemMetrics(SM_CXSCREEN); 
    int iFullHeight = GetSystemMetrics(SM_CYSCREEN); 
    ::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 0, 0, iFullWidth, iFullHeight, SWP_NOOWNERZORDER|SWP_SHOWWINDOW); 

    ::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);



	DWORD  dwThreadId;
	m_hClickEvent = CreateEvent(NULL,false,false,NULL);
    handle = CreateThread(NULL,0,ThreadProc,NULL,0,&dwThreadId);

	stringa=TEXT("如果需要校正触摸屏");
    stringb=TEXT("请在3秒中内点击触摸屏");
	stringc=TEXT("否则将自动进入WinCE系统");

    CPaintDC dc(this); 
	dc.DrawText(stringa,CRect(0,100,iFullWidth,120),DT_CENTER);
    dc.DrawText(stringb,CRect(0,125,iFullWidth,145),DT_CENTER);
    dc.DrawText(stringc,CRect(0,150,iFullWidth,170),DT_CENTER);
    //hTaskBar =::FindWindow(TEXT("HHTaskBar"), NULL); //搜寻任务栏句柄 
    //::ShowWindow(hTaskBar,SW_HIDE); //隐藏
	return TRUE;  // return TRUE  unless you set the focus to a control
}


//void CStartDlg::OnDestroy() 
//{
	//CDialog::OnDestroy();
	//关闭线程同步事件对象
    //CloseHandle(m_hClickEvent);	
//}

DWORD  CStartDlg::ThreadProc(PVOID pArg)
{
	CStartDlg * pDlg;
	PROCESS_INFORMATION m_htouchcalibrate={0};
	pDlg = (CStartDlg*)AfxGetMainWnd();
	if (WaitForSingleObject(pDlg->m_hClickEvent,3000) == WAIT_OBJECT_0)
	{
      /*
	  if (CreateProcess(_T("\\Windows\\touchcalibrate.exe"), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &m_htouchcalibrate))
	  {
        CloseHandle(m_htouchcalibrate.hThread);
        CloseHandle(m_htouchcalibrate.hProcess);
	  }
	  */
      HINSTANCE hinstance=LoadLibrary(_T("coredll.dll")); 
      if(hinstance==NULL) 
      { 
        AfxMessageBox(L"instance == NULL"); 
          return 0; 
      } 
      _TouchCalibrate TouchCalibrate = NULL; 
      TouchCalibrate=(_TouchCalibrate)GetProcAddress(hinstance , L"TouchCalibrate"); 
      if (TouchCalibrate==NULL) 
      { 
        AfxMessageBox (L"TouchCalibrate == NULL"); 
        return 0; 
      } 
      TouchCalibrate (); 
      FreeLibrary(hinstance );
	}
	
	ExitProcess(0);
	return 0;
}
void CStartDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
    SetEvent(m_hClickEvent);
	//::ShowWindow(hTaskBar, SW_SHOWNORMAL);
	CDialog::OnLButtonDown(nFlags, point);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -