📄 123.cpp
字号:
#include<windows.h>//引入必要的头文件
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
//代码写在这里
if(FindWindow("TForm1","传奇世界客户端")!=0)
{
MessageBox(NULL,TEXT("传奇世界已经运行"),"对话框窗口的标题",MB_OK);
}
else
{
MessageBox(NULL,TEXT("传奇世界没有运行"),"对话框窗口的标题",MB_OK);
}
return 0;
}
/*
现在开始写程序
Windows程序一般都是由WinMain函数做为程序入口 就像C语言里的main一样
看看WinMain的原型吧 如下
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
);
FindWindow()是一个API函数 看一下原型 如下
HWND FindWindow(
LPCTSTR lpClassName, // 窗口类名
LPCTSTR lpWindowName // 窗口标题
);
MessageBox也是一个API函数
int MessageBox(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -