当前位置: 首页 > news >正文

黔东南州两学一做教育网站房天下网站建设

黔东南州两学一做教育网站,房天下网站建设,长春财经学院学费多少,北京市住房及城乡建设部网站效果#xff1a; 是不是有那味儿了#xff1f; 显示AWSD#xff0c;空格#xff0c;Shift和左右键的按键情况以及左右键的CPS。 彩虹色轮廓#xff0c;黑白填充。具有任务栏图标#xff0c;可以随时关闭字体是Minecraft AE Pixel#xff0c;如果你没有装#xff08;大…效果 是不是有那味儿了 显示AWSD空格Shift和左右键的按键情况以及左右键的CPS。 彩虹色轮廓黑白填充。具有任务栏图标可以随时关闭字体是Minecraft AE Pixel如果你没有装大概率你可以换用其他好看的字体在代码中修改即可 由于是从一个更大的项目中提取的代码所以可能会有一些不美观之处。 必要的gcc编译参数-lgdi32 代码如下 /**************************************** Keystrokes.cpp ** 游戏按键显示 ** Author: Wormwaker ** StartDate: 2024/1/14 ****************************************/ #include Windows.h #include tlhelp32.h #include iostream #include sstream #include string #include cmath #include cstdarg using namespace std; #define KEY_DOWN(vk) (GetAsyncKeyState(vk)0x8000?1:0)int scr_w 0, scr_h 0, taskbar_h 0; HDC hdcOrigin NULL, hdcBuffer NULL; HWND hwnd NULL; HWND hwnd_console NULL;HINSTANCE _hInstance NULL; HINSTANCE _hPrevInstance NULL; LPSTR _lpCmdLine NULL; int _nShowCmd SW_SHOWNORMAL;/ #define CJZAPI __stdcall template typename _T string CJZAPI str(const _T value) {stringstream ss;ss value;string res;ss res;return res; } string CJZAPI sprintf2(const char* szFormat, ...) {va_list _list;va_start(_list, szFormat);char szBuffer[1024] \0;_vsnprintf(szBuffer, 1024, szFormat, _list);va_end(_list);return string{szBuffer}; } bool CJZAPI ExistProcess(DWORD dwPid) //判断是否存在指定进程 {HANDLE hSnapshot CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (INVALID_HANDLE_VALUE hSnapshot) { return false; } PROCESSENTRY32 pe { sizeof(pe) }; BOOL fOk; for (fOk Process32First(hSnapshot, pe); fOk; fOk Process32Next(hSnapshot, pe)) { if (pe.th32ProcessID dwPid) { CloseHandle(hSnapshot); return true; } } return false; } bool CJZAPI ExistProcess(LPCSTR lpName) //判断是否存在指定进程 { //******警告区分大小写******// //*****警告必须加扩展名*****// HANDLE hSnapshot CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (INVALID_HANDLE_VALUE hSnapshot) { return false; } PROCESSENTRY32 pe { sizeof(pe) }; BOOL fOk; for (fOk Process32First(hSnapshot, pe); fOk; fOk Process32Next(hSnapshot, pe)) { if (! stricmp(pe.szExeFile, lpName)) { CloseHandle(hSnapshot); return true; } } return false; } inline int GetScreenHeight(void) //获取屏幕高度 {return GetSystemMetrics(SM_CYSCREEN); } inline int GetScreenWidth(void) //获取屏幕宽度 {return GetSystemMetrics(SM_CXSCREEN); } RECT CJZAPI GetSystemWorkAreaRect(void) //获取工作区矩形 {RECT rt;SystemParametersInfo(SPI_GETWORKAREA,0,rt,0); // 获得工作区大小return rt; } LONG CJZAPI GetTaskbarHeight(void) //获取任务栏高度 { INT cyScreen GetScreenHeight();RECT rt GetSystemWorkAreaRect();return (cyScreen - (rt.bottom - rt.top)); } inline HWND GetTaskbarWindow(void) {return WindowFromPoint(POINT{ GetScreenWidth() / 2,GetScreenHeight() - 2 }); } inline HFONT CJZAPI CreateFont(int height, int width, LPCSTR lpFamilyName) {return CreateFont(height,width,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,lpFamilyName); } // 辅助函数HSV到RGB颜色转换 COLORREF HSVtoRGB(double h, double s, double v) {int hi static_castint(floor(h / 60.0)) % 6;double f h / 60.0 - floor(h / 60.0);double p v * (1.0 - s);double q v * (1.0 - f * s);double t v * (1.0 - (1.0 - f) * s);switch (hi) {case 0: return RGB(static_castint(v * 255), static_castint(t * 255), static_castint(p * 255));case 1: return RGB(static_castint(q * 255), static_castint(v * 255), static_castint(p * 255));case 2: return RGB(static_castint(p * 255), static_castint(v * 255), static_castint(t * 255));case 3: return RGB(static_castint(p * 255), static_castint(q * 255), static_castint(v * 255));case 4: return RGB(static_castint(t * 255), static_castint(p * 255), static_castint(v * 255));case 5: return RGB(static_castint(v * 255), static_castint(p * 255), static_castint(q * 255));default: return RGB(0, 0, 0); // Shouldnt reach here} } // 主函数返回随时间变化的彩虹色 COLORREF RainbowColor() {// 假设时间按秒计算这里使用系统时间或其他适当的时间源double timeInSeconds GetTickCount() / 1000.0;// 色相按时间变化double hue fmod(timeInSeconds * 30.0, 360.0); // 假设每秒变化30度// 饱和度和亮度保持不变double saturation 1.0;double value 1.0;// 将HSV颜色转换为RGB并返回return HSVtoRGB(hue, saturation, value); }inline void CJZAPI SetTextColor(COLORREF color) {SetTextColor(hdcBuffer, color); } inline void CJZAPI TextOut(int x, int y, LPCSTR lpText, HDC hdc hdcBuffer) {TextOut(hdc, x, y, lpText, strlen(lpText)); } inline void CJZAPI TextOutShadow(int x, int y, LPCSTR lpText, HDC hdc hdcBuffer) {COLORREF oclr GetTextColor(hdc);SetTextColor(RGB(0,0,0));TextOut(x2,y2,lpText,hdc);SetTextColor(oclr);TextOut(x,y,lpText,hdc); } void ClearDevice(HDC _hdc hdcBuffer, HWND _hwnd hwnd) {// 清屏使用透明色填充整个客户区域RECT rcClient;GetClientRect(_hwnd, rcClient);HBRUSH hBrush CreateSolidBrush(RGB(0, 0, 0));FillRect(_hdc, rcClient, hBrush);DeleteObject(hBrush); } / int left_cps 0; int right_cps 0; #define CPS_UPDATE_CD 1000 void UpdateCPS(void) {static DWORD startTime GetTickCount();static int leftClicks 0, rightClicks 0;static bool leftButtonDown false, rightButtonDown false;bool leftButtonPressed KEY_DOWN(VK_LBUTTON);if (leftButtonPressed !leftButtonDown) leftClicks;leftButtonDown leftButtonPressed;bool rightButtonPressed KEY_DOWN(VK_RBUTTON);if (rightButtonPressed !rightButtonDown)rightClicks;rightButtonDown rightButtonPressed;DWORD currentTime GetTickCount();DWORD elapsedTime currentTime - startTime;if (elapsedTime CPS_UPDATE_CD) {left_cps leftClicks * (1000.0 / CPS_UPDATE_CD);right_cps rightClicks* (1000.0 / CPS_UPDATE_CD);startTime currentTime;leftClicks 0;rightClicks 0;} } inline const int GetCPS(bool left0_right1) {return left0_right1 ? right_cps : left_cps; } void DrawKeyBox(BYTE key, const char* name, int fs, int left, int top, int right, int bottom) {static const char* font Minecraft AE Pixel;COLORREF color;if(KEY_DOWN(key))color RGB(200, 200, 200) | (200 24);elsecolor RGB(1, 1, 1) | (80 24);HBRUSH hBrush CreateSolidBrush(color);auto prevObj SelectObject(hdcBuffer, hBrush);Rectangle(hdcBuffer, left (KEY_DOWN(key)?2:0), top (KEY_DOWN(key)?2:0), right (KEY_DOWN(key)?2:0), bottom (KEY_DOWN(key)?2:0));SelectObject(hdcBuffer, prevObj);DeleteObject(hBrush);HFONT hFont CreateFont(fs, 0, font);prevObj SelectObject(hdcBuffer, hFont);SetTextColor(RainbowColor());SetBkMode(hdcBuffer, TRANSPARENT);string text{name};int x left (KEY_DOWN(key)?2:0) (right - left) / 2.0f - text.length() * fs / 4.0f;int y top (KEY_DOWN(key)?2:0) (bottom - top) / 2.0f - fs / 2.0f;TextOutShadow(x, y, text.c_str());DeleteObject(hFont);SelectObject(hdcBuffer, prevObj); } void DrawMouseKeys(int left, int top) {static const int box_w 85;static const int box_h 45;static const int box_gap 15;static const int fs 15;static const int small_fs 10;static const char* font Minecraft AE Pixel;COLORREF color;if(KEY_DOWN(VK_LBUTTON))color RGB(200, 200, 200) | (200 24);elsecolor RGB(1, 1, 1) | (80 24);HBRUSH hBrush CreateSolidBrush(color);auto prevObj SelectObject(hdcBuffer, hBrush);Rectangle(hdcBuffer, left (KEY_DOWN(VK_LBUTTON)?2:0), top (KEY_DOWN(VK_LBUTTON)?2:0), left (KEY_DOWN(VK_LBUTTON)?2:0) box_w, top box_h (KEY_DOWN(VK_LBUTTON)?2:0));SelectObject(hdcBuffer, prevObj);DeleteObject(hBrush);if(KEY_DOWN(VK_RBUTTON))color RGB(200, 200, 200) | (200 24);elsecolor RGB(1, 1, 1) | (80 24);hBrush CreateSolidBrush(color);prevObj SelectObject(hdcBuffer, hBrush);Rectangle(hdcBuffer, left (KEY_DOWN(VK_RBUTTON)?2:0) box_w box_gap, top (KEY_DOWN(VK_RBUTTON)?2:0), left (KEY_DOWN(VK_RBUTTON)?2:0) box_w*2 box_gap, top box_h (KEY_DOWN(VK_RBUTTON)?2:0));SelectObject(hdcBuffer, prevObj);DeleteObject(hBrush);HFONT hFont CreateFont(small_fs, 0, font);prevObj SelectObject(hdcBuffer, hFont);SetTextColor(RainbowColor());SetBkMode(hdcBuffer, TRANSPARENT);string text sprintf2(%d CPS, GetCPS(0));int x left (KEY_DOWN(VK_LBUTTON)?2:0) box_w / 2.0f - text.length() * small_fs / 4.0f - 3;int y top (KEY_DOWN(VK_LBUTTON)?2:0) box_h * 0.75f - small_fs / 2.0f;TextOutShadow(x, y, text.c_str());text sprintf2(%d CPS, GetCPS(1));x box_gap (KEY_DOWN(VK_RBUTTON)?2:0) box_w left box_w / 2.0f - text.length() * small_fs / 4.0f - 3;y top (KEY_DOWN(VK_RBUTTON)?2:0) box_h * 0.75f - small_fs / 2.0f;TextOutShadow(x, y, text.c_str());DeleteObject(hFont);SelectObject(hdcBuffer, prevObj);hFont CreateFont(fs, 0, font);prevObj SelectObject(hdcBuffer, hFont);SetTextColor(RainbowColor());SetBkMode(hdcBuffer, TRANSPARENT);text LMB;x left (KEY_DOWN(VK_LBUTTON)?2:0) box_w / 2.0f - text.length() * fs / 4.0f - 4;y top (KEY_DOWN(VK_LBUTTON)?2:0) box_h * 0.22f;TextOutShadow(x, y, text.c_str());text RMB;x box_gap (KEY_DOWN(VK_RBUTTON)?2:0) box_w left box_w / 2.0f - text.length() * fs / 4.0f - 4;y top (KEY_DOWN(VK_RBUTTON)?2:0) box_h * 0.22f;TextOutShadow(x, y, text.c_str());DeleteObject(hFont);SelectObject(hdcBuffer, prevObj); } void DrawKeyMouseInfo() {static const int _left 15;static const int _top 40;static const int _pen_size 2;static const int box_w 54;static const int box_h 54;static const int box_gap 10;static const int fs 24;COLORREF color RainbowColor();HPEN hPen;hPen CreatePen(PS_SOLID, _pen_size, color);SelectObject(hdcBuffer, hPen);DrawKeyBox(A, A, fs, _left, _top box_h box_gap, _left box_w, _top box_h box_gap box_h);DrawKeyBox(W, W, fs, _left box_w box_gap, _top, _left box_w*2 box_gap, _top box_h);DrawKeyBox(S, S, fs, _left box_w box_gap, _top box_h box_gap, _left box_w*2 box_gap, _top box_h box_gap box_h);DrawKeyBox(D, D, fs, _left box_w * 2 box_gap * 2, _top box_h box_gap, _left box_w*3 box_gap * 2, _top box_h box_gap box_h);static const int space_h 35;DrawKeyBox( , --, fs, _left, _top box_h*2 box_gap*2, _left box_w * 3 box_gap * 2, _top box_h*2box_gap*2space_h);DrawKeyBox(VK_SHIFT, Shift, fs * 0.75, _left, _top box_h*2 box_gap*3 space_h, _left box_w * 3 box_gap * 2, _top box_h*2box_gap*3space_h*2);DrawMouseKeys(_left, _top box_h*3 box_gap*3 space_h*2);DeleteObject(hPen); }void DrawUI() {DrawKeyMouseInfo(); }#define TIMER_PAINT_CD 10L #define TIMER_UPDATE_CD 5L VOID CALLBACK TimerProc_Paint(_In_ HWND hwnd,_In_ UINT uMsg,_In_ UINT_PTR idEvent,_In_ DWORD dwTime) {RECT rect;GetClientRect(hwnd,rect);InvalidateRect(hwnd, rect, FALSE); //会发送WM_PAINT消息 } VOID CALLBACK TimerProc_Update(_In_ HWND hwnd,_In_ UINT uMsg,_In_ UINT_PTR idEvent,_In_ DWORD dwTime) {UpdateCPS(); } PAINTSTRUCT ps; void BeginDraw() {hdcOrigin BeginPaint(hwnd, ps);SetBkMode(hdcBuffer, TRANSPARENT); } void EndDraw() {EndPaint(hwnd, ps); } LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {static HBITMAP hBitmap NULL;switch(Message) {case WM_CREATE:{hdcBuffer CreateCompatibleDC(NULL);SetTimer(hwnd, 0, TIMER_PAINT_CD, TimerProc_Paint);SetTimer(hwnd, 2, TIMER_UPDATE_CD, TimerProc_Update);break;}case WM_DESTROY: {if (hdcBuffer)DeleteDC(hdcBuffer), hdcBuffer nullptr;if (hBitmap)DeleteObject(hBitmap), hBitmap nullptr;KillTimer(hwnd, 0);KillTimer(hwnd, 2);PostQuitMessage(0);break;}case WM_PAINT:{BeginDraw();// 获取客户区域的大小RECT rcClient;GetClientRect(hwnd, rcClient);int clientWidth rcClient.right - rcClient.left;int clientHeight rcClient.bottom - rcClient.top;// 创建双缓冲if (hBitmap)DeleteObject(hBitmap);hBitmap CreateCompatibleBitmap(hdcOrigin, clientWidth, clientHeight);SelectObject(hdcBuffer, hBitmap);ClearDevice();DrawUI();// 将缓冲区的内容一次性绘制到屏幕上BitBlt(hdcOrigin, 0, 0, clientWidth, clientHeight, hdcBuffer, 0, 0, SRCCOPY);EndDraw();break;}default:return DefWindowProc(hwnd, Message, wParam, lParam);}return 0; } / bool TerminalCheck(DWORD dwPid, HWND _hwnd) { //检查是否为win11新终端HANDLE hSnapshot CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (INVALID_HANDLE_VALUE hSnapshot) { return false; } PROCESSENTRY32 pe { sizeof(pe) }; BOOL fOk; for (fOk Process32First(hSnapshot, pe); fOk; fOk Process32Next(hSnapshot, pe)) { if (! stricmp(pe.szExeFile, WindowsTerminal.exe) pe.th32ProcessID dwPid) { CloseHandle(hSnapshot); {char title[MAX_PATH];GetWindowText(_hwnd, title, MAX_PATH);if(strcmp(title, _pgmptr) strcmp(title, Keystrokes))return false;return true;} } } return false; } BOOL CALLBACK EnumWindowsProc(HWND _hwnd, LPARAM lParam) {DWORD pid;GetWindowThreadProcessId(_hwnd, pid);if(TerminalCheck(pid, _hwnd)){hwnd_console _hwnd;return FALSE;}return TRUE; } int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {_hInstance hInstance;_hPrevInstance hPrevInstance;_lpCmdLine lpCmdLine;_nShowCmd nShowCmd;scr_w GetScreenWidth();scr_h GetScreenHeight();taskbar_h GetTaskbarHeight();WNDCLASS wc { 0 };wc.lpfnWndProc WndProc;wc.hInstance hInstance;wc.lpszClassName KeyStrokesWindowClass;if(!RegisterClass(wc)) {MessageBox(NULL, Window Registration Failed!,Error!,MB_ICONEXCLAMATION|MB_OK);return 0;}hwnd CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOPMOST, KeyStrokesWindowClass, KeyStrokes by Wormwaker, WS_POPUP,0, /* x */0, /* y */scr_w, /* width */scr_h, /* height */NULL,// NULL,NULL,hInstance,NULL);if(hwnd NULL) {MessageBox(NULL, Window Creation Failed!,Error!,MB_ICONEXCLAMATION|MB_OK);return 0;}SetConsoleTitle(Keystrokes);if(ExistProcess(WindowsTerminal.exe)){ //win11电脑且使用新版终端EnumWindows(EnumWindowsProc, 0);}else{ //旧版控制台主机hwnd_console GetConsoleWindow();} #ifndef SHOWCONSOLEif(hwnd_console ! INVALID_HANDLE_VALUE hwnd_console ! nullptr)ShowWindow(hwnd_console, SW_HIDE); #endif// 设置窗口透明度SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), 0, LWA_COLORKEY);ShowWindow(hwnd, SW_SHOWMAXIMIZED);SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, scr_w,scr_h, SWP_NOSIZE);MSG msg;while(GetMessage(msg, NULL, 0, 0) 0) { /* If no error is received... */TranslateMessage(msg); /* Translate key codes to chars if present */DispatchMessage(msg); /* Send it to WndProc */ShowWindowAsync(hwnd, SW_SHOWMAXIMIZED); //保持显示并最大化}return 0; }
http://www.hkea.cn/news/14399517/

