Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute SW_commands 1

Status
Not open for further replies.

cartoonwally

Technical User
Sep 20, 2003
7
0
0
AU
Alright, im trying to execute a program in a specified window using shellexecute, i susppect that the SW command needs to be changed... the code i have is...

ShellExecute(Handle, 'Open', ' nil, nil, SW_SHOW);

i need the application to launch in a section in a form...

Ideas?
 
" looks more like a URL than a program. Since *.com
is a valid file extension for a DOS executable, I would imagine the
system would search the PATH for a program file name "(which probably doesn't exist) and therefore ShellExecute would fail.

If you are trying to open a URL the default browser, you might try
something like " The " should invoke
the default protocal handler for http, which is normally your web browser.

A far as putting the program in a "specified" window, the window handle
is assigned automatically by the system, and you can't change it. The
return value of ShellExecute() should give you window handle. If you
want your program to "swallow" the window, you can try using the
Windows API SetParent() function. ShellExecute is a bit flaky about
the way it returns a value, the CreateProcess() function might give
more predictable results.
 
Or just drop a browser component on the form and open it in that.
 
Hi cartoonwally,

It depends on the Delphi Version you have.

Up to 5th, there's no WebBrowser component
included in Delphi, but from 5 up you have one in the
Internet palette page.

Cheers,

Andrew
 
You should be able to install a TWebBrowser control on
any 32-bit version of Delphi (That's all except ver 1.0)

The exact steps are a bit different for different versions,
but from the main menu it should be something like:

Component -> Install -> ActiveX control
 
Hi ppc386 and cartoonwally,

[COLOR=red ]BEWARE[/color]: DELPHI3-4 doesn't handle
TWebBrowser correctly, thus creating some problems
when using it, since some WebBrowser methods are not
supported!!!!

Please bear this in mind.

Cheers,

Andrew
 
Yes, I would not recommend it for any "mission-critical" applications,
but if you just want to display a simple web page, it should be okay.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top