Sasami's Ragnarok World Forums
Register | Login | Logout | Edit profile | Avatars
Views: 410016
Main | Memberlist | Member pages | Online users
Ranks | Chat | New Chat | FAQ | Search | Photo album
11-24-24 09:58 PM
Sasami's Ragnarok World Forums (LOCKED) - Programming/reverse engineering discussion - Plz help Sesami! |
Pages: 1 2Next newer thread | Next older thread
User
Post
Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7570 days
Last activity: 7570 days
Posted on 05-10-02 01:18 PMQuote | Edit | Delete
the sub hdc to display the graphics? When i was working with ragnarok, it was the one with the name "Ragnarok"
i used findwindowtext and gethdc and it gave me the right one...
EgoFelix









Since: 05-08-02

Since last post: 8172 days
Last activity: 8172 days
Posted on 05-10-02 02:06 PMQuote | Edit | Delete
I changed the hole code to this now:

Hook Dll:______________
library hook;

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DIrectMemory;

var
Hookhandle: Cardinal = 0;
HookTarget: HWND;
I: Integer = 0;

function HookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM):
LRESULT; stdcall;
var
Msg: Cardinal;
MyHand: HWND;
MyDc: HDC;
MyCanvas: TCanvas;
begin
Msg := TMsg(Pointer(lParam)^).message; //find message
if Msg = WM_PAINT then begin
//Draw Test Text
MyHand := TMsg(Pointer(lParam)^).hwnd;
MyDc := GetWindowDC(MyHand);
MyCanvas := TCanvas.Create;
MyCanvas.Handle := MyDC;
BeginPath(MyCanvas.Handle);
MyCanvas.Font.Color := clRed;
MyCanvas.Font.Name := 'Courier New';
MyCanvas.Font.Size := 60;
SetBkMode(MyCanvas.Handle, TRANSPARENT);
EndPath(MyCanvas.Handle);
MyCanvas.TextOut(0, 0, 'my test text');
MyCanvas.Free;
end;
Result := CallNextHookEx(HookHandle, nCode, wParam, lParam); //Next Hook
end;

function InstallHook(HandleName: HWND): Boolean; stdcall;
begin
Result := False;
HookTarget := HandleName;
if HookHandle = 0 then begin
HookHandle := SetWindowsHookEx(WH_GETMESSAGE, @HookProc, HInstance, GetWindowThreadProcessId(HookTarget)); //install specified hook
Result := TRUE;
end;
end;

function UninstallHook: Boolean; stdcall;
begin
Result := UnhookWindowsHookEx(HookHandle); //Delete Hook
HookHandle := 0;
end;

exports
InstallHook,
UninstallHook;

end.

HookHandle := SetWindowsHookEx(WH_GETMESSAGE, @HookProc, HInstance, GetWindowThreadProcessId(HookTarget)); //install specified hook

Code From Main Application:______________

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DirectMemory;


type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

//Implant the dll...
function InstallHook(HandleName: HWND): Boolean; stdcall; external 'hook.dll';
function UninstallHook: Boolean; stdcall; external 'hook.dll';

{$R *.DFM}

//install hook
procedure TForm1.Button1Click(Sender: TObject);
begin
if installhook(FindwindowByTitle(PCHAR('Ragnarok'))) then begin
Button2.Enabled:=True;
Button1.Enabled:=False;
end;
end;

//deinstall hook
procedure TForm1.Button2Click(Sender: TObject);
begin
if uninstallhook then begin
Button1.Enabled:=True;
Button2.Enabled:=False;
end;
end;

end.


Comment:______________
This Installs the hook just for the RO HWND... But the problem is, that the directX is painted in a sub-hdc... How can i find that? All would work, but i cant find that HDC Plz help

Sasami

Goddess in Training








Since: 02-18-02
From: Back in texas! YAY! college sucked!
Rating: 10 (1030 pts)

Since last post: 7570 days
Last activity: 7570 days
Posted on 05-11-02 11:00 PMQuote | Edit | Delete
I spent quite a long time searching for the answer to that when I had the same problem, and never found it.
Pages: 1 2Next newer thread | Next older thread
Sasami's Ragnarok World Forums (LOCKED) - Programming/reverse engineering discussion - Plz help Sesami! |
Edit/move/close/delete thread


Sasami's Ragnarok World

AcmlmBoard v1.7
© 2000-2001 Acmlm

Page rendered in 0.011 seconds.