Any Help would be much appreciated.
Thanks.
Easiest is to use
{uses ShellAPI}
ShellExecute(
HInstance,
NIL,
PCHAR('c:\myapp.exe'),
PCHAR('parameters if any'),
PCHAR('default folder if any'),
SW_SHOWNORMAL { or any of the other sw_ constants});
You can also use CreateProcess() if you need to control the new process.
Both functions is found in the Win32 help.
-ThomasN
Cheers.
You use it much like other code.
But often you will have to do some typecasts such as the PChar to
string.
The question is not stupid, but I'm not quite sure if I got it right so
here's some more notes....
If the code is already imported by Delphi, you just add the unit to your
uses clause.
If not, you must import them yourself.
If you look at the winAPI units shipped with Delphi, (windows.pas,
shellapi.pas, etc., perhaps located at "$(DELPHI)\Source\Rtl\Win\" )
you'll see how it's done.
Eg:
The ShellExecute function is imported the ShellAPI.pas file aprx like
this:
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,
Directory: PChar; ShowCmd: Integer): HINST; stdcall; external
'shell32.dll' name 'ShellExecuteA';
You must know the size and number of parameters, the calling convention
(most often "stdcall"), the library (.dll) and the name or index of the
function. This should all be documented in the Win32 help. (Also check
the QuickInfo button on the help page).
Did that make any sense :) ?
Regards
-ThomasN
In the case of the ShellExecute call you need to add the ShellAPI unit to a
uses clause in the unit. The majority of win 32 calls (including
CreateProcess) are defined in Windows.PAS which is automatically added to
the interface uses clause by the IDE when designing form units - so you
don't need to do anything special, just add the calling code.
Thanks again.
> Joe wrote:
> > I know these questions may be stupid but how do I use win32 code in my
> VCL
> > based project, I am using delphi 5.
> >
At least I could not manage them(forgive me if I have a learning problem)
So I hunted around and found a gem
use
Winexecute
it takes just two arguments.
This is the most similar in operation to the Shell command that I use in VB,
Thanks
Razor
pssst.... I am absolutely new to Delphi, but I know VB well.
Joe <J...@orange123.freeserve.co.uk> wrote in message
news:39e9...@news.server.worldonline.co.uk...
> I know these questions may be stupid but how do I use win32 code in my VCL
> based project, I am using delphi 5.
>
> Cheers.
>
>
BUT... it is only provided for backwards compatibility with old 16-bit applications and will eventually be phased out of the API.
I do strongly urge you to get to grips with at least ShellExecute.
GRS.
Thanks in advance,
J
In article <8t31n5$ruc$1...@news.vsnl.net.in>,
"Bill Gupta" <nom...@whatsamail.com> wrote:
> Shell execute and createprocess are not easy at all.
>
> At least I could not manage them(forgive me if I have a learning
problem)
>
> So I hunted around and found a gem
>
> use
> Winexecute
>
> it takes just two arguments.
>
> This is the most similar in operation to the Shell command that I use
in VB,
>
> Thanks
> Razor
>
> pssst.... I am absolutely new to Delphi, but I know VB well.
> Joe <J...@orange123.freeserve.co.uk> wrote in message
> news:39e9...@news.server.worldonline.co.uk...
> > I know these questions may be stupid but how do I use win32 code in
my VCL
> > based project, I am using delphi 5.
> >
> > Cheers.
> >
> >
Sent via Deja.com http://www.deja.com/
Before you buy.