Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include <fstream>
- using namespace std;
- BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
- BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
- {
- DWORD lpdwProcessId;
- GetWindowThreadProcessId(hwnd, &lpdwProcessId);
- if (lpdwProcessId == lParam)
- {
- //this is good!
- return FALSE;
- }
- return TRUE;
- }
- void init()
- {
- EnumWindows(EnumWindowsProc, GetCurrentProcessId());
- }
- BOOL APIENTRY DllMain(
- HANDLE hModule, // Handle to DLL module
- DWORD ul_reason_for_call,
- LPVOID lpReserved) // Reserved
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- // A process is loading the DLL.
- init();
- break;
- case DLL_THREAD_ATTACH:
- //init();
- // A process is creating a new thread.
- break;
- case DLL_THREAD_DETACH:
- // A thread exits normally.
- break;
- case DLL_PROCESS_DETACH:
- // A process unloads the DLL.
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement