Hi Randy,
So what you are saying that each program path needs to be in it's own
registry key. I did this, I have the full path saved to the registry.
(c:\directory\whatever\file.exe , This is how it's saved in the
registry.)
Now if I save a file like this, and go to the section of my program to
run
or open it, it works. I am using a command button, when clicked it calls
the registry settings and opens the program. But if I leave to another
section of my program to open another program. One that was saved early
I get a message that the file is no good or that can't find it. But if I
go and resave the file and then open it, it works. Now the other program
won't open.
Here is the code I am using to open the programs.
Private Sub cmdRunXwing_Click()
Dim iret As Long
iret = ShellExecute(Me.hwnd, _
vbNullString, _
"" + GetSetting("some key", "myprogram", "some program", "DEFAULT
VALUE 1"), _
vbNullString, _
"", _
SW_SHOWNORMAL)
End Sub
#If Win32 Then
Private 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 Long
#Else
Private Declare Function ShellExecute Lib _
"shell.dll" Alias "ShellExecute" _
(ByVal hwnd As Integer, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Integer) As Integer
#End If
Private Const SW_SHOWNORMAL = 1
I'm also using the savesettings to save the path info
Combo1.Text = "" + UCase(CommonDialog1.filename)
SaveSetting "some key", "myprogram", "some program", "" +
LCase(CommonDialog1.filename)
Combo1.AddItem Combo1.Text
Am I doing something wrong here? Most of the programs that I will be
opening would be dos programs.
Any help would be aprecaited.
Robert
Quote:
> I'm a little confused on your exact intent, but may be able to provide some
> generic direction.
> To save 16 file paths/names to the registry, you will need to save to 16
> different keys (under the same group). If you scan the registry for "MRU",
> you will see examples of how different apps saved the most recently used
> file path & names. No, you so not need a separate common dialog for each
> file, but you will need to save the full qualified path to the app, plus
> the executable filename, a 1 string for each entry. With this info,
> executing the app should be a matter of retrieving the registry item,
> t{*filter*} off unnecessary spaces or nulls, then using the Shell statement of
> ShellExecute API to launch the program.
> The starting path (the path the launched app initially points to) will
> probably be the application folder if the above guidelines are followed.
> You can not use App.Path to change another application to a particular
> folder; the App object is specific to the instance of the VB application
> you are running.
> --
> Randy Birch, MVP Visual Basic
> Moderator, Fidonet Visual Basic Programmer's Conference
> VBnet, The Visual Basic Developers Resource Centre
> http://www.*-*-*.com/
> : Hello everyone,
> :
> : I have a few questions about a project I am working on. I'm using
> : VB 4.0 standard edition.
> :
> : I need to have my program Save a path to a program's .exe to the
> : registry. I can do this without a problem. However when I try to
> : open the path, It will only open the last program I saved into the
> : registry. I want the program to open up about 16 different programs.
> : It seems to me that my program will only open up to the last directory
> : of the last saved file.
> :
> : My question is do I need a different common dialog box for each
> : file I try to save? Or do I have to write a code to get the right
> : path.app to change to the right directories? I am very confused on
> : this. I have been able to save to the registry and get the file to
> : start, but only 1 or two of them will open. Unless I resave it and then
> : open it.
> :
> : Any help would be apprecaited
> :
> : Robert
> : --
> : Onyx Graphics
> : Complete Website, Graphics & Software Development
> : ICQ: 1056982
> : Phone: 201-484-5628
> : Homepage; http://www.*-*-*.com/ ~warfire
> :
--
Onyx Graphics
Complete Website, Graphics & Software Development
ICQ: 1056982
Phone: 201-484-5628
Homepage; http://www.*-*-*.com/ ~warfire