Advertisement
GAMELASTER

Untitled

May 16th, 2016
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
  7.  
  8. BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
  9. {
  10.     DWORD lpdwProcessId;
  11.     GetWindowThreadProcessId(hwnd, &lpdwProcessId);
  12.     if (lpdwProcessId == lParam)
  13.     {
  14.         //this is good!
  15.         return FALSE;
  16.     }
  17.     return TRUE;
  18. }
  19.  
  20. void init()
  21. {
  22.     EnumWindows(EnumWindowsProc, GetCurrentProcessId());
  23. }
  24.  
  25.  
  26. BOOL APIENTRY DllMain(
  27.     HANDLE hModule,    // Handle to DLL module
  28.     DWORD ul_reason_for_call,
  29.     LPVOID lpReserved)     // Reserved
  30. {
  31.     switch (ul_reason_for_call)
  32.     {
  33.     case DLL_PROCESS_ATTACH:
  34.         // A process is loading the DLL.
  35.         init();
  36.         break;
  37.  
  38.     case DLL_THREAD_ATTACH:
  39.         //init();
  40.         // A process is creating a new thread.
  41.         break;
  42.  
  43.     case DLL_THREAD_DETACH:
  44.         // A thread exits normally.
  45.         break;
  46.  
  47.     case DLL_PROCESS_DETACH:
  48.         // A process unloads the DLL.
  49.         break;
  50.     }
  51.     return TRUE;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement