Running and Controling another Application via VB.net Application

  • Thread starter Thread starter bbepristis
  • Start date Start date
B

bbepristis

I have an application I wrote that requires MS SQL Server Express So I
want my installer to call and control the MS SQL SERVER installer how
do I do this I have seen it done before Im just not sure how to go
about it I want it to automaticly click the next buttons select mix
mode auth and set the sa passwd ext.... Any Help would be much
apprechiated...
 
Sept. 10, 2006

System.Windows.Forms.SendKey() ... pass in a keyboard keyname and it sends
it to the app with the *current focus*. . . there are a few "special" keys
you should know about so check it out here:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx

(BTW, the SendWait method works for me... Send() didn't work but actually
froze the computer)

So if you've got SQL setup wizard as your current window, then just go
through it once yourself *by keyboard* and record each keystroke you use...
then replicate it using SendKeys.SendWait and you're done.

You may be wondering how to get SQL setup as the current window... without
calling unmanaged code, I just in code call a new process to start the
setup.exe file... and it runs - with a little thread.sleep occassionally to
make sure that I don't try to send a key too soon.

You may be wondering how to get your code to run while not having focus....
well... the way I do it... is to put all my code in a method.... and then
when the user clicks a button (or in the form_load event), I create a new
thread set to that method. Then the thread executes in the background, while
the SQL setup functions in the fore-front.

With practice - it works :).

--

Joseph Bittman
Microsoft Certified Solution Developer
Microsoft Most Valuable Professional -- DPM

Blog/Web Site: http://CactiDevelopers.ResDev.Net/
 
Back
Top