HackingSomeInformation
[toc]
c++ 使用PID获取顶级窗口句柄和标题1234567891011121314151617181920212223242526#include <iostream>#include <Windows.h> using namespace std; int main(){ EnumWindows([](HWND hwnd, LPARAM lParam) { DWORD pid = 0; GetWindowThreadProcessId(hwnd, &pid); if (pid == GetCurrentProcessId()) // 判断pid { char text[1024]; GetWindowTextA(hwnd, (LPSTR)text, 1024); // 必须含有标题文字 if (strlen(text) != 0 && IsWindowVisible(hwnd)) { // printf("%s\n", text); targe ...
c/c++中用结构体作为参数传递给函数
[toc]
c语言中结构体的使用1定义结构体1234567struct Process{ wchar_t* name; int pid; int ppid; wchar_t* path;}_Process;
2使用结构体12345678910111213141516#include <stdio.h>struct Process{ wchar_t* name; int pid; int ppid; wchar_t* path;};int main(int argv, char* argc[]){ struct Process Info = {0}; Info.name = L"cmd.exe"; wprintf(L"name is %s\n", Info.name); return 0;}
3定义结构体的同时赋值123456789101112131415#include <s ...