相关文章:

  • 饮食类网站本机做wordpress乱码
  • 网站实现隶书繁体搜索引擎网站大全
  • 音乐类网站建设选题背景导航网站开发工具
  • asp技校网站网上挣钱
  • 网站模板免费推荐涿州网站建设涿州
  • 商务网站内容维护和管理的范围wordpress建手机站
  • 东莞网络推广平符合seo的网站
  • 太原网站备案现场核验模板网站也需要服务器吗
  • dedecms网站地图模板怎么网站建设案例价格
  • 网站红色搭配wordpress 获取某个栏目名称
  • 小米的网站是哪个公司做的关于网页制作
  • 如何做网站专题四面山网站建设
  • 如何做电商网站首页湖南网站搜索排名优化电话
  • 网站后台管理系统内容wordpress去
  • 办公类网站开发背景湖南省郴州市宜章县
  • 做空闲时间的网站网站建设的现状分析
  • 西安网站建设sxyunp2p网站建设的步骤过程
  • 做拍卖网站wordpress搜索调用
  • 网站开发是什么部门搜索引擎优化的目的是什么
  • 数码公司网站建设调查微信生活门户网站源码
  • 深圳做网站 汉狮网络黑龙江省华龙建设有限公司网站
  • 起飞页自助建站平台的特点网站以前在百度能搜索不到
  • 老师用什么网站做ppt获取网站访客qq
  • .net 购物网站开发源代码外国s网站建设
  • 武进网站建设公司深圳网站建设怎样快速
  • 济阳网站建设企业网站设计与管理
  • 做的网站在不同浏览器保险网站哪个好
  • 网站规划模板谷歌做公司网站需要多少钱
  • 网站开发设计图psd怎样做读书会网站
  • 网站优化外包价格广州番禺人才网官网