📄 demo.cpp
字号:
//////////////////////////////////////////////////
//Demo.cpp
#include <windows.h>
#include <commdlg.h>
#include <commctrl.h>
#include <windowsx.h>
#include "resource.h"
#include "tce1.h"
#include "demo.h"
bool bHaveLoadDriver;
HANDLE hInst;
HWND hGWnd;
HINSTANCE hLib;
int PASCAL WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpszCmdParam, int nCmdShow)
{
static char szAppName[] = "Demo";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
char strSys[200];
// Unused(lpszCmdParam);
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, "IDI_DEMO");
wndclass.hCursor = LoadCursor (NULL, IDI_APPLICATION);
wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
ATOM a=RegisterClass (&wndclass);
}
GetSystemDirectory(strSys,200);
strcat(strSys,"\\comctl32.dll");
hLib = LoadLibrary(strSys);
hInst = hInstance;
hwnd = CreateDialog(hInstance, "DEMO", 0, NULL);
hGWnd=hwnd;
ShowWindow (hwnd, nCmdShow);
UpdateWindow(hwnd);
bHaveLoadDriver=yzInitSystem();
if(!bHaveLoadDriver) PostQuitMessage(0);
FARPROC lpProc;
lpProc = MakeProcInstance((FARPROC)TimerProc, hInstance);
SetTimer(hwnd,ID_TIME,100,(TIMERPROC)lpProc);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam ;
}
VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
if(idEvent!=ID_TIME) return;
yzDoTrunkWork();
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
switch (message)
{
case WM_DESTROY :
KillTimer(hwnd,ID_TIME);
if(bHaveLoadDriver) yzExitSystem();
PostQuitMessage (0) ;
return 0 ;
break;
case WM_COMMAND:
if(LOWORD(wParam)==ID_OK)
{
KillTimer(hwnd,ID_TIME);
if(bHaveLoadDriver) yzExitSystem();
PostQuitMessage(0);
}
return 0;
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam) ;
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -