Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
killer.cpp File Reference
#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define ERROR_DIALOG_TITLE   "Mozilla: mozilla.exe - Application Error"
#define ERROR_DIALOG_KW_1   "mozilla"
#define ERROR_DIALOG_KW_2   "Error"
#define OK_BUTTON_TITLE   "OK"

Functions

BOOL CALLBACK EnumChildProc (HWND hwnd, LPARAM out)
BOOL CALLBACK EnumWindowsProc (HWND hwnd, LPARAM lParam)
void main ()

Define Documentation

#define ERROR_DIALOG_KW_1   "mozilla"

Definition at line 57 of file killer.cpp.

#define ERROR_DIALOG_KW_2   "Error"

Definition at line 58 of file killer.cpp.

#define ERROR_DIALOG_TITLE   "Mozilla: mozilla.exe - Application Error"

Definition at line 55 of file killer.cpp.

#define OK_BUTTON_TITLE   "OK"

Definition at line 60 of file killer.cpp.


Function Documentation

BOOL CALLBACK EnumChildProc ( HWND  hwnd,
LPARAM  out 
)

Definition at line 62 of file killer.cpp.

                                                   {
       char title[1024];
       GetWindowText(hwnd, title, 1024);
       //printf("Child Window: %x -> %s\n", hwnd, title);
       if (!strcmp(title, OK_BUTTON_TITLE)) {
              *((HWND*)out) = hwnd;
              return FALSE;
       }      
       return TRUE;
}
BOOL CALLBACK EnumWindowsProc ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 73 of file killer.cpp.

                                                          {
       char title[1024];
       GetWindowText(hwnd, title, 1024);
       //printf("Window: %x -> %s\n", hwnd, title);
       if (strstr(title, ERROR_DIALOG_KW_1) && strstr(title, ERROR_DIALOG_KW_2)) {
              DWORD lp = 0, wp = 0;
              HWND ok;
              //really we can ommit this step but ...
              EnumChildWindows(hwnd, EnumChildProc, (LPARAM)(&ok));
              if (!ok) {
                     printf("OK button not found !\n");
                     return FALSE;
              }
              /*POINT p;
              p.x = 285; //experimental data -> but there are a lot of fonts in the world ...
              p.y = 150;
              HWND ok = ChildWindowFromPoint(hwnd, p);
              if (ok)
                     printf("Child window: %x\n", ok);
              else 
                     printf("Child window not found !\n");*/
              lp = (unsigned long)ok;
              wp = 1;
              wp = wp | (BN_CLICKED << 16);
              //printf("COMMAND: %d (hwnd), %d (code), %d(id)\n", lp, HIWORD(wp), LOWORD(wp));
              SendMessage(hwnd, WM_COMMAND, wp, lp);
              return FALSE;
       }
       return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void main ( void  )

Definition at line 104 of file killer.cpp.

            {
       EnumWindows(EnumWindowsProc, 0);
}

Here is the call graph for this function: