Visual Basic 6.0 Question

larva

Member
Jul 15, 2001
185
0
0
Hi Guys,

I am using the below code to execute external program (ABC.exe) from MS VC++:

ShellExecute (NULL,"open","ABC.exe",NULL,NULL,SW_HIDE);

How do I execute thisprogram from VB6.0 ? Any code can do this in VB6.0 ? Thanks !

regards,
Larva
 

BuckleDownBen

Banned
Jun 11, 2001
519
0
0
There is a Shell command in VB that takes as arguments the path to the executable and the window-state it will open in. If you need more, you can declare your ShellExecute as an API function and use it from within VB
 

UnseenRocker

Member
May 14, 2002
33
0
0
Here is a great site for finding code: VBCode.com

I bookmarked it myself.

example:

Dim Scr_hDC as long
Scr_hDC = GetDesktopWindow ()
'change "Open" to "Explore" to bring up file explorer
StartDoc = ShellExecute (Scr_hDC, "Open", DocName, "", "C:\", 1)
'end function

'Place the following code in under a command button or in a menu, etc...

dim r as long
r = startdoc ("C:\windows\arcade.bmp")
 

larva

Member
Jul 15, 2001
185
0
0
Hi Guys,

Thanks a lot ! Actually I need to execute IE6.0 and get the report (PDF format) generated by Oracle Report Server and display on IE6.0 as follow :
========================================
sprintf(&temp[0],"http://%s/dev60cgi/rwcgi60.exe?cpcs&destype=cache&desformat=pdf&status=post&report=cpcs.rdf&P_OPERATORID=%s&P_START_SHIFT=%s",ReportIP,operatorID,*shiftDateTime);

ShellExecute(NULL,"open","IEXPLORE.EXE",temp,NULL,SW_SHOW);
========================================

How can I do this in VB6.0 ? May be like following:
Dim s As String
s = "http://%s/dev60cgi/rwcgi60.exe?cpcs&destype=cache&desformat=pdf&status=post&report=cpcs.rdf&P_OPERATORID=TEST&P_START_SHIFT=07052002"

How do I pass into the ShellExecute with above parameter ? Thanks


Larva




 

BuckleDownBen

Banned
Jun 11, 2001
519
0
0
Google and Google Groups are your friend when it comes to vb questions. Everything you could possibly want to know has been asked and answered a hundred times. But to answer your question, if you know the path to IE on your machine, then you can do this:

shell "C:\Program Files\Internet Explorer\iexplore.exe www.yahoo.com"

If you don't know the path, then you'll most likely have to resort to the Windows API. If you still need help, post back here.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Put this in a standard module...

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 Long

Public Const SW_SHOWDEFAULT = 10

then your code would look like...

Dim s As String
s = "http://%s/dev60cgi/rwcgi60.exe?cpcs&destype=cache&desformat=pdf&status=post&report=cpcs.rdf&P_OPERATORID=TEST&P_START_SHIFT=07052002"
ShellExecute vbNullString, "open", s, vbNullString, vbNullString, SW_SHOWDEFAULT

The whole point of ShellExecute is to encapsulate the concept of executing an application using the default application associated with a given file, or operation (when using the "open" verb, that is), so take advantage of it. Never hardcode fully-qualified paths in your application, even if it's just for you
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Sorry, I just noticed you used SW_SHOW instead of SW_SHOWDEFAULT. Add this constant to your standard module as well, and use that instead....

Public Const SW_SHOW = 5
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |