Code: var
Pai,txtbox,console:HWND;
s:array[0..63] of Char;
begin
Pai:=FindWindow(nil,'Call of Duty: Modern Warfare 3 Multiplayer');
txtbox:=FindWindowEx(Pai,0,'Edit',nil);
console:=FindWindowEx(Pai,txtbox,'Edit',nil);
SendMessage(console,WM_GETTEXT,63,Integer(@s));
Edit1.Text:=StrPas(s);
what did I do wrong?
Delphi 7, whats wrong with using delphi?
I asked, send pm, not responded.
11-30-2012, 01:48
(This post was last modified: 11-30-2012, 01:49 by barata.)
(11-30-2012, 01:41)richard1994x Wrote: I asked, send pm, not responded.
Just wait, he will respond asap.
Thanks Barata...
Don't worry if things aren't the way you planned, in the end everything will solve itself...
I used a pointer to get the console window. I think I shared the code several times here.
http://www.itsmods.com/forum/Thread-Help...3#pid85743
You need the pointer though, I got it from @ Nukem , not sure how he got it, perhaps I could get it myself but no idea.
I think barata's tool gives it. Not sure.
11-30-2012, 11:02
(This post was last modified: 11-30-2012, 11:10 by master131.)
You probably don't have to rely on the parent HWND pointer in order to read the console. What you posted should work (I am not farmilar with Delphi, but the parameters seem OK). Instead of relying on the window title, try using the window class name.
Code: Pai:=FindWindow('IW5 WinConsole', nil);
EDIT - Just tested it in C# externally without using that pointer, worked fine.
A casual conversation between barata and I about Nukem.
Just a few pages back and you get an exactly same thread
CSHARP Code
unsafe string MW3Console { get { IntPtr form = FindWindow("IW5 WinConsole", "Call of Duty: Modern Warfare 3 Dedicated Server"); IntPtr txtbox = FindWindowEx(form,IntPtr.Zero,"Edit",null); IntPtr console = FindWindowEx(form, txtbox, "Edit", null); StringBuilder sb = new StringBuilder (9999999); int result = SendMessageTimeout( console, 0x0D /*WM_GETTEXT*/, 9999999, sb, 10 /*SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG*/, 500, IntPtr.Zero); return sb.ToString(); } } [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)] public static extern IntPtr FindWindow(string className, string windowName); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); [DllImport("User32.dll", SetLastError = true)] public static extern int SendMessageTimeout( IntPtr hWnd, uint uMsg, uint wParam, StringBuilder lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult);
Should work for all versions
12-01-2012, 17:34
(This post was last modified: 12-01-2012, 17:36 by richard1994x.)
Guys, i found the error, i need create a program "RCON Advanced" for facilitate manipulation the administration for ADMIN's.
This code above is work for iw5mp_server.exe, i need code for iw5mp.exe, i try this code but not work, the game is protected with function FindWindowEx?
Code: var
Pai,txtbox,console:HWND;
s:array[0..63] of Char;
begin
Pai:=FindWindow('IW5','Call of Duty: Modern Warfare 3 Multiplayer');
txtbox:=FindWindowEx(Pai,0,'Edit',nil);
console:=FindWindowEx(Pai,txtbox,'Edit',nil);
SendMessage(console,WM_GETTEXT,63,Integer(@s));
Edit1.Text:=StrPas(s);
i need help, i don't speak english, so sorry with for any inconvenience.
Thanks in advance.
Richard Alexander.
|