wc3edit.net

United Warcraft 3 map hacking!
It is currently August 22nd, 2019, 10:16 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: A few questions
PostPosted: December 13th, 2011, 3:52 am 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
Sorry guys, I'm probably being a massive pain in your side, but I always try google before this and search for stuff.
Anyway, I have SendMessage defined and everything, but I can't find a decent example of how to use it in a function.

Someone said to try this, but I'm not sure what to do with it, I'm hoping to use this to send messages into the console of the game im using to execute commands.

EDIT:I want to use this to be able to say commands in the game such as !place and have the utility send a message into the game such as place misc_model_breakable 0 model,map_objects/factory/f_con1,spawnflags,1

so basically, the person says !place and it sends the above command into the game.

Spoiler:
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);


Last edited by Durge on December 13th, 2011, 9:37 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: A few questions
PostPosted: December 13th, 2011, 6:45 pm 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3792
Location: JEW LAND
ammm what? As before, more explenation would be awesome.
For what I understand, you want either one of two things.

1) You want to have a message displayed to a user in some way, I do think a messagebox is the best way for you (if your making a win32 application)
2) You want to have a command given to the game as it loads, same way it does for a short-cut executer. Like WarCraft for an example. Make a shortcut to the .exe and add -windowed at the end will make the game play in window mod.

P.S: As before I assume you use C#. But seriosly, more info. I am no psychic (don't know about any one else, I'm pretty sure they are not psychic also.)


Top
 Profile  
 
 Post subject: Re: A few questions
PostPosted: December 13th, 2011, 9:49 pm 
Offline
Forum Staff

Joined: February 3rd, 2009, 11:28 pm
Posts: 2195
Location: Wisconsin
First, you're not being a pain. We all signed up for this, we're not being forced to help.
You want to send commands into an external application?
Best way to do this is the SendKeys.Send method.
Here's an example.
Code:
SendKeys.Send("Hello Durge");

This will send the keys "Hello Durge" to the application you have open and focused. It will be just like you typing the keys on the keyboard.
However if you want to send commands to WC3 you need to send new lines too (the return key)
You do this like:
Code:
SendKeys.Send("{ENTER}");

You can also do that for others like arrow keys, tab, etc.


Top
 Profile  
 
 Post subject: Re: A few questions
PostPosted: December 13th, 2011, 10:00 pm 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
Ok, that helps, but how would I make an if statement like if player typed <insert text> then send the message


Top
 Profile  
 
 Post subject: Re: A few questions
PostPosted: December 13th, 2011, 11:35 pm 
Offline
Forum Staff

Joined: February 3rd, 2009, 11:28 pm
Posts: 2195
Location: Wisconsin
Um.. I think you would have to read the memory of WC3. I'm not exactly sure how to do it myself, but I can give you the function for reading memory.
Spoiler:
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
[Out] byte[] lpBuffer,
int dwSize,
out int lpNumberOfBytesRead
);

[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
[Out, MarshalAs(UnmanagedType.AsAny)] object lpBuffer,
int dwSize,
out int lpNumberOfBytesRead
);

[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
IntPtr lpBuffer,
int dwSize,
out int lpNumberOfBytesRead
);

Try to google a tutorial for reading text from WC3. Maybe someone made one.


Top
 Profile  
 
 Post subject: Re: A few questions
PostPosted: December 14th, 2011, 12:26 am 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
Well its not for WC3, which is why I posted it in tech section, not in a wc3 section :p


Top
 Profile  
 
 Post subject: Re: A few questions
PostPosted: December 14th, 2011, 4:14 pm 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3792
Location: JEW LAND
Doesn't matter if it wc3 or not. You still require the data rad from the game.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)