Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 01:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Button in fremdes Programm injizieren.

Discussion on Button in fremdes Programm injizieren. within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
jackicola's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 129
Received Thanks: 15
Button in fremdes Programm injizieren.

Hi,
ich versuche ein Button in ein fremdes Programm zu injizieren, hier die DLL:

Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <time.h>
using namespace std;

static HWND hWnd;
static LONG p;
static int hWndI = 0;



LRESULT CALLBACK NewWndProc (HWND, UINT, WPARAM, LPARAM);

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		hWnd = FindWindowA(0, "AceDB 2.0");
		p = GetWindowLong(hWnd, GWL_WNDPROC);
		SetWindowLongA(hWnd, GWL_WNDPROC, (long)NewWndProc);

		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}

LRESULT CALLBACK NewWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND			hButton_1;
	switch(message)
	{
	case WM_COMMAND:
         if (lParam == (LPARAM)hButton_1)
		 {
		return 0;
		 }
		 else
		 {
		return CallWindowProcA((WNDPROC)p,hwnd, message,wParam, lParam);
		 }
	case WM_PAINT:
		if(hWndI == 0)
		{
		hButton_1 = CreateWindowA("Button","OBJ", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 10, 20, 100,100,hWnd,NULL,((LPCREATESTRUCT) lParam) -> hInstance,NULL);
		hWndI++;
		UpdateWindow(hWnd);
		ShowWindow(hButton_1, SW_SHOW);
		UpdateWindow(hButton_1);
		}
		return CallWindowProcA((WNDPROC)p,hwnd, message,wParam, lParam);
	}

	return CallWindowProcA((WNDPROC)p,hwnd, message,wParam, lParam);


}
Aber der Button erscheint einfach nicht......

MFG!
jackicola is offline  
Old 07/27/2011, 15:31   #2


 
buFFy!'s Avatar
 
elite*gold: 1826
Join Date: Mar 2009
Posts: 4,310
Received Thanks: 6,283
das kann auch garnicht gehen.

btw formatier mal deinen code, oder installier VAssistX
buFFy! is offline  
Thanks
1 User
Old 07/27/2011, 15:55   #3
 
jackicola's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 129
Received Thanks: 15
Und wieso kann es nicht gehen?
jackicola is offline  
Old 07/27/2011, 16:00   #4


 
buFFy!'s Avatar
 
elite*gold: 1826
Join Date: Mar 2009
Posts: 4,310
Received Thanks: 6,283
schau dir deinen code an.. das macht absolut keinen sinn
buFFy! is offline  
Thanks
1 User
Old 07/27/2011, 16:06   #5
 
jackicola's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 129
Received Thanks: 15
Ich finde es toll das du mir antwortest aber deine Antworten bringen mich nicht sehr weiter
Könnntest du mir vllt einen Tipp geben woran es liegt?
Sry ich mache sowas zum ersten mal...
jackicola is offline  
Old 07/27/2011, 16:18   #6


 
buFFy!'s Avatar
 
elite*gold: 1826
Join Date: Mar 2009
Posts: 4,310
Received Thanks: 6,283
du kannst einfach das hwnd vom gui nehmen und als parameter beim button erstellen übergeben. da musst du keinen wndproc und kein garnix hooken
buFFy! is offline  
Thanks
1 User
Old 07/27/2011, 16:46   #7
 
jackicola's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 129
Received Thanks: 15
Ich nehme doch hier
Code:
hWnd = FindWindowA(0, "AceDB 2.0");
das Handle vom Hauptfenster und nehme es hier
Code:
hButton_1 = CreateWindowA("Button","OBJ", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 10, 20, 100,100,[COLOR="Red"]hWnd[/COLOR],NULL,((LPCREATESTRUCT) lParam) -> hInstance,NULL);
wieder als Parameter.
Aber das WndProc muss ich doch hooken wenn ich selbst auf die Klicks auf die Buttons reagieren will oder?
jackicola is offline  
Old 07/27/2011, 17:05   #8


 
buFFy!'s Avatar
 
