How do i execute multi programs in at one time using maybe a batch file or something like that so that way they would be like embeded in the program.

I don't know exactly what you are talking about..... if you tell me what you want to accomplish I can help you out a little more.... a batch file is going to wait though, for 1 command to finish before moving on to the next. The shell command (or shellexecute) in VB will launch the app in question, and then move straight on to the next line of code (which could just as easily be another launch of an app).

I don't know exactly what you are talking about..... if you tell me what you want to accomplish I can help you out a little more.... a batch file is going to wait though, for 1 command to finish before moving on to the next. The shell command (or shellexecute) in VB will launch the app in question, and then move straight on to the next line of code (which could just as easily be another launch of an app).

I am tring To Get This program to install First remember what they specify on the SP page and in stall it at the end. Also i am tring to get the program to install the proper updates that are need for the Operating system selected and then install the antivirus or the Internet securities, with the updates copied from a specific folder and placed in a designated folder on the hard drive. I then need it to install the Spyweeper and its updates to the proper place on the Hd. BUT I NEED IT TO DO IT where no on can see it. It okay for it to show on the task bare but not on the screen its self.

Ouch, that's going to be tough, because most of the mechinisms required to directly affect another program require that program to have focus..... you can use SENDMESSAGE (the sendmessage api call) and try to send say WM_SETTEXT to the textbox in question, while leaving it in the background.... but finding the hWnd (Windows Handle) of the textbox in another program's thread is going to be real tough..... you can TRY findwindowex, (in conjunction with findwindow) but you are going to have a tough time with that.

Ouch, that's going to be tough, because most of the mechinisms required to directly affect another program require that program to have focus..... you can use SENDMESSAGE (the sendmessage api call) and try to send say WM_SETTEXT to the textbox in question, while leaving it in the background.... but finding the hWnd (Windows Handle) of the textbox in another program's thread is going to be real tough..... you can TRY findwindowex, (in conjunction with findwindow) but you are going to have a tough time with that.

Could You give Me a couple of examples of the send key and also what your talking bout here please

Sendkeys is a command in VB that allows you to send keystrokes from your app to the currently active (foreground) application. For example, you can open a blank notepad document, and send something to it like so:

Shell "c:\windows\notepad.exe", vbNormalFocus
Me.Show
DoEvents
AppActivate ("Untitled - Notepad")
SendKeys "hello world"

The problem, is that you need the window to stay behind your application, and therefore, sendkeys will not work.

Now, you can TRY to use the windows API.... which has certain function calls that might help.... one of those function calls is "sendmessage" which allows your program to send a windows message (a hex number that windows understands to do something). Everything that happens to a window, mouse move, mouse down, mouse up is done by a windows message. One of the windows messages, is called "WM_SETTEXT", which has some hex value... pretty nifty huh, WM for windows message, and settext for what it does....

Now, we've just increased our power significantly from sending keystrokes, to sending any kind of message that windows can send....(just about, this isn't the C language, so we have no power in pointers [except addressof, but not really the same]). This leads us to a major problem.... it's all find and dandy, but we have to know the hWnd to send this information to. Every window (mind you, everything in windows is a window.... a textbox, a listbox, a window, a button, they are all a window) every window has an hWnd. An hWnd is a number windows randomly assigns to a window (any window) to identify it from other windows. So, you are going to have to try to find the hwnd, not of the program, but of the textbox on the program, that you want to set the text of. Now, there is a way to do this, but it requires a lot of work, and a lot of trial and error. You need to use the "findwindow" API, AND the FindwindowEx API. The reason, is because the hWnd of any window changes every time. It's never the same. Every time the program launches, windows craps out a new hWnd. Nice huh?

Now, things get complicated. Windows are hierachial, so, each "control" which is a window, actually has a "parent" window. Meaning that a textbox, combo-box, listbox, button, etc, are all children windows that are owned by their parent window. So, that means, you'll have to first get the hWnd of the parent window. (oh yeah, and this is assuming the textboxes or whatever aren't in a frame, or some other container control which behaves as the temporary foster parent.... meaning, you'd have to get the main window's hWnd, then the Frame's hWnd, THEN the textbox's hWnd). Now, if the window has more than 1 textbox, you'll have to do findwindowex in a loop (findwindow returns the hWnd of a top level window, findwindowEx returns the hWnd of a child window of the parent hWnd specified), and figure out which order they get returned to your program, so you know which one you need to use to send the WM_SETTEXT message to.

I've attached the code for using SendMessage with the WM_SETTEXT constant, and I've also attached a program that will get the hWnd of whatever window is beneath the mouse. This way, so you can see what I"m talking about with the settext. If you run GetClass, it will return a wealth of information about whatever window is beneath the mouse cursor... the hwnd, the class, the title, and the threadID. Then if you run the settext program, and place the cursor over a textbox (with getclass running) and get the hwnd, plug that into the settext program, and type something, and hit set.... it will set the text in the textbox of a different program......

This article has been dead for over six months. Start a new discussion instead.