Hi,

First of all... Yeah, I know that there WAS and still IS a lot of discussions and arguing about this particular topic (actually the main reason why I opened a new "Global Hook vb.net" topic is because I couldn't find any answers to my questions as a lot of grown up KIDS are spamming the thread with their childish behavior and/or unproductive comments)...

TO THE PROBLEM:

I am currently trying to make an application that automatically installs other applications by simulating mouseclicks and keystrokes on buttons, forms, controls etc.
At this point I am able to launch Application/Installer; find the process, threadID, processID, Handle etc. of the Installer/Application and the associated controls; and to successfully send Keystrokes, Mouse-clicks, ... and so forth.
But there is a main problem: When the Installer/App starts its installation process it usually has a progressbar... Well... I need to know when the progressbar has reached 100% and I was unable to find it out on my own without the help of Spy++ and its MESSAGES window that showed me which messages the control currently sends and receives...

So I figured:

a) I could verify (every few milliseconds) if the progressbar is still on the form or if the form changed or something like that and continue with Mouse-clicks and/or Keystrokes... Well... no joy... VB either gave me some errors or some weird errors or some... well... weird results...

b) I could try to simulate what spy++ does and try to capture the messages sent/recieved by that particular progressbar... so I went on a 3 week SEARCH-ENGINE expedition.... guess what I learned... Hook-ing seemed to be the answer... well... SEEMED... I know that I need to make a global hook, but I have problems with making a global hook:
1. I read that it isn't possible with vb.net (actually it ain't possible in .net framework at all)
2. Later I read that someone actually did it (forgot where that came from)
3. Much. much later I read that some third party dll was able to give that functionality to vb.net (again: forgot where i read that)
4. I don't know how to make a DLL and make a global hook that I can actually call from my app (still in vb.net learning phase)

c) I could uninstall VS 2008...

Desperate about Google-ing, Yahoo-ing, AOL-ing, FilesTube-ing, Torrents, Forums, VS.net ... I came here and opened this topic in hope for any answers or any directions that someone could point me to... Hell, I even tried Microsofts BING (now you can see how desperate I was and still am)

BEFORE ANSWERING TO THIS TOPIC PLEASE READ THE FOLLOWING:

PLEASE... I BEG YOU... DO NOT under any circumstances, start arguing through the whole thread... I'm sick of it really... I searched almost every forum on the web trying to find answers... and what did I find? Well, I found some KIDS that posted some stupid answers/comments only to raise their forum reputation to "Master of all Threads" or "Post-Monster" or some stupidity similiar to those I mentioned...

again:

PLEASE... I BEG YOU... DO NOT under any circumstances post here if you don't have a clue what I am writing about...

one more time:

PLEASE... I BEG YOU... DO NOT under any circumstances post comments like: "Learn C++", "Use /*enter any crappy Third-Party app here*/ this ...", "Search MSDN ..." etc. (As I already mentioned... I tried all of it with no avail)

One more thing: Sorry for the long post and/or double post (I'm tired of searching forums for any posts anymore) and sorry for any grammatical mistakes I maybe made... English isn't my native language.

Thanks in advance (for any PRODUCTIVE help),

Edin

hmm ok if i understood you right you want to install some programs without the user to interact? and finally find out when the program is done with the installtion?

then you should take a look into FindWindow, GetWindowText and SendMessage API

each installation step has its own window title. so you actually can check if the window title is correct then sendMessage to the button. This is the easiest way to do so without hooking the whole system.

About when a program is finished with the installation thats depends. if the program get installed via MSIEXEC then you just check when this process (msiexec.exe) is nor running anymore.

If this isnt the answer you were looking for then please give me some more details without all this blabla arround. thats just confusing.

Sorry for the blabla :D

Well... i found a workaround...
"a) I could verify (every few milliseconds) if the progressbar is still on the form or if the form changed or something like that and continue with Mouse-clicks and/or Keystrokes... Well... no joy... VB either gave me some errors or some weird errors or some... well... weird results..."
It magically works now :D
I am able to iterate through the controls of an application with the help of "WindowScrape.dll" (found it earlier on some website) which uses FindWindow, SendMessage etc. and to see which Controls are still present on the form. Makes life easier alot...
"each installation step has its own window title" Download winrar installer and fire it up... it has the same window title all the time...
Thx for the fast response tho... I will definitely stick with daniweb from now on :)
But, I'm still curious about this whole hooking thing... Is it possible? And if so... How can I do it? It seems to me like a really powerful piece of code that I could use in general for all of my apps....

But, I'm still curious about this whole hooking thing... Is it possible? And if so... How can I do it? It seems to me like a really powerful piece of code that I could use in general for all of my apps....

Well depends...what hooking you want.
Keyboard, mouse, window? there are so many possible hooking out there so i wonder which one you want :p

hehheh...
well... window hooking seems really interesting

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.