Not sure... Havent had that problem but if your looking for more win32 functions.. http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx msdn is always a must there may be a different function to use to fix this on there..
Not sure... Havent had that problem but if your looking for more win32 functions.. http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx msdn is always a must there may be a different function to use to fix this on there..
Last edited by clint; June 27th, 2010 at 10:46 AM.
So just an update I figured out what was causing the prog to crash. It was this line of code
One strange thing though is that I can't seem to get any keystrokes to be acknowledged for that static dialog window. I tried using getasynckeystate and even switch(message) using events like WM_CLOSE WM_DESTROY, VK_ESCAPE... I don't know why it doesn't work hmm...PHP Code:
SetWindowLong(myDialog, DWL_DLGPROC, (long)myProc);
Try to use this:
http://msdn.microsoft.com/en-us/libr...65(VS.85).aspx
DialogBoxParam, make your window in Resource Editor, add the resources to project. Then this function will load this window and whats more, you can specify the function for this window that will handle all the messages that go to this window.
and modal means that it won't go off, behind any window, until user won't close it.
I updated the code and cleaned it up. I now have this. Still requires some tweaking, but I'm getting there. And thanks for all the input, I'm trying to take as much input as I can, but some of it is just a bit beyond my skill level. Anywho, here is what I currently have:
EDIT: Hmm formatting really sucks, but it may be cause I'm in notepad atm since I dont have VS on this pc. I'll update src later.PHP Code:
// shoreTel.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "shoreTel.h"
#define MAX_LOADSTRING 100
#define TOGGABLE_KEYS 10002
#define IDT_TIMER WM_USER + 200
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
BOOL staticDlg(HINSTANCE , int );
bool minimized = false;
bool maximized = true;
bool msgHide = false;
bool msgShow = false;
HWND myDialog = CreateWindowEx(0,WC_DIALOG,"Testing...", WS_VISIBLE|WS_OVERLAPPEDWINDOW, 400,100,800,600,NULL,NULL,NULL,NULL);
HWND myBox = CreateWindowEx(0, "STATIC","", SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 800, 600, myDialog, (HMENU)-1, NULL, NULL );
HWND myButton = CreateWindowEx( 0, "BUTTON", "Def Push Button", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 200, 200 + 100 , 100, 100, myDialog, (HMENU)ID_BUTTON1, NULL, NULL );
/* These functions allow to find the correct Window & Class Name */
struct result_stru
{
char* text;
UINT (__stdcall*GET)(HWND,LPSTR,UINT);
HWND hRet;
};
BOOL WINAPI StruEnumProc( HWND hwnd, result_stru* stru )
{
char loc_buf[128];
stru->GET( hwnd, loc_buf, 127 );
if( strstr( loc_buf, stru->text ) )
{
stru->hRet = hwnd;
return FALSE;
}
return TRUE;
}
//case sensitive!
HWND FindWindowTitleContains( char* text )
{
result_stru res = { text, (UINT (__stdcall *)(HWND,LPSTR,UINT))GetWindowTextA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
//case sensitive!
HWND FindWindowClassContains( char* text )
{
result_stru res = { text, RealGetWindowClassA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SHORETEL);
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SHORETEL);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_SHORETEL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
return RegisterClassEx(&wcex);
}
LRESULT WINAPI myProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_INITDIALOG:
//** Set timers
SetTimer(hwnd, TOGGABLE_KEYS, 1, NULL);
break;
case WM_TIMER:
{
HINSTANCE hInst;
int nCmdShow;
//Get the Class Name
HWND hWnd1 = FindWindowClassContains( "Afx:00400000:b:0001" );
//Get the Title Name
HWND hWnd2 = FindWindowTitleContains( "ShoreWare Agent Toolbar" );
if(hWnd1 && hWnd2)
{
//Sleep(100);
//Local Variables declared to get a Process Handle ont he Window Object
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
//Check if the process exists
if(Process)
{
// Sleep(100);
//More local variables declared. These variables will hold the read information from the memory address
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//We are checking to see whether or Shoretel is in Resume Mode & whether or not the Window is already minimized
if((int)data == 1 && minimized == true)
{
// Sleep(100);
//Assuming the above statement is true, we go ahead and check to make sure if the Window is minimized
if((ShowWindow(hWnd1, SW_MINIMIZE)))
{
// Sleep(100);
//Maximize the window
ShowWindow(hWnd1, SW_SHOWNORMAL);
maximized = true;
minimized = false;
//This is optional, but the sole purpose of this is to popup a messagebox & let the user know what's going on
if(msgShow != true)
{
// Sleep(100);
MessageBoxA(hWnd1,"Maximized now","Mnfo",MB_OK);
SetWindowPos( hWnd1, HWND_TOPMOST, 0, 0 , 0 , 0, SWP_NOMOVE | SWP_NOSIZE );
msgShow = true;
msgHide = false;
}
}
}
else if((int)data == 0 && maximized == true)
{
// Sleep(100);
if((ShowWindow(hWnd1, SW_SHOWNORMAL)))
{
// Sleep(100);
//Minimize the window
ShowWindow(hWnd1, SW_MINIMIZE);
minimized = true;
maximized = false;
//This is optional, but the sole purpose of this is to popup a messagebox & let the user know what's going on
if(msgHide != true)
{
// Sleep(100);
MessageBoxA(hWnd1,"Minimized now","Info",MB_OK);
staticDlg(hInst, nCmdShow);
ShowWindow(myDialog, SW_HIDE);
SetWindowPos( hWnd1, HWND_TOPMOST, 0, 0 , 0 , 0, SWP_NOMOVE | SWP_NOSIZE );
msgHide = true;
msgShow = false;
}
}
}
CloseHandle(Process);
}
}
}
break;
}
return 0;
}
BOOL staticDlg(HINSTANCE hInstance, int nCmdShow)
{
return ShowWindow(myDialog, SW_RESTORE);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance;
ShowWindow(myDialog, SW_HIDE);
SetWindowLong(myDialog, DWL_DLGPROC, (long)myProc);
SetClassLong(myBox ,GCL_STYLE,CS_HREDRAW | CS_VREDRAW);
//load from file first
HBITMAP bitmap = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap);
if (!myDialog)
{
return FALSE;
}
UpdateWindow(myDialog);
SetTimer(myDialog, 1, 1, NULL);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_INITDIALOG:
//** Set timers
SetTimer(hWnd, TOGGABLE_KEYS, 1, NULL);
break;
case WM_KEYDOWN:
{
switch (wParam)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
}
break;
}
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
Update
Problem I'm having though is the background isn't changing on the fly like I would like it to, and the button isn't responding under WM_COMMAND. Any ideas?PHP Code:
// shoreTel.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "shoreTel.h"
#define MAX_LOADSTRING 100
#define TOGGABLE_KEYS 10002
#define IDT_TIMER WM_USER + 200
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
//Needed for the FindWindowClassContains() & FindWindowTitleContains() Functions
struct result_stru
{
char* text;
UINT (__stdcall*GET)(HWND,LPSTR,UINT);
HWND hRet;
};
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
BOOL staticDlg(HINSTANCE , int );
BOOL WINAPI StruEnumProc( HWND , result_stru* );
HWND FindWindowTitleContains( char* );
HWND FindWindowClassContains( char* );
bool minimized = false;
bool maximized = true;
bool msgHide = false;
bool msgShow = false;
//This renders the vidual content
HWND myDialog = CreateWindowEx(0,WC_DIALOG,"Testing...", WS_VISIBLE|WS_OVERLAPPEDWINDOW, 400,100,800,600,NULL,NULL,NULL,NULL);
HWND myBox = CreateWindowEx(0, "STATIC","", SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 800, 600, myDialog, (HMENU)-1, NULL, NULL );
HWND myButton = CreateWindowEx( 0, "BUTTON", "Def Push Button", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 200, 200 + 100 , 100, 100, myDialog, (HMENU)-1, NULL, NULL );
HWND static_label = CreateWindow("Static", "Please Enter A Number",WS_CHILD | WS_VISIBLE,40,15,200,25,myDialog,(HMENU)-1,NULL,NULL);
//Get the Class Name
HWND hWnd1 = FindWindowClassContains( "Afx:00400000:b:0001" );
//Get the Title Name
HWND hWnd2 = FindWindowTitleContains( "ShoreWare Agent Toolbar" );
/* These functions allow to find the correct Window & Class Name */
BOOL WINAPI StruEnumProc( HWND hwnd, result_stru* stru )
{
char loc_buf[128];
stru->GET( hwnd, loc_buf, 127 );
if( strstr( loc_buf, stru->text ) )
{
stru->hRet = hwnd;
return FALSE;
}
return TRUE;
}
//case sensitive!
HWND FindWindowTitleContains( char* text )
{
result_stru res = { text, (UINT (__stdcall *)(HWND,LPSTR,UINT))GetWindowTextA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
//case sensitive!
HWND FindWindowClassContains( char* text )
{
result_stru res = { text, RealGetWindowClassA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// ShowWindow(myDialog, SW_HIDE);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SHORETEL);
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SHORETEL);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_SHORETEL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
return RegisterClassEx(&wcex);
}
LRESULT WINAPI myProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_INITDIALOG:
//** Set timers
SetTimer(hwnd, TOGGABLE_KEYS, 1, NULL);
break;
case WM_PAINT:
{
hdc = BeginPaint(myDialog, &ps);
// TODO: Add any drawing code here...
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//load from file first
if((hWnd1 && hWnd2) && ((int)data == 0))
{
HBITMAP bitmap = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap);
}
else if((hWnd1 && hWnd2) && ((int)data == 1))
{
HBITMAP bitmap2 = (HBITMAP)LoadImage(NULL,"bitmap2.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap2);
}
EndPaint(myDialog, &ps);
}
break;
case WM_COMMAND: //Command from Child windows and menus are under this message
{
switch(wParam) //the ID is is wParam
{
case ID_BUTTON1: //check for our button ID
{
// Static labels dont do messages
//we can set the text directly though
SetWindowText(static_label,"You clicked the button");
break;
}
}
}
break;
case WM_TIMER:
if(hWnd1 && hWnd2)
{
HINSTANCE hInst;
int nCmdShow;
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//Check if the process exists
if(Process)
{
// Sleep(100);
//More local variables declared. These variables will hold the read information from the memory address
//We are checking to see whether or Shoretel is in Resume Mode & whether or not the Window is already minimized
if((int)data == 1 && minimized == true)
{
// Sleep(100);
//Assuming the above statement is true, we go ahead and check to make sure if the Window is minimized
if((ShowWindow(hWnd1, SW_MINIMIZE)))
{
// Sleep(100);
//Maximize the window
ShowWindow(hWnd1, SW_SHOWNORMAL);
maximized = true;
minimized = false;
//This is optional, but the sole purpose of this is to popup a messagebox & let the user know what's going on
if(msgShow != true)
{
// Sleep(100);
MessageBoxA(hWnd1,"Maximized now","Mnfo",MB_OK);
staticDlg(hInst, nCmdShow);
ShowWindow(myDialog, SW_RESTORE);
SetWindowPos( hWnd1, HWND_TOPMOST, 0, 0 , 0 , 0, SWP_NOMOVE | SWP_NOSIZE );
msgShow = true;
msgHide = false;
}
}
}
else if((int)data == 0 && maximized == true)
{
// Sleep(100);
if((ShowWindow(hWnd1, SW_SHOWNORMAL)))
{
// Sleep(100);
//Minimize the window
ShowWindow(hWnd1, SW_MINIMIZE);
minimized = true;
maximized = false;
//This is optional, but the sole purpose of this is to popup a messagebox & let the user know what's going on
if(msgHide != true)
{
// Sleep(100);
MessageBoxA(hWnd1,"Minimized now","Info",MB_OK);
staticDlg(hInst, nCmdShow);
ShowWindow(myDialog, SW_RESTORE);
SetWindowPos( hWnd1, HWND_TOPMOST, 0, 0 , 0 , 0, SWP_NOMOVE | SWP_NOSIZE );
msgHide = true;
msgShow = false;
}
}
}
CloseHandle(Process);
}
}
break;
}
return 0;
}
BOOL staticDlg(HINSTANCE hInstance, int nCmdShow)
{
ShowWindow(myDialog, SW_SHOW);
return TRUE;
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance;
SetWindowLong(myDialog, DWL_DLGPROC, (long)myProc);
SetClassLong(myBox ,GCL_STYLE,CS_HREDRAW | CS_VREDRAW);
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//load from file first
if((hWnd1 && hWnd2) && ((int)data == 0))
{
HBITMAP bitmap = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap);
}
else if((hWnd1 && hWnd2) && ((int)data == 1))
{
HBITMAP bitmap2 = (HBITMAP)LoadImage(NULL,"bitmap2.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap2);
}
if (!myDialog)
{
return FALSE;
}
UpdateWindow(myDialog);
SetTimer(myDialog, 1, 1, NULL);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(myDialog, &ps);
// TODO: Add any drawing code here...
EndPaint(myDialog, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
why are you even doing setwindowlong?
if you assign the correct function in the registerclass, you dont have to subclass your own window -_-
and in the WndProc you do it correct with button id's, but with myProc not.
to get the button id you should check LOWORD(wParam) instead of just wParam.
Disregard the button question, I'm a moron.
Fixed the issues, but now it doesn't compile. I'm sure it's some stupid syntax mistake like a semicolon or something. Does anyone else see anything, cause I can't seem to trace it.
EDIT:PHP Code:
// shoreTel.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "shoreTel.h"
#define MAX_LOADSTRING 100
#define TOGGABLE_KEYS 10002
#define IDT_TIMER WM_USER + 200
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
//Needed for the FindWindowClassContains() & FindWindowTitleContains() Functions
struct result_stru
{
char* text;
UINT (__stdcall*GET)(HWND,LPSTR,UINT);
HWND hRet;
};
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
BOOL staticDlg(HINSTANCE , int );
BOOL WINAPI StruEnumProc( HWND , result_stru* );
HWND FindWindowTitleContains( char* );
HWND FindWindowClassContains( char* );
bool minimized = false;
bool maximized = true;
bool msgHide = false;
bool msgShow = false;
//This renders the vidual content
HWND myDialog = CreateWindowEx(0,WC_DIALOG,"Testing...", WS_VISIBLE|WS_OVERLAPPEDWINDOW, 400,100,800,600,NULL,NULL,NULL,NULL);
HWND myBox = CreateWindowEx(0, "STATIC","", SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 800, 600, myDialog, (HMENU)-1, NULL, NULL );
HWND myButton = CreateWindowEx( 0, "BUTTON", "Def Push Button", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 200, 200 + 100 , 100, 100, myDialog, (HMENU)ID_BUTTON1, NULL, NULL );
HWND static_label = CreateWindowEx(0, "Static", "Please Enter A Number", WS_CHILD | WS_VISIBLE, 40, 15, 200, 25, myDialog,(HMENU)-1, NULL, NULL );
//Get the Class Name
HWND hWnd1 = FindWindowClassContains( "Afx:00400000:b:0001" );
//Get the Title Name
HWND hWnd2 = FindWindowTitleContains( "ShoreWare Agent Toolbar" );
/* These functions allow to find the correct Window & Class Name */
BOOL WINAPI StruEnumProc( HWND hwnd, result_stru* stru )
{
char loc_buf[128];
stru->GET( hwnd, loc_buf, 127 );
if( strstr( loc_buf, stru->text ) )
{
stru->hRet = hwnd;
return FALSE;
}
return TRUE;
}
//case sensitive!
HWND FindWindowTitleContains( char* text )
{
result_stru res = { text, (UINT (__stdcall *)(HWND,LPSTR,UINT))GetWindowTextA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
//case sensitive!
HWND FindWindowClassContains( char* text )
{
result_stru res = { text, RealGetWindowClassA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// ShowWindow(myDialog, SW_HIDE);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SHORETEL);
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SHORETEL);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_SHORETEL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
return RegisterClassEx(&wcex);
}
LRESULT WINAPI myProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId;
int wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_INITDIALOG:
//** Set timers
SetTimer(hwnd, TOGGABLE_KEYS, 1, NULL);
break;
case WM_PAINT:
{
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
hdc = BeginPaint(myDialog, &ps);
GetWindowThreadProcessId( hWnd1, &ProcessID );
Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
if((hWnd1 && hWnd2) && ((int)data == 0))
{
HBITMAP bitmap = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap);
}
else if((hWnd1 && hWnd2) && ((int)data == 1))
{
HBITMAP bitmap2 = (HBITMAP)LoadImage(NULL,"bitmap2.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap2);
}
EndPaint(myDialog, &ps);
}
break;
case WM_COMMAND:
{
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(myDialog);
break;
case ID_BUTTON1:
ShowWindow(myDialog,SW_HIDE);
break;
default:
return DefWindowProc(myDialog, message, wParam, lParam);
}
break;
case WM_TIMER:
if(hWnd1 && hWnd2)
{
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
HINSTANCE hInst;
int nCmdShow;
GetWindowThreadProcessId( hWnd1, &ProcessID );
Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//Check if the process exists
if(Process)
{
// Sleep(100);
//More local variables declared. These variables will hold the read information from the memory address
//We are checking to see whether or Shoretel is in Resume Mode & whether or not the Window is already minimized
if((int)data == 1 && minimized == true)
{
// Sleep(100);
//Assuming the above statement is true, we go ahead and check to make sure if the Window is minimized
if((ShowWindow(hWnd1, SW_MINIMIZE)))
{
// Sleep(100);
//Maximize the window
ShowWindow(hWnd1, SW_SHOWNORMAL);
maximized = true;
minimized = false;
//This is optional, but the sole purpose of this is to popup a messagebox & let the user know what's going on
if(msgShow != true)
{
// Sleep(100);
staticDlg(hInst, nCmdShow);
msgShow = true;
msgHide = false;
}
}
}
else if((int)data == 0 && maximized == true)
{
// Sleep(100);
if((ShowWindow(hWnd1, SW_SHOWNORMAL)))
{
// Sleep(100);
//Minimize the window
ShowWindow(hWnd1, SW_MINIMIZE);
minimized = true;
maximized = false;
//This is optional, but the sole purpose of this is to popup a messagebox & let the user know what's going on
if(msgHide != true)
{
// Sleep(100);
staticDlg(hInst, nCmdShow);
msgHide = true;
msgShow = false;
}
}
}
CloseHandle(Process);
}
}
break;
}
return 0;
}
BOOL staticDlg(HINSTANCE hInstance, int nCmdShow)
{
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//load from file first
if((hWnd1 && hWnd2) && ((int)data == 0))
{
HBITMAP bitmap = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap);
}
else if((hWnd1 && hWnd2) && ((int)data == 1))
{
HBITMAP bitmap2 = (HBITMAP)LoadImage(NULL,"bitmap2.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap2);
}
ShowWindow(myButton, SW_SHOW);
ShowWindow(myDialog, SW_SHOW);
SetWindowPos( myDialog, HWND_TOPMOST, 0, 0 , 0 , 0, SWP_NOMOVE | SWP_NOSIZE );
SetWindowPos( myButton, HWND_TOPMOST, 0, 0 , 0 , 0, SWP_NOMOVE | SWP_NOSIZE );
return TRUE;
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance;
SetWindowLong(myDialog, DWL_DLGPROC, (long)myProc);
SetClassLong(myBox ,GCL_STYLE,CS_HREDRAW | CS_VREDRAW);
DWORD ProcessID;
GetWindowThreadProcessId( hWnd1, &ProcessID );
HANDLE Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
BYTE data;
DWORD datasize = sizeof(data);
//Read the data from memory
ReadProcessMemory(Process,(void *)0x005556FC, &data, datasize, 0);
//load from file first
if((hWnd1 && hWnd2) && ((int)data == 0))
{
HBITMAP bitmap = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap);
}
else if((hWnd1 && hWnd2) && ((int)data == 1))
{
HBITMAP bitmap2 = (HBITMAP)LoadImage(NULL,"bitmap2.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
//put bitmap on static control
SendMessage(myBox,STM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM)bitmap2);
}
if (!myDialog)
{
return FALSE;
}
UpdateWindow(myDialog);
SetTimer(myDialog, 1, 1, NULL);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId;
int wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(myDialog, &ps);
// TODO: Add any drawing code here...
EndPaint(myDialog, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
I'm missing something here.. I don't understand.if you assign the correct function in the registerclass, you dont have to subclass your own window -_-
Are you referring to:
EDIT2:Code:wcex.lpfnWndProc = (WNDPROC)myProc;
Found the missing quote in WM_COMMAND teehee. Thank god for php tags on these forums haha.
Everything seems to be working now. Thanks for everyones' help, and yes I have to appologise for all the retarded mistakes I made, because this stuff does not come easy for me heh. If only everything was built on a MOH engine haha.
>>Are you referring to:
exactly.
ofc you shouldnt forget to return DefWindowProc, incase you do not handle the message.
Do not load bitmaps every time a paint event is raised, but only once when initializing.
and 99% of the stuff you are doing is well documented on msdn, maybe it's time to take a look there?
Alright reviving a old thread sorry. Figured better that than starting a new one :P.
So as I'm sure you know the code above is messy as hell. I rewrote it and now am trying some trial & error code. The code below works & compiles fine, but sometimes it lags out or doesn't print out a messagebox according to the readprocessmemory values. I know for a fact it's binary so it will always return 0 or 1 so it should return a messagebox everytime, but it doesn't.
Once I get it working the way it needs to, I can replace the messagebox with the actual code to popup a red\green screen like the code above.
Here is the code:
PHP Code:
#include <windows.h>
#include <stdio.h>
#include <string>
#include <tlhelp32.h>
#include "Resource.h"
#define process "ShoreWareAgent.exe"
#define windowName "ShoreWare Agent"
#define className "Afx:"
NOTIFYICONDATA iconData;
/*
HBITMAP bitmap1 = (HBITMAP)LoadImage(NULL,"bitmap1.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
HBITMAP bitmap2 = (HBITMAP)LoadImage(NULL,"bitmap2.bmp", IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
bool minimized = false;
bool maximized = true;
bool msgHide = false;
bool msgShow = false;
/*
HWND myDialog = CreateWindowEx(0,WC_DIALOG,"", WS_VISIBLE|WS_OVERLAPPEDWINDOW, 0,0,800,600,NULL,NULL,NULL,NULL);
HWND myBox = CreateWindowEx(0, "STATIC","", SS_CENTERIMAGE | SS_REALSIZEIMAGE | SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 800, 600, myDialog, (HMENU)-1, NULL, NULL );
HWND myButton;
HWND myLabel;
*/
//Needed for the FindWindowClassContains() & FindWindowTitleContains() Functions
struct result_stru
{
char* text;
UINT (__stdcall*GET)(HWND,LPSTR,UINT);
HWND hRet;
};
/* These functions allow to find the correct Window & Class Name */
BOOL WINAPI StruEnumProc( HWND hwnd, result_stru* stru )
{
char loc_buf[128];
stru->GET( hwnd, loc_buf, 127 );
if( strstr( loc_buf, stru->text ) )
{
stru->hRet = hwnd;
return FALSE;
}
return TRUE;
}
//case sensitive!
HWND FindWindowTitleContains( char* text )
{
result_stru res = { text, (UINT (__stdcall *)(HWND,LPSTR,UINT))GetWindowTextA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
//case sensitive!
HWND FindWindowClassContains( char* text )
{
result_stru res = { text, RealGetWindowClassA, 0 };
EnumWindows( (WNDENUMPROC)StruEnumProc, (LPARAM)&res );
return res.hRet;
}
//Get the Class Name
HWND hWnd1 = FindWindowClassContains( className );
//Get the Title Name
HWND hWnd2 = FindWindowTitleContains( windowName );
int DialogProc( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam )
{
return 0;
}
void InitIcon( HINSTANCE hInstance )
{
memset( &iconData, 0, sizeof( NOTIFYICONDATA ) );
iconData.cbSize = sizeof( NOTIFYICONDATA );
iconData.uID = 1338;
iconData.uFlags = (NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO);
iconData.hIcon = (HICON) LoadImage( hInstance, MAKEINTRESOURCE( IDI_ICON1 ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), LR_DEFAULTCOLOR );
iconData.hWnd = CreateDialog( hInstance, MAKEINTRESOURCE( IDD_DIALOG1 ), NULL, (DLGPROC) DialogProc );
iconData.uCallbackMessage = 1338;
strcpy_s( iconData.szTip, sizeof( iconData.szTip ), "Shoretel Notify" );
Shell_NotifyIcon( NIM_ADD, &iconData );
}
void RemoveIcon()
{
Shell_NotifyIcon( NIM_DELETE, &iconData );
}
void SetIconMessage( char* pszMessage, char* pszCaption, unsigned long dwTimeout = 3000, unsigned long dwInfoFlags = NIIF_INFO )
{
strcpy_s( iconData.szInfo, sizeof( iconData.szInfo ), pszMessage );
strcpy_s( iconData.szInfoTitle, sizeof( iconData.szInfoTitle ), pszCaption );
iconData.uTimeout = dwTimeout;
iconData.dwInfoFlags = dwInfoFlags;
Shell_NotifyIcon( NIM_MODIFY, &iconData );
Sleep( dwTimeout );
}
bool CompareData( const unsigned char* pbData, const unsigned char* pbMask, const char* pszString )
{
for ( ; *pszString; ++pszString, ++pbData, ++pbMask )
{
if ( *pszString == 'x' && *pbData != *pbMask )
return FALSE;
}
return (*pszString) == NULL;
}
unsigned long FindPattern( HANDLE hProcess, unsigned long dwAddress, unsigned long dwLength, unsigned char* pbMask, char* pszString )
{
unsigned long dwResult = NULL;
unsigned char* pbBuffer = (unsigned char*) malloc( dwLength );
if ( pbBuffer )
{
if ( ReadProcessMemory( hProcess, (void*) dwAddress, pbBuffer, dwLength, NULL ) )
{
for ( unsigned long i = 0; i < dwLength; i++ )
{
if ( CompareData( (BYTE*) (pbBuffer + i), pbMask, pszString ) )
{
dwResult = (unsigned long)(dwAddress + i);
break;
}
}
}
free( pbBuffer );
pbBuffer = NULL;
}
return dwResult;
}
unsigned long GetProcessId( char* pszProcessName )
{
unsigned long dwResult = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot ( TH32CS_SNAPPROCESS, 0 );
if ( hSnapshot )
{
PROCESSENTRY32 processEntry = { sizeof( PROCESSENTRY32 ) };
if ( Process32First( hSnapshot, &processEntry ) )
{
do
{
if ( strcmp( processEntry.szExeFile, pszProcessName ) == 0 )
{
dwResult = processEntry.th32ProcessID;
break;
}
}
while ( Process32Next( hSnapshot, &processEntry ) );
}
if ( hSnapshot )
{
CloseHandle( hSnapshot );
hSnapshot = NULL;
}
}
return dwResult;
}
unsigned long GetModuleBase( unsigned long dwPID, char* pszModuleName, unsigned long* pdwSize )
{
unsigned long dwResult = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
if ( hSnapshot )
{
MODULEENTRY32 moduleEntry = { sizeof( MODULEENTRY32 ) };
if ( Module32First( hSnapshot, &moduleEntry ) )
{
do
{
if ( strcmp( moduleEntry.szModule, pszModuleName ) == 0 )
{
dwResult = (unsigned long) moduleEntry.modBaseAddr;
if ( pdwSize )
*pdwSize = moduleEntry.modBaseSize;
break;
}
}
while ( Module32Next( hSnapshot, &moduleEntry ) );
}
if ( hSnapshot )
{
CloseHandle( hSnapshot );
hSnapshot = NULL;
}
}
return dwResult;
}
void running()
{
char szBuffer [512];
unsigned long dwOffset1 = 0;
unsigned long dwOffset2 = 0;
unsigned long dwSize = 0;
unsigned long dwPID1 = GetProcessId( process );
unsigned long dwBase1 = GetModuleBase( dwPID1, process, &dwSize );
HANDLE hProcess1 = OpenProcess( PROCESS_VM_READ, false, dwPID1 );
ReadProcessMemory( hProcess1, (void*)(dwBase1 + 0x182630), &dwOffset1, sizeof( dwOffset1 ), NULL );
ReadProcessMemory( hProcess1, (void*)(dwBase1 + 0x182622), &dwOffset2, sizeof( dwOffset2 ), NULL );
ReadProcessMemory( hProcess1, (void*)(dwBase1 + 0x182630), &dwOffset1, sizeof( dwOffset1 ), NULL );
ReadProcessMemory( hProcess1, (void*)(dwBase1 + 0x182622), &dwOffset2, sizeof( dwOffset2 ), NULL );
if(hWnd1 && hWnd2)
{
if(((int)dwOffset2 == 1) && ((int)dwOffset1 == (int)0))
{
Sleep(100);
MessageBox(0, "Green and Green", "Information", MB_OK);
running();
}
else if(((int)dwOffset2 == 1) && ((int)dwOffset1 == (int)1))
{
Sleep(100);
MessageBox(0, "Green and Red", "Information", MB_OK);
running();
}
else if(((int)dwOffset2 == 0) && ((int)dwOffset1 == (int)0))
{
Sleep(100);
MessageBox(0, "Red and Green", "Information", MB_OK);
running();
}
else if(((int)dwOffset2 == 0) && ((int)dwOffset1 == (int)1))
{
Sleep(100);
MessageBox(0, "Red and Red", "Information", MB_OK);
running();
}
}
}
int __stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, char* pszCmdLine, int iCmdShow )
{
char szBuffer [512], szResult [512];
memset( szBuffer, 0, sizeof( szBuffer ) );
memset( szResult, 0, sizeof( szResult ) );
InitIcon( hInstance );
unsigned long dwPID = GetProcessId( process );
if ( dwPID )
{
unsigned long dwSize = 0;
unsigned long dwBase = GetModuleBase( dwPID, process, &dwSize );
//if ( dwBase )
if(hWnd1 || hWnd2)
{
sprintf_s( szBuffer, sizeof( szBuffer ), "Base Address: 0x%X\n", dwBase );
strcat_s( szResult, sizeof( szResult ), szBuffer );
HANDLE hProcess = OpenProcess( PROCESS_VM_READ, false, dwPID );
if ( hProcess )
{
unsigned long dwResult = FindPattern( hProcess, dwBase, dwSize, (unsigned char*) "\x68\x00\x00\x00\x00\x6a\x00\x8d\x4d\xe4\xff\x15\x00\x00\x00\x00\x50", "x????xxxxxxx????x" );
if ( dwResult )
{
unsigned long dwOffset = NULL;
if ( ReadProcessMemory( hProcess, (void*) (dwResult + 1), &dwOffset, sizeof( dwOffset ), NULL ) )
{
sprintf_s( szBuffer, sizeof( szBuffer ), "Signature Result: 0x%X \n Offset: 0x%X\n", dwResult, dwOffset );
strcat_s( szResult, sizeof( szResult ), szBuffer );
int iResult = 0;
if ( ReadProcessMemory( hProcess, (void*) (dwOffset + 0x64), &iResult, sizeof( iResult ), NULL ) )
{
sprintf_s( szBuffer, sizeof( szBuffer ), "Value: %i\n", iResult );
strcat_s( szResult, sizeof( szResult ), szBuffer );
}
else
{
strcat_s( szResult, sizeof( szResult ), "Failed to read value from offset!" );
}
}
else
{
strcat_s( szResult, sizeof( szResult ), "Failed to read offset from signature!" );
}
}
else
{
strcat_s( szResult, sizeof( szResult ), "Failed to find memory signature!" );
}
CloseHandle( hProcess );
}
else
{
strcat_s( szResult, sizeof( szResult ), "Failed to open process from pid!" );
}
}
else
{
strcat_s( szResult, sizeof( szResult ), "Failed to get base address!" );
}
}
else
{
strcat_s( szResult, sizeof( szResult ), "Failed to find Process!" );
}
while ( strlen( szResult ) )
{
//SetIconMessage( szResult, "Shoretel Notify" );
running();
}
RemoveIcon();
return TRUE;
}