📄 others.cpp
字号:
#include "stdafx.h"
#include "GLOBAL.h"
#include "resource.h"
void EnableDlgItem(HWND hDlg,int nID,bool bEnable)
{
HWND temp;
temp=GetDlgItem(hDlg,nID);
EnableWindow(temp,bEnable);
}
void ShowTip(TCHAR *Text, TCHAR *Title)
{
NOTIFYICONDATA tnd;
tnd.cbSize=sizeof(NOTIFYICONDATA);
tnd.hWnd=hMain;
tnd.uID=IDR_MAINFRAME;
//tnd.uFlags=NIF_MESSAGE | NIF_ICON |NIF_TIP | 0x10; //NIF_INFO==0x10
tnd.uFlags =0x10;
lstrcpy(tnd.szInfo,Text);
lstrcpy(tnd.szInfoTitle ,Title);
tnd.uTimeout = 10;
tnd.dwInfoFlags =0x01; //NIIF_INFO==0x01
Shell_NotifyIcon(NIM_MODIFY,&tnd);//向任务栏添加图标
}
void lout(char *Text)
{
long i;
i=GetWindowTextLength(hLCD);
if (i<20240) //最多显示20K
SendMessage(hLCD,EM_SETSEL,i,i);
else
{
/*if (IsDlgButtonChecked(hDlgAuto,IDC_LOGFILE)==BST_CHECKED)
{
if (hFile)
{
unsigned long written;
WriteFile(hFile,Text,lstrlen(Text),&written,0); //将缓冲区内的内容写入文件
}
}*/
SendMessage(hLCD,EM_SETSEL,0,i);
}
SendMessage(hLCD,EM_REPLACESEL,FALSE,(long)Text);
}
void lstrcatutf8(const char *string1,char *string2)
{
char buff[4];
buff[0]='%';
while(*string2)
{
buff[3]=*string2;
__asm{
mov al,buff[3]
and al,0F0H
shr al,4
add al,30H
cmp al,3AH
jl N1
add al,7
N1: mov buff[1],al
mov al,buff[3]
and al,0FH
add al,30H
cmp al,3AH
jl N2
add al,7
N2: mov buff[2],al
}
string2++;
buff[3]=0;
lstrcat((char*)string1,buff);
}
}
bool Locate(char *str,char *Start,char *End,int *pos,int *length)
{
char *pStart,*pEnd;
if (pos) *pos=0;
if (length) *length=0;
pStart=strstr(str,Start);
if (!pStart) return false;
pStart+=lstrlen(Start);
if (pos) *pos=pStart-str;
if (End==NULL) return true;
pEnd=strstr(pStart,End);
if (!pEnd) return false;
if (length) *length=pEnd-pStart;
return true;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage is only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_YBJJ);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_YBJJ;
wcex.lpszClassName = _T("CLASS_YBJJ");
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_YBJJ);
return RegisterClassEx(&wcex);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -