10 Şubat 2019 Pazar
SetStretchBltMode metodu
GetClientRect metodu
Örnek
Şöyle yaparız
Şöyle yaparız
RECT windowsize; // get the height and width of the screen
GetClientRect(hwnd, &windowsize);
3 Şubat 2019 Pazar
CreateCompatibleDC metodu
Giriş
Açıklaması şöyle
Elimizde şöyle bir kod olsun.
Açıklaması şöyle
you can use a dedicated compatible DC for something like background bitmap manipulation and later using it as a blt-src to dump to window or client dcÖrnek
Elimizde şöyle bir kod olsun.
HDC hDC = ...
Şöyle yaparız.HDC hdcMem = CreateCompatibleDC(hDC);
// everything
DeleteDC(hdcMem)
31 Ocak 2019 Perşembe
14 Ocak 2019 Pazartesi
CreateToolhelp32Snapshot metodu
Giriş
Process'leri dolaşabilmeyi sağlar.
1. CreateToolhelp32Snapshot() ile handle açılır
2. Process32First() ile okuma yapılır
3. Process32Next() ile döngü içinde okuma yapılır
Örnek
Şöyle yaparız.
Şöyle yaparız
Process'leri dolaşabilmeyi sağlar.
1. CreateToolhelp32Snapshot() ile handle açılır
2. Process32First() ile okuma yapılır
3. Process32Next() ile döngü içinde okuma yapılır
Örnek
Şöyle yaparız.
DWORD get_process_id_by_process_name(const char* process_name_){
PROCESSENTRY32 process_entry = { sizeof(PROCESSENTRY32) };
HANDLE processes_snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
// loop through all process to find one that matches the process_name_
if (Process32First(processes_snapshot, &process_entry)){
do{
if (strcmp(process_entry.szExeFile, process_name_) == 0){
CloseHandle(processes_snapshot);
return process_entry.th32ProcessID;
}
} while (Process32Next(processes_snapshot, &process_entry));
}
CloseHandle(processes_snapshot);
return NULL;
}
Örnek
Şöyle yaparız
HANDLE hSnapshot;
PROCESSENTRY32 hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
proc32.dwSize = sizeof(PROCESSENTRY32);
if(Process32First(hSnapshot, &proc32))
{
cout << proc32.szExeFile << endl;
while(Process32Next(hSnapshot, &proc32))
cout << proc32.szExeFile << endl;
}
28 Aralık 2018 Cuma
FindWindow metodu
Örnek
Şöyle yaparız.
Şöyle yaparız.
Şöyle yaparız.
HWND hwnd = FindWindowA(NULL, "C:\\Example\\App.exe");
ÖrnekŞöyle yaparız.
DWORD get_process_id_by_window_title(const char* window_title_){
// get a handle to window using the window name
HWND window_handle = FindWindow(NULL, window_title_);
if (window_handle == NULL){
return NULL;
}
// return the process id of the window handle we found
DWORD process_id;
GetWindowThreadProcessId(window_handle, &process_id);
return process_id;
}
Kaydol:
Kayıtlar (Atom)