johnmallan Posted July 24, 2004 Share Posted July 24, 2004 What i want to do is:1. Have all the .exe's in a directotry launched in numerical, one at a time.2. and also use switches with them3. if i add more .exe's to this directory they will also be launchedIve searched everywhere for this and ive not been able to find it.So if any one knows how to do this could you help me out here.Thanks in advance. Link to comment Share on other sites More sharing options...
DarkPhoenix Posted July 24, 2004 Share Posted July 24, 2004 What you're trying to do is quite easy, however, I am not sure what you mean by launch exes in numerical. Could you maybe give an example of some of the exe files you'd have (and thus need to launch) and I can try to help you. Link to comment Share on other sites More sharing options...
johnmallan Posted July 24, 2004 Author Share Posted July 24, 2004 what im trying to do is make a program that will install the windows updates for windows 98, ME, 2000, and XP. The numerical order is not neccessary but if possible would be prefered.EDIT: Just incase your curios ive already got the prog to detrmine which os is running which i got from the ms site. Link to comment Share on other sites More sharing options...
DarkPhoenix Posted July 24, 2004 Share Posted July 24, 2004 First, define this API in a global area: (such as in the top of a form or in a module) We'll use it to execute external files (Don't use Shell(), it is horrible)Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongYou must reference the "Scripting type library" for the following to work. I haven't installed VB now (Since I've migrated to VB.NET) but I think you'll find it in Proejct -> References or something. The list should be alphabetically sorted, so just put a checkmark on "Scripting type library". (File name: "scrrun.dll")Then, do something like this to find and exectute files:Dim FSO As FileSystemObjectDim File As FileFor Each File In FSO.GetFolder("<path-to-folder-containing-exe-files").Files ShellExecute Me.hWnd, "open", File.Path, vbNullString, "", 1NextThis piece of code does no filtering for you though. I'm sure you can figure it out from here, and in case not, do not hesitate to ask more. I'll do my best to help. Oh, btw, the place that I put vbNullString you can replace with for instance "/S" or something, it's the parameters you pass to the file. Link to comment Share on other sites More sharing options...
johnmallan Posted July 25, 2004 Author Share Posted July 25, 2004 cant seem to get the code to worki put the API in a module of its ownand i copied the other code in CmdInstall (currently only command button on the form) and it keeps giving me this:Run-TimeError 91Object variable or With block variable not seti have had no luck with messing around with it for the past 6 hoursany help would be appreciated Link to comment Share on other sites More sharing options...
DarkPhoenix Posted July 25, 2004 Share Posted July 25, 2004 Oh dang.. my fault.. just one thing I forgot.. instead of Dim FSO As FileSystemObject try Dim FSO As New FileSystemObject Link to comment Share on other sites More sharing options...
johnmallan Posted July 25, 2004 Author Share Posted July 25, 2004 it worked a treat , thanks alot DarkPhoenix Link to comment Share on other sites More sharing options...
DarkPhoenix Posted July 25, 2004 Share Posted July 25, 2004 Glad I could be of help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now