HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

FindWindow finds WE

11-03-2006, 04:40 AM#1
Wyvernoid
I'm programming with VB, and for Win32 API I'm just learning the ropes; I now am engaging some problems when trying to find the WE Trigger Editor JASS textbox using FindWindow, I don't know the title, the handle, so I never found it. Then I tried to find the JassCraft textbox, still I failed. I don't know where to post something like this, so I just posted it here - can you guys help me? Thank you all!

(Hmm... I remind that you told me to be specific) Here's some code, in VB.
Code:
Private Sub btnInsert_Click()
    Dim strInsert As String, lngHandle As Long
    ' TODO: Get in strInsert the string ready to be inserted (DONE)
    strInsert = ...
    ' TODO: Find the textbox using FindWindow()
    ' TODO: Insert the text (I don't know how to do this too, maybe use SetWindowText()?)
End Sub

For VC programmers: in case you don't know the VB code format (which silly me uses), a variable of type long is to bear the HWND. Or if you are not at all familiar with VB, just write VC code, I can, maybe a little, read them (^^)
Thank you again!
11-03-2006, 09:06 PM#2
PitzerMike
Search for a thread named 'hacking WE' or something like that.
I have posted VB code that uses FindWindow to get the main WE window.
You should be able to adapt it to what you want.
11-04-2006, 03:58 AM#3
Wyvernoid
Oh, thank you PitzerMike, I've checked it and am still curious about something written in the class module:
1. What does FindWindow(vbNullString,vbNullString) do? You used it at first, and then looked for every window using GetWindow() (if I comprehended it rightly ^^)... So I should not use FindWindow to find a window, but use GetWindow to check each? (I feel myself silly ;-))
2. WriteProcessMemory() looks a quite hard thing to me ;-) What does it do?
3. Hmm, if I can find the "Trigger Editor" window, how could I find the textbox...? It's not likely that the textbox has a specific text... How, plz?
Thank you... repped first.
11-04-2006, 11:21 AM#4
Zoxc
Quote:
Originally Posted by Wyvernoid
1. What does FindWindow(vbNullString,vbNullString) do? You used it at first, and then looked for every window using GetWindow() (if I comprehended it rightly ^^)... So I should not use FindWindow to find a window, but use GetWindow to check each? (I feel myself silly ;-))
FindWindow(null, null) returns the first window. Then you can go on with GetWindow.

Quote:
Originally Posted by Wyvernoid
2. WriteProcessMemory() looks a quite hard thing to me ;-) What does it do?
It copies memory from your process to an address in another process.

Quote:
Originally Posted by Wyvernoid
3. Hmm, if I can find the "Trigger Editor" window, how could I find the textbox...? It's not likely that the textbox has a specific text... How, plz?.
You can use EnumChildWindows in the Trigger Editor handle then check if the child window class is EDIT. The first EDIT is the comment box. The secound is the jass box. Get PitzerMike to make a example of EnumChildWindows in VB since I got no idea how to do that in that crappy language =P
11-06-2006, 04:01 AM#5
Wyvernoid
Quote:
Originally Posted by Zoxc
You can use EnumChildWindows in the Trigger Editor handle then check if the child window class is EDIT. The first EDIT is the comment box. The secound is the jass box. Get PitzerMike to make a example of EnumChildWindows in VB since I got no idea how to do that in that crappy language =P
Hmm... More questions coming:
1. Which function should I use to check the window? Is it GetClassName(hwnd, string, int)? And then check if the string is "EDIT"?
2. What if the current trigger is not changed into JASS(meaning that there would not be a second textbox)? Or the current selected item is a category(meaning that there would not any textboxes)? Does EnumChildWindows give the callback a hwnd of 0 if it enumerates all the child windows(so that I can know when to stop)?
3. How to insert the text? Should I use GetText(hwnd, string) and SendMessage(hwnd, WM_SETTEXT, 0, string)? But - how could I know where the cursor is? Or I can only insert the text in the beginning of the textbox?

Whew, what a whack. =) Thank you all! And - PitzerMike, I'm waiting for your example code! ^^
12-31-2006, 09:29 PM#6
PitzerMike
You can find plenty VB exanples of using EnumChildWindows with google. Or look at planetsourcecode or somewhere.
As for your other questions, again search for examples with google.