elite*gold: 1826
Join Date: Mar 2009
Posts: 4,310
Received Thanks: 6,283
warum erstellst du den button im wndproc? schau halt ob dein code überhaupt aufgerufen wird
buFFy! is offline  
Thanks
1 User
Old 07/28/2011, 12:28   #9
 
jackicola's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 129
Received Thanks: 15
Ich habe es jetzt so :

Code:
		hWnd = FindWindowA(0, "AceDB 2.0");
		p = GetWindowLong(hWnd, GWL_WNDPROC);
		h = GetWindowLong(hWnd, GWL_HINSTANCE);
		hButton = CreateWindowA("Button","OBJ", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 10, 20, 100,100,hWnd,NULL,(HINSTANCE)h,NULL);
		ShowWindow(hWnd, SW_SHOW);
		ShowWindow(hButton, SW_SHOW);
		UpdateWindow(hWnd);
		UpdateWindow(hButton);
		SetWindowLongA(hWnd, GWL_WNDPROC, (long)NewWndProc);
Der Button erscheint für ne halbe Sekunde und verschwindet wieder :/
jackicola is offline  
Old 07/28/2011, 17:25   #10


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,904
Received Thanks: 25,394
Quote:
Originally Posted by u-coRe View Post
du kannst einfach das hwnd vom gui nehmen und als parameter beim button erstellen übergeben. da musst du keinen wndproc und kein garnix hooken
Natürlich muss er hooken, wie will er sonst das Push Event abfangen?

@jack:

Dann wird vermutlich die Nachricht WM_PAINT nicht weitergeleitet, weshalb er sich nicht mehr zeichnet.
MrSm!th is offline  
Old 07/28/2011, 21:24   #11
 
jackicola's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 129
Received Thanks: 15
Daran kann es eigentlich nicht liegen, weil das neue WndProc die Nachricht an das alte WndProc weiterleitet, wenn sie nicht für mich ist:

Code:
//p:
hWnd = FindWindowA(0, "AceDB 2.0");
p = GetWindowLong(hWnd, GWL_WNDPROC);

LRESULT CALLBACK NewWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

	switch(message)
	{
	case WM_COMMAND:
         if (lParam == (LPARAM)hButton_of_the_axel)
		 {
		return 0;
		 }
		 else
		 {
		return CallWindowProcA((WNDPROC)p,hwnd, message,wParam, lParam);
		 }

	}
	

		return CallWindowProcA((WNDPROC)p,hwnd, message,wParam, lParam);

}
jackicola is offline  
Reply


Similar Threads Similar Threads
Item-Shop Lager Button Zum Normalen lager button machen? DE
01/12/2011 - Metin2 - 6 Replies
Moin, seid heute gib es ja im inventar den IS button wo man mit sein lager öffnen kann,könnte man den auch zu einem Normalen lager Button Machen?
WarRock statt KOREANISCHE BUTTON --> Englische BUTTON
02/26/2010 - WarRock - 6 Replies
Bin mir nicht sicher ob es diesen Thread schon gibt aber hab bis jetzt nichts gesehen hier. Funktionen Für WarRock Korea Koreanische Schriften (Button) weg und englische Schriften (Button) hin Anleitung
Mods in S4Client.exe "Injizieren" ?
07/04/2009 - S4 League - 2 Replies
Hi , Da viele einfach gern modden aber auch mit den gemodetten sachen spielen wollen ohne zu Hacken dachte ich es wäre gut wenn mann die Mods iwie in die exe "Injizieren" könnte ! Also so dass der Mod in der S4Client.exe "eingebaut" ! Jmd ne ahnung obs dazu ne möglichkeit gibt ? Mfg Pippo
"Fremdes" Gui ansprechen (AU3)
03/22/2009 - GW Bots - 10 Replies
Hi, mach grad einen Bot mit vielen .exe datein. Will das die Ping.exe in das GUI vom bot den ping schreibt. Hat wer eine Idee?



All times are GMT +2. The time now is 01:00.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.