How to find events and simulate them

01/19/2017 16:26 nepafter37#1
Guys i want to learn how programs comminication each other for make bots.
Here is an example for calculator;
Code:
#include <windows.h>
#include <iostream>
using namespace std;
int main(){
	
	HWND hwndCalc;
 
 
hwndCalc = FindWindow(NULL, "Calculator");
 
if(!hwndCalc)
 
    return 1;
 
SendMessage(hwndCalc, WM_COMMAND, MAKEWPARAM(0x84, BN_CLICKED), 0);
 
	return 0;
 
}
the point is SendMessage function.Calculator's buttons works in this way.With ollydbg i can find it which i did.But debugging is full of issues.I couldn't debug any normal program with ollydbg.Because it is crashing or accessing violation or exceptions bla bla.

So i'm wondering is there any other way to find how do programs communicate?
01/21/2017 17:41 warfley#2
Every GUI control in Windows is a so called window. These windows are identified via a handle, given by the OS. You can find out the handle through the name (or the text) using the FindWindow(Ex) function. You can find the names with Microsofts [Only registered and activated users can see links. Click Here To Register...] software. Those windows can receive messages from the operating System. For example when you click on a window the operating system sends a mousedown and mouseup message. You can send these messages virtually by calling SendMessage or PostMessage.

Quote:
So i'm wondering is there any other way to find how do programs communicate?
What do you mean by that? Programs usually communicate via Pipes, Message Queues (don't confuse them with with the GUI messages send via SendMessage) or Shared Memory. The communication via SendMessage is just the way GUI controls work, Messages are queued for events, and the program checks the queue regularly and checks if any events appeared and the program needs to react. Also these Messages are used to communicate with the Controls (Managed by the operating system). For example to set the Text of a Button you send a SetText message. You can find more information about these message on [Only registered and activated users can see links. Click Here To Register...]
01/21/2017 18:06 florian0#3
Also, many programs are partially exception-driven. This may lead to various stops/breaks while debugging. If you're not actually looking for a bug in the application, you can make the debugger ignore all the exceptions (All common debuggers have options for this).

Also keep in mind that OllyDBG 1.10 does not run on x64 properly. The Plugin "ScyllaHide" supplies a x64-fix.