Okay ive been looking everywhere and I can't find this. Ive used the help documents and tried to use the Shell function and also Process.Start. So say I have a file at relative path /Data/manual.pdf (i know how to get directory of application to create absolute path). But I need to open this file with an .exe located at /Data/reader.exe
How would I do this?
Your question is a little vague. If you want to open another program as in your pdf above WITHIN your application, you need to put a reference to that program. Else your shell should open that program independantly, so the actual question is, what exactly do you need? Open another .exe on its own or open it using your application referencing that programs dll's etc?
If it is on its own, use shell as follow. You will see that I made use of a standard sub to call the shell, else it will only open certain .exe's.
Private Sub RunShellExecute(sTopic As String, sFile As Variant, sParams As Variant, sDirectory As Variant, nShowCmd As Long) Dim hWndDesk As Long Dim success As Long 'the desktop will be the 'default for error messages hWndDesk = GetDesktopWindow() 'execute the passed operation success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd) 'This is optional. Uncomment the three lines 'below to have the "Open With.." dialog appear 'when the ShellExecute API call fails 'If success < 32 Then ' Call Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & sFile, vbNormalFocus) 'End If End Sub 'Under a control like i.e. command button - Private Sub Command1_Click(ByVal Button As Integer) Dim x As Double x = Shell("rundll32.exe shell32.dll,Control_RunDLL", vbMaximizedFocus) End Sub
Is this what you were looking for?
Andre! Really! .BLOAT code in the vb6.0 forum? Shame on you! :)
Using the shell function, shellexecute(ex) API with the open verbs will only open the destined file with the default program. If you want to open a file with another program than the one registered as the default, you will need to hope it accepts command line parameters and you could pass the path of the file to the exe that is to open it... (c:\Program Files\MyProgram.ext o/c:\ProgramData\MyProgramName\filename). Another way would be to automate the other program and make it open the file...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click Dim txtB1 As New TextBox Dim i For i = ...