trausti
asked on
Winexec and the program can do more
when i push my button1.click and executes the code
'winexec('c:\acrobat4.exe'
and when the program is running i want my program breath i will be able to minimize my program or anything edit memo or something
I think he wants to call Winexec first and then minimize his application. Earm... Madshi... you're damnd fast with you replys! <g>
ASKER
i want to execute application and the application is so slow to unpack the files, so i want to be able to work in my program
e.g: minimize push a button or ??????
e.g: minimize push a button or ??????
Oh... I forgot. Did you tried
Winexec(bla...);
form.WindowState := wsminimized;
?
Winexec(bla...);
form.WindowState := wsminimized;
?
Oh, sorry. Dont use Winexec, use ShellExecute instead. You can specify a parameter in the call (Win32 API) what should happen with your app.
ASKER
!!!
if i use your code
//Winexec(bla...);
//form.WindowState := wsminimized;
the application will have to finish and when it is finish then the form will minimize, i want application.processmessage or something example
if i use your code
//Winexec(bla...);
//form.WindowState := wsminimized;
the application will have to finish and when it is finish then the form will minimize, i want application.processmessage
ASKER
!!!
if i use your code
//Winexec(bla...);
//form.WindowState := wsminimized;
the application will have to finish and when it is finish then the form will minimize, i want application.processmessage or something example
if i use your code
//Winexec(bla...);
//form.WindowState := wsminimized;
the application will have to finish and when it is finish then the form will minimize, i want application.processmessage
ASKER
have you example with ShellExecute
Hi bruno-he... :-)
Well, it was chance that I was so fast this time.
ShellExecute('calc.exe', nil, nil, nil, nil, SW_MINIMIZE);
Regards, Madshi.
Well, it was chance that I was so fast this time.
ShellExecute('calc.exe', nil, nil, nil, nil, SW_MINIMIZE);
Regards, Madshi.
shellexecute
('handle,'open',pchar('c:\ acrobat4.e xe'),nil,n il,sw_mini mize);
application.processmessage s;
('handle,'open',pchar('c:\
application.processmessage
Hi,
If the application you need to run is to large, and need time to run, in this case you should run it within a thread.
If the application you need to run is to large, and need time to run, in this case you should run it within a thread.
Use CreateProcess(...)
see documentation i MS SDK help
I have somewhere complete example including code to wait for the executing program to finish.
So if anybody is interested I can
try to find it.
see documentation i MS SDK help
I have somewhere complete example including code to wait for the executing program to finish.
So if anybody is interested I can
try to find it.
And another new expert! Welcome, kalink... :-)
May I friendly request something? Here in the Delphi forum it is common practice to lock questions with an answer only if you are the first expert in the thread, or if all other comments are evidently wrong. Otherwise it is usual to post a *comment* only. This way the questioner can later choose easily which expert helped most. Thank you for listening... (-:
Regards, Madshi.
May I friendly request something? Here in the Delphi forum it is common practice to lock questions with an answer only if you are the first expert in the thread, or if all other comments are evidently wrong. Otherwise it is usual to post a *comment* only. This way the questioner can later choose easily which expert helped most. Thank you for listening... (-:
Regards, Madshi.
ASKER
I need an example with createprocess thanks
var
ds: Pchar;
i: Integer;
si :TStartupInfo;
sa :PSecurityAttributes;
ppi :PProcessInformation;
pi :TProcessInformation;
h : LongBool;
begin
ds:=PChar('');
sa:=nil;
GetStartupInfo(si);
h:=CreateProcess( PChar('C:\Windows\Notepad. exe),
PChar(''),
sa,
sa,
false,
0,
ds,
PChar('C:\Windows'),
si,
pi
);
if not h then showmessage('an error occurred') else
begin
WaitForSingleObject(pi.hPr ocess,1000 0);
showmessage('finished');
end;
close;
end;
ds: Pchar;
i: Integer;
si :TStartupInfo;
sa :PSecurityAttributes;
ppi :PProcessInformation;
pi :TProcessInformation;
h : LongBool;
begin
ds:=PChar('');
sa:=nil;
GetStartupInfo(si);
h:=CreateProcess( PChar('C:\Windows\Notepad.
PChar(''),
sa,
sa,
false,
0,
ds,
PChar('C:\Windows'),
si,
pi
);
if not h then showmessage('an error occurred') else
begin
WaitForSingleObject(pi.hPr
showmessage('finished');
end;
close;
end;
but that wont let your program "breath",in fact quite the opposite WaitForSingleObject() waits until the notepad is finished before your code continues...
ASKER
I need an example with createprocess thanks
ASKER
I got this message
an error occurred
//if not h then showmessage('an error occurred') else
what is wrong?
an error occurred
//if not h then showmessage('an error occurred') else
what is wrong?
apart from an unterminated string here:
h:=CreateProcess( PChar('C:\Windows\Notepad. exe),
maybe change this:
PChar('C:\Windows') to
PChar('C:\')
there should be no error,i tested and works ,you can tell when it works becuase my test app doesnt even repaint itself...
maybe you have older version of delphi and need to change declaration?what delphi version you have?
i really dont think this is what your after is it?
dont you want your app to continue doing its stuff or you want your app to stop completely and wait for new app to finish?
h:=CreateProcess( PChar('C:\Windows\Notepad.
maybe change this:
PChar('C:\Windows') to
PChar('C:\')
there should be no error,i tested and works ,you can tell when it works becuase my test app doesnt even repaint itself...
maybe you have older version of delphi and need to change declaration?what delphi version you have?
i really dont think this is what your after is it?
dont you want your app to continue doing its stuff or you want your app to stop completely and wait for new app to finish?
ASKER
okey, thi works, my code was like this
h:=CreateProcess( PChar('Notepad.exe'),
maybe change this:
PChar('C:\winnt') to
PChar('C:\')
------------
alright!!! maybe you can help me with this stuff!!!
how is best to executes all values in listview?
my listview will have this values
Tasks Description
-------------------------- ---------- ---------- ---------- ---------- -
Run App: c:\winnt\notepad.exe
Wait: 10000 // 10 seconds
SendKeys: {ALT}fo
............
............
-------------------------- ---------- ---------- ---------- ---------- --
so i want to run notepad, wait 10 seconds and then send "file open" to notepad and even more
h:=CreateProcess( PChar('Notepad.exe'),
maybe change this:
PChar('C:\winnt') to
PChar('C:\')
------------
alright!!! maybe you can help me with this stuff!!!
how is best to executes all values in listview?
my listview will have this values
Tasks Description
--------------------------
Run App: c:\winnt\notepad.exe
Wait: 10000 // 10 seconds
SendKeys: {ALT}fo
............
............
--------------------------
so i want to run notepad, wait 10 seconds and then send "file open" to notepad and even more
ASKER
okey, thi works, my code was like this
h:=CreateProcess( PChar('Notepad.exe'),
maybe change this:
PChar('C:\winnt') to
PChar('C:\')
------------
alright!!! maybe you can help me with this stuff!!!
how is best to executes all values in listview?
my listview will have this values
Tasks Description
-------------------------- ---------- ---------- ---------- ---------- -
Run App: c:\winnt\notepad.exe
Wait: 10000 // 10 seconds
SendKeys: {ALT}fo
............
............
-------------------------- ---------- ---------- ---------- ---------- --
so i want to run notepad, wait 10 seconds and then send "file open" to notepad and even more
h:=CreateProcess( PChar('Notepad.exe'),
maybe change this:
PChar('C:\winnt') to
PChar('C:\')
------------
alright!!! maybe you can help me with this stuff!!!
how is best to executes all values in listview?
my listview will have this values
Tasks Description
--------------------------
Run App: c:\winnt\notepad.exe
Wait: 10000 // 10 seconds
SendKeys: {ALT}fo
............
............
--------------------------
so i want to run notepad, wait 10 seconds and then send "file open" to notepad and even more
now we get details ...
The WaitForSingleObject function returns when one of the following occurs:
1:The specified object is in the signaled state.
2:The time-out interval elapses.
DWORD WaitForSingleObject(
HANDLE hHandle, // handle of object to wait for
DWORD dwMilliseconds // time-out interval in milliseconds
);
execute values from listview i never tried ..
The WaitForSingleObject function returns when one of the following occurs:
1:The specified object is in the signaled state.
2:The time-out interval elapses.
DWORD WaitForSingleObject(
HANDLE hHandle, // handle of object to wait for
DWORD dwMilliseconds // time-out interval in milliseconds
);
execute values from listview i never tried ..
ASKER
can you give me hint, can i use a timer component or ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
can you give me hint, can i use a timer component or ?
ASKER
thanks
ASKER
thanks
Regards, Madshi.