Q&A
HOME
Tips & Tech
Q&A
Discuss
Download
자유게시판
홍보 / 광고
구인 / 구직
LOGIN
회원가입
DOS 프로그램 실행시에 창을 안보이게 하는거......
안녕하세여?
전에 글을 올렸다가 많은 도움을 받았었는데여....근데 좀 이상한게 있어서여...
CreateProcess를 이용해서 DOS 프로그램을 실행시키는데..
StartUpInfomation 구조체에 윈도우 실행히 보이지 않게하는 값을 세팅을
했는데두 불구 하구 도스창에 계속 보이는데 이유가 뭘까여??
궁금...이상....
안보이게 해야 하는데....
갈켜줘여.....
그럼 즐푸....
3
COMMENTS
전진운
•
2001.05.29 02:39
안녕하세요
제가 잘 몰라서 질문의 요지를 잘 모르겠군요
제가 가지고 있는 자료에 이런게 있어서 올립니다.
도움이 되실려나 모르겠습니다.
확인도 해보지 않은 function 입니다.
Function Exec(Path,Params,WorkPath:string; Wait:Boolean; Runmode:integer):boolean;
{Path Full path to the executable
Params Parameters
WorkPath Default directory, '' if same path as executable
Wait TRUE if execution of current program waits until new program finishes
RUNMODE How the application is executed (0 for default SHOWNORMAL):
Value Meaning
SW_HIDE Hides the window and activates another window.
SW_MAXIMIZE Maximizes the specified window.
SW_MINIMIZE Minimizes the specified window and activates the
next top-level window in the Z order.
SW_RESTORE Activates and displays the window. If the window
is minimized or maximized, Windows restores it to
its original size and position. An application
should specify this flag when restoring a minimized
window.
SW_SHOW Activates the window and displays it in its current
size and position.
SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified
in the STARTUPINFO structure passed to the CreateProcess
function by the program that started the application. An
application should call ShowWindow with this flag to set
the initial show state of its main window.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active
window remains active.
SW_SHOWNA Displays the window in its current state. The active
window remains active.
SW_SHOWNOACTIVATE Displays a window in its most recent size and position.
The active window remains active.
SW_SHOWNORMAL Activates and displays a window. If the window is minimized
or maximized, Windows restores it to its original size and
position. An application should specify this flag when
displaying the window for the first time.}
var name:string;
handle:integer;
startUpInfo : TStartupInfo;
processInfo : TProcessInformation;
exeCmd : string;
begin
if Runmode=0 then Runmode:=SW_SHOWNORMAL;
if WorkPath='' then WorkPath:=extractfilepath(path);
if wait
then begin // wait for the process to end...
// Check to make{ If the execution file does not exist, then try
// adding the path, if that fails then you're stuffed }
if not FileExists(path) then begin
result := false;
exit;
end;
// Concat in the parameters
exeCmd := path + ' ' + params;
// Initialise the StartUpInfo record, which handles the creation of
// a new main window for a process
FillChar(startUpInfo, SizeOf(startUpInfo), Chr(0));
StartUpInfo.cb := SizeOf( StartUpInfo );
StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow := runmode;
// Spawn the process out.
if not CreateProcess(
nil, PChar(exeCmd), nil, nil, false,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil,
PChar(ExtractFilePath(path)), startUpInfo, processInfo
) then begin
result := false;
end;
// Wait for ze old process to finish.
WaitForSingleObject(processInfo.hProcess, INFINITE);
end
else begin
handle:=ShellExecute(Application.Handle,'open',pchar(path),pchar(params),
pchar(WorkPath),RunMode);
end;
end;
Function ExecDOS(Path,Params,WorkPath,Title:String; Wait:Boolean; Minimized:Boolean):Boolean;
{Just for DOS programs, creates a PIF file then executes it, deleting it afterward.
Path Full path to the executable
Params Parameters
WorkPath Default directory, '' if same path as executable
Title Title to display at top of window
Wait TRUE if execution of current program waits until new program finishes
Minimized TRUE if program is to run minimized.}
var f:file;
pifpath:string;
a:string;
ierr:integer;
begin
if WorkPath='' then WorkPath:=extractfilepath(path);
// this is a generic PIF image that we've hacked to pieces...settings:
// Idle sensitivity set lowest
// Default window
// Exit on terminate
// All memory resources used if needed
// Allow screen saver
// Not dynamic allocation
a:=#0#120#84#69#83#84#68#79#126#49#32#32#32#32#32#32#32#32#32#32+
#32#32#32#32#32#32#32#32#32#32#32#32#128#2#0#0#68#58#92#116#101+
#115#116#100#111#115#112#114#111#103#114#97#109#116#104#105#110+
#103#46#101#120#101#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#16#0#101#58#92#116#101#109#112+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#45#101#120+
#32#100#58#92#116#101#115#116#32#100#58#92#42#46#42#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#1#0#255#25#80#0#0#7#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#77#73+
#67#82#79#83#79#70#84#32#80#73#70#69#88#0#135#1#0#0#113#1#87#73+
#78#68#79#87#83#32#51#56#54#32#51#46#48#0#5#2#157#1#104#0#128+
#2#0#0#100#0#50#0#255#255#0#0#255#255#0#0#2#0#2#0#159#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#45#101#120#32#100#58#92#116#101+
#115#116#32#100#58#92#42#46#42#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#87+
#73#78#68#79#87#83#32#86#77#77#32#52#46#48#0#255#255#27#2#172+
#1#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#80#73#70+
#77#71#82#46#68#76#76#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#2#0#0#0#0#0#0#0#0#0+
#0#0#0#0#129#0#0#0#0#0#0#0#0#0#0#0#1#0#0#0#5#0#25#0#3#0#200#0+
#232#3#2#0#10#0#1#0#0#0#0#0#0#0#28#0#0#0#0#0#0#0#8#0#12#0#84#101+
#114#109#105#110#97#108#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#76#117#99#105#100#97#32#67#111#110#115#111#108#101+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#3#0#0#0#80#0#25#0#128+
#2#44#1#0#0#0#0#22#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#1#0;
title:=spaces(title,30);
move(title[1],a[$02+1],30);
if length(path)>63 then path:=copy(path,1,63);
path:=path+#0;
move(path[1],a[$24+1],length(path));
if length(params)>63 then params:=copy(params,1,63);
params:=params+#0;
move(params[1],a[$a5+1],length(params));
move(params[1],a[$1c5+1],length(params));
if length(workpath)>63 then workpath:=copy(workpath,1,63);
workpath:=workpath+#0;
move(workpath[1],a[$65+1],length(workpath));
if minimized
then a[$1af+1]:=#$12
else a[$1af+1]:=#$2;
result:=false; // default unsuccessful
pifpath:=newfilename(temppath+'00000000.pif',false);
assignfile(f,pifpath);
rewrite(f,1);
ierr:=ioresult;
blockwrite(f,a[1],length(a),ierr);
closefile(f);
if ierr<>length(a) then exit;
result:=exec(pifpath,'','',wait,0);
application.processmessages;
if not wait then delay(1000); // we must wait one second for Windows to read file
deletefile(pifpath);
end;
오은미 wrote:
> 안녕하세여?
> 전에 글을 올렸다가 많은 도움을 받았었는데여....근데 좀 이상한게 있어서여...
> CreateProcess를 이용해서 DOS 프로그램을 실행시키는데..
> StartUpInfomation 구조체에 윈도우 실행히 보이지 않게하는 값을 세팅을
> 했는데두 불구 하구 도스창에 계속 보이는데 이유가 뭘까여??
>
> 궁금...이상....
>
> 안보이게 해야 하는데....
>
> 갈켜줘여.....
>
> 그럼 즐푸....
>
0
0
삭제
수정
댓글
오은미
•
2001.05.29 05:21
음 제가 짠 코드는....
위 생략...
try
Screen.Cursor := crHourglass;
{ STARTUPINFO를 설정한다. }
FillChar(SI, SizeOf(SI), 0);
SI.cb := SizeOf(TStartUpInfo);
SI.wShowWindow := SW_HIDE; ===> 요부분....
SI.dwFlags := STARTF_USESHOWWINDOW;
{ STARTF_USESTDHANDLES 를 빼면 PIPE로 입출력이 Redirect 되지 않는다. }
SI.dwFlags := SI.dwFlags or STARTF_USESTDHANDLES;
SI.hStdOutput := hWritePipe;
SI.hStdError := hWritePipe;
StrPCopy(CmdLine, Command);
{ Process를 생성한다. }
if CreateProcess(nil, CmdLine, nil, nil, True, NORMAL_PRIORITY_CLASS, nil, nil, SI, PI) then
......중간 생략....
컴파일 실행 모두 잘 됩니다...다만 도스창이 뜨는것이 문제지여....
SI.wShowWindow := SW_HIDE; ==> 요렇게 값을 주면 원래는 안떠야 하는거 아닌가여?
음....왜 그런지 모르겠네여....
전진운 wrote:
> 안녕하세요
> 제가 잘 몰라서 질문의 요지를 잘 모르겠군요
> 제가 가지고 있는 자료에 이런게 있어서 올립니다.
> 도움이 되실려나 모르겠습니다.
> 확인도 해보지 않은 function 입니다.
>
> Function Exec(Path,Params,WorkPath:string; Wait:Boolean; Runmode:integer):boolean;
> {Path Full path to the executable
> Params Parameters
> WorkPath Default directory, '' if same path as executable
> Wait TRUE if execution of current program waits until new program finishes
> RUNMODE How the application is executed (0 for default SHOWNORMAL):
>
> Value Meaning
> SW_HIDE Hides the window and activates another window.
> SW_MAXIMIZE Maximizes the specified window.
> SW_MINIMIZE Minimizes the specified window and activates the
> next top-level window in the Z order.
> SW_RESTORE Activates and displays the window. If the window
> is minimized or maximized, Windows restores it to
> its original size and position. An application
> should specify this flag when restoring a minimized
> window.
> SW_SHOW Activates the window and displays it in its current
> size and position.
> SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified
> in the STARTUPINFO structure passed to the CreateProcess
> function by the program that started the application. An
> application should call ShowWindow with this flag to set
> the initial show state of its main window.
> SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
> SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
> SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active
> window remains active.
> SW_SHOWNA Displays the window in its current state. The active
> window remains active.
> SW_SHOWNOACTIVATE Displays a window in its most recent size and position.
> The active window remains active.
> SW_SHOWNORMAL Activates and displays a window. If the window is minimized
> or maximized, Windows restores it to its original size and
> position. An application should specify this flag when
> displaying the window for the first time.}
>
> var name:string;
> handle:integer;
> startUpInfo : TStartupInfo;
> processInfo : TProcessInformation;
> exeCmd : string;
> begin
> if Runmode=0 then Runmode:=SW_SHOWNORMAL;
> if WorkPath='' then WorkPath:=extractfilepath(path);
>
> if wait
> then begin // wait for the process to end...
> // Check to make{ If the execution file does not exist, then try
> // adding the path, if that fails then you're stuffed }
> if not FileExists(path) then begin
> result := false;
> exit;
> end;
>
> // Concat in the parameters
> exeCmd := path + ' ' + params;
>
> // Initialise the StartUpInfo record, which handles the creation of
>
> // a new main window for a process
> FillChar(startUpInfo, SizeOf(startUpInfo), Chr(0));
> StartUpInfo.cb := SizeOf( StartUpInfo );
> StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
> StartUpInfo.wShowWindow := runmode;
>
> // Spawn the process out.
> if not CreateProcess(
>
>
> nil, PChar(exeCmd), nil, nil, false,
> CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil,
> PChar(ExtractFilePath(path)), startUpInfo, processInfo
> ) then begin
> result := false;
> end;
>
> // Wait for ze old process to finish.
> WaitForSingleObject(processInfo.hProcess, INFINITE);
> end
> else begin
> handle:=ShellExecute(Application.Handle,'open',pchar(path),pchar(params),
> pchar(WorkPath),RunMode);
> end;
> end;
>
>
> Function ExecDOS(Path,Params,WorkPath,Title:String; Wait:Boolean; Minimized:Boolean):Boolean;
> {Just for DOS programs, creates a PIF file then executes it, deleting it afterward.
> Path Full path to the executable
> Params Parameters
> WorkPath Default directory, '' if same path as executable
> Title Title to display at top of window
> Wait TRUE if execution of current program waits until new program finishes
> Minimized TRUE if program is to run minimized.}
> var f:file;
> pifpath:string;
> a:string;
> ierr:integer;
> begin
> if WorkPath='' then WorkPath:=extractfilepath(path);
>
> // this is a generic PIF image that we've hacked to pieces...settings:
> // Idle sensitivity set lowest
> // Default window
> // Exit on terminate
> // All memory resources used if needed
> // Allow screen saver
> // Not dynamic allocation
> a:=#0#120#84#69#83#84#68#79#126#49#32#32#32#32#32#32#32#32#32#32+
> #32#32#32#32#32#32#32#32#32#32#32#32#128#2#0#0#68#58#92#116#101+
> #115#116#100#111#115#112#114#111#103#114#97#109#116#104#105#110+
> #103#46#101#120#101#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#16#0#101#58#92#116#101#109#112+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#45#101#120+
> #32#100#58#92#116#101#115#116#32#100#58#92#42#46#42#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#1#0#255#25#80#0#0#7#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#77#73+
> #67#82#79#83#79#70#84#32#80#73#70#69#88#0#135#1#0#0#113#1#87#73+
> #78#68#79#87#83#32#51#56#54#32#51#46#48#0#5#2#157#1#104#0#128+
> #2#0#0#100#0#50#0#255#255#0#0#255#255#0#0#2#0#2#0#159#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#45#101#120#32#100#58#92#116#101+
> #115#116#32#100#58#92#42#46#42#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#87+
> #73#78#68#79#87#83#32#86#77#77#32#52#46#48#0#255#255#27#2#172+
> #1#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#80#73#70+
> #77#71#82#46#68#76#76#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#2#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#129#0#0#0#0#0#0#0#0#0#0#0#1#0#0#0#5#0#25#0#3#0#200#0+
> #232#3#2#0#10#0#1#0#0#0#0#0#0#0#28#0#0#0#0#0#0#0#8#0#12#0#84#101+
> #114#109#105#110#97#108#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#76#117#99#105#100#97#32#67#111#110#115#111#108#101+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#3#0#0#0#80#0#25#0#128+
> #2#44#1#0#0#0#0#22#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
> #0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#1#0;
> title:=spaces(title,30);
> move(title[1],a[$02+1],30);
>
> if length(path)>63 then path:=copy(path,1,63);
> path:=path+#0;
> move(path[1],a[$24+1],length(path));
>
> if length(params)>63 then params:=copy(params,1,63);
> params:=params+#0;
> move(params[1],a[$a5+1],length(params));
> move(params[1],a[$1c5+1],length(params));
>
> if length(workpath)>63 then workpath:=copy(workpath,1,63);
> workpath:=workpath+#0;
> move(workpath[1],a[$65+1],length(workpath));
>
> if minimized
> then a[$1af+1]:=#$12
> else a[$1af+1]:=#$2;
>
> result:=false; // default unsuccessful
> pifpath:=newfilename(temppath+'00000000.pif',false);
> assignfile(f,pifpath);
> rewrite(f,1);
> ierr:=ioresult;
> blockwrite(f,a[1],length(a),ierr);
> closefile(f);
> if ierr<>length(a) then exit;
> result:=exec(pifpath,'','',wait,0);
> application.processmessages;
> if not wait then delay(1000); // we must wait one second for Windows to read file
> deletefile(pifpath);
> end;
>
>
> 오은미 wrote:
> > 안녕하세여?
> > 전에 글을 올렸다가 많은 도움을 받았었는데여....근데 좀 이상한게 있어서여...
> > CreateProcess를 이용해서 DOS 프로그램을 실행시키는데..
> > StartUpInfomation 구조체에 윈도우 실행히 보이지 않게하는 값을 세팅을
> > 했는데두 불구 하구 도스창에 계속 보이는데 이유가 뭘까여??
> >
> > 궁금...이상....
> >
> > 안보이게 해야 하는데....
> >
> > 갈켜줘여.....
> >
> > 그럼 즐푸....
> >
0
0
삭제
수정
댓글
^^
•
2001.05.29 11:39
오은미 wrote:
> 음 제가 짠 코드는....
>
> 위 생략...
> try
> Screen.Cursor := crHourglass;
> { STARTUPINFO를 설정한다. }
> FillChar(SI, SizeOf(SI), 0);
> SI.cb := SizeOf(TStartUpInfo);
> SI.wShowWindow := SW_HIDE; ===> 요부분....
> SI.dwFlags := STARTF_USESHOWWINDOW;
> { STARTF_USESTDHANDLES 를 빼면 PIPE로 입출력이 Redirect 되지 않는다. }
> SI.dwFlags := SI.dwFlags or STARTF_USESTDHANDLES;
> SI.hStdOutput := hWritePipe;
> SI.hStdError := hWritePipe;
> StrPCopy(CmdLine, Command);
>
> { Process를 생성한다. }
> if CreateProcess(nil, CmdLine, nil, nil, True, NORMAL_PRIORITY_CLASS, nil, nil, SI, PI) then
>
> ......중간 생략....
>
> 컴파일 실행 모두 잘 됩니다...다만 도스창이 뜨는것이 문제지여....
> SI.wShowWindow := SW_HIDE; ==> 요렇게 값을 주면 원래는 안떠야 하는거 아닌가여?
> 음....왜 그런지 모르겠네여....
>
FillChar(SI, SizeOf(SI), 0);
SI.cb := SizeOf(TStartUpInfo);
SI.wShowWindow := SW_HIDE;
SI.dwFlags := SI.dwFlags or STARTF_USESHOWWINDOW; ---- > 요렇게 써주세여
SI.hStdInput := 0;
SI.hStdOutput := 1;
CreateProcess(nil,nCmd, nil, nil, True, NORMAL_PRIORITY_CLASS, nil, nil, SI, PI);
0
0
삭제
수정
댓글
(NOTICE) You must be
logged in
to comment on this post.
오은미
•
2001.05.29 02:10
3
COMMENTS
/
0
LIKES
DOS 프로그램 실행시에 창을 안보이게 하는거......
안녕하세여? 전에 글을 올렸다가 많은 도움을 받았었는데여....근데 좀 이상한게 있어서여... CreateProcess를 이용해서 DOS 프로그램을 실행시키는데.. StartUpInfomation 구조체에 윈도우 실행히 보이지 않게하는 값을 세팅을 했는데두 ...
전진운
•
2001.05.29 02:39
안녕하세요 제가 잘 몰라서 질문의 요지를 잘 모르겠군요 제가 가지고 있는 자료에 이런게 있어서 올립니...
오은미
•
2001.05.29 05:21
음 제가 짠 코드는.... 위 생략... try Screen.Cursor := crHourglass; { STARTUPIN...
^^
•
2001.05.29 11:39
오은미 wrote: > 음 제가 짠 코드는.... > > 위 생략... > try > Screen.Cursor := crHourgl...
델초보자
2001.05.29 02:09
0
COMMENTS
/
0
LIKES
급질문 - 여러개의 data set 받기..
김경미
2001.05.29 01:35
0
COMMENTS
/
0
LIKES
text 필드에 값을 저장하는데.....
hehehey!
2001.05.29 00:23
0
COMMENTS
/
0
LIKES
리스트뷰에 관하여
델초보요
•
2001.05.28 23:44
3
COMMENTS
/
0
LIKES
폼 위에서 키를 인식하는 방법....
마티즈맨
•
2001.05.29 00:34
안녕하세요. 마티즈맨 박재수입니다. 간만에 한델에 왔네요. 음 폼의 키 다운 이벤트를 사용하시면 됩니...
델초보요
•
2001.05.29 01:10
마티즈맨 wrote: > 안녕하세요. > 마티즈맨 박재수입니다. > 간만에 한델에 왔네요. > 음 폼의 키 다운...
나그네
•
2001.05.29 01:39
델초보요 wrote: > 마티즈맨 wrote: > > 안녕하세요. > > 마티즈맨 박재수입니다. > > 간만에 한델에 ...
delcho
2001.05.28 23:35
0
COMMENTS
/
0
LIKES
꼭 좀 부탁합니다.
한휘
2001.05.28 23:04
0
COMMENTS
/
0
LIKES
프로그램에서 아웃룩 실행시킬때...
김성진
2001.05.28 22:51
0
COMMENTS
/
0
LIKES
[급급 질문] stored procedure를 만들어 놓고 데이터 조작하기!!!
왕델초
2001.05.29 00:21
0
COMMENTS
/
0
LIKES
[잘안돼요] 스트링리스트에 체크박스 동적생성
김아성
•
2001.05.28 21:44
1
COMMENTS
/
0
LIKES
레코드형 배열에 관해서...
델맹
•
2001.05.28 21:54
김아성 wrote: > 안녕하세요. ^^; > > 다름이 아니라 레코드형에서 배열을 동적으로 지정해 줄수 있는...
백승환
2001.05.28 21:39
0
COMMENTS
/
0
LIKES
브레이크 포인터가 안 먹는 이유??????
베나..
•
2001.05.28 21:06
4
COMMENTS
/
0
LIKES
DB그리드에서 한컬럼에 두개의 필드값 넣기 ㅠㅠ 그리고 case문..
hobakpa
•
2001.05.29 02:03
베나.. wrote: > 안냐세요. > DB그리드에서 각각의 컬럼에 필드가 하나씩 잡혀 있자나요. > 그런데 그...
베나..
•
2001.05.29 03:48
ㅓ
cell
•
2001.05.29 01:24
단순히 조회만 한다면 편법으로 다음과 같이 해보세요 일단 calculate 필드를 하나 생성하고(table or que...
구름
•
2001.05.28 23:32
필드 가, 필드 나, 필드 다 가와 나의 결합을 다에 필드 나의 적당한 이벤트 예로) exit f...
초보델피언
2001.05.29 02:38
0
COMMENTS
/
0
LIKES
다시 질문 올립니다.(원격부팅)
써니
2001.05.28 21:03
0
COMMENTS
/
0
LIKES
(질문) 다운로드후 삭제하기
서록
2001.05.29 11:01
0
COMMENTS
/
0
LIKES
atom 이나 mutex 의 소유자를 구분할수 있나요?
한용석
2001.05.28 21:00
0
COMMENTS
/
0
LIKES
DBGrid에서 마우스가 있는곳의 데이타를 힌트를 보여줄때.
^^;
2001.05.28 20:38
0
COMMENTS
/
0
LIKES
AdoTable 에서 findkey
초보델맨
•
2001.05.28 20:33
2
COMMENTS
/
0
LIKES
조회한 결과를 출력폼으로 찍을 때 쿼리문을 가져갈 수 있나요?
...
•
2001.05.28 21:04
uses 에 조회폼을 추가 시키고.. 출력폼 dataset을 추가한 조회폼의 쿼리로 지정하면 되죠.. 초보델맨 ...
초보델맨
•
2001.05.28 21:13
님께서 답변해 주셔서 감사합니다. 하지만 제가 워낙 초짜라서 난해한걸요. 좀 구체적이고 자세하게 ...
정원철
2001.05.28 20:12
0
COMMENTS
/
0
LIKES
서로 다른 서버간에 data이동이 실시간으로 가능한가요.
왕초보
2001.05.28 19:58
0
COMMENTS
/
0
LIKES
배포판 만들시 제발 답좀.....
오은미
2001/05/29 02:10
Views
1040
Likes
0
Comments
3
Reports
0
Tag List
수정
삭제
목록으로
한델 로그인 하기
로그인 상태 유지
아직 회원이 아니세요? 가입하세요!
암호를 잊어버리셨나요?
제가 잘 몰라서 질문의 요지를 잘 모르겠군요
제가 가지고 있는 자료에 이런게 있어서 올립니다.
도움이 되실려나 모르겠습니다.
확인도 해보지 않은 function 입니다.
Function Exec(Path,Params,WorkPath:string; Wait:Boolean; Runmode:integer):boolean;
{Path Full path to the executable
Params Parameters
WorkPath Default directory, '' if same path as executable
Wait TRUE if execution of current program waits until new program finishes
RUNMODE How the application is executed (0 for default SHOWNORMAL):
Value Meaning
SW_HIDE Hides the window and activates another window.
SW_MAXIMIZE Maximizes the specified window.
SW_MINIMIZE Minimizes the specified window and activates the
next top-level window in the Z order.
SW_RESTORE Activates and displays the window. If the window
is minimized or maximized, Windows restores it to
its original size and position. An application
should specify this flag when restoring a minimized
window.
SW_SHOW Activates the window and displays it in its current
size and position.
SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified
in the STARTUPINFO structure passed to the CreateProcess
function by the program that started the application. An
application should call ShowWindow with this flag to set
the initial show state of its main window.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active
window remains active.
SW_SHOWNA Displays the window in its current state. The active
window remains active.
SW_SHOWNOACTIVATE Displays a window in its most recent size and position.
The active window remains active.
SW_SHOWNORMAL Activates and displays a window. If the window is minimized
or maximized, Windows restores it to its original size and
position. An application should specify this flag when
displaying the window for the first time.}
var name:string;
handle:integer;
startUpInfo : TStartupInfo;
processInfo : TProcessInformation;
exeCmd : string;
begin
if Runmode=0 then Runmode:=SW_SHOWNORMAL;
if WorkPath='' then WorkPath:=extractfilepath(path);
if wait
then begin // wait for the process to end...
// Check to make{ If the execution file does not exist, then try
// adding the path, if that fails then you're stuffed }
if not FileExists(path) then begin
result := false;
exit;
end;
// Concat in the parameters
exeCmd := path + ' ' + params;
// Initialise the StartUpInfo record, which handles the creation of
// a new main window for a process
FillChar(startUpInfo, SizeOf(startUpInfo), Chr(0));
StartUpInfo.cb := SizeOf( StartUpInfo );
StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow := runmode;
// Spawn the process out.
if not CreateProcess(
nil, PChar(exeCmd), nil, nil, false,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil,
PChar(ExtractFilePath(path)), startUpInfo, processInfo
) then begin
result := false;
end;
// Wait for ze old process to finish.
WaitForSingleObject(processInfo.hProcess, INFINITE);
end
else begin
handle:=ShellExecute(Application.Handle,'open',pchar(path),pchar(params),
pchar(WorkPath),RunMode);
end;
end;
Function ExecDOS(Path,Params,WorkPath,Title:String; Wait:Boolean; Minimized:Boolean):Boolean;
{Just for DOS programs, creates a PIF file then executes it, deleting it afterward.
Path Full path to the executable
Params Parameters
WorkPath Default directory, '' if same path as executable
Title Title to display at top of window
Wait TRUE if execution of current program waits until new program finishes
Minimized TRUE if program is to run minimized.}
var f:file;
pifpath:string;
a:string;
ierr:integer;
begin
if WorkPath='' then WorkPath:=extractfilepath(path);
// this is a generic PIF image that we've hacked to pieces...settings:
// Idle sensitivity set lowest
// Default window
// Exit on terminate
// All memory resources used if needed
// Allow screen saver
// Not dynamic allocation
a:=#0#120#84#69#83#84#68#79#126#49#32#32#32#32#32#32#32#32#32#32+
#32#32#32#32#32#32#32#32#32#32#32#32#128#2#0#0#68#58#92#116#101+
#115#116#100#111#115#112#114#111#103#114#97#109#116#104#105#110+
#103#46#101#120#101#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#16#0#101#58#92#116#101#109#112+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#45#101#120+
#32#100#58#92#116#101#115#116#32#100#58#92#42#46#42#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#1#0#255#25#80#0#0#7#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#77#73+
#67#82#79#83#79#70#84#32#80#73#70#69#88#0#135#1#0#0#113#1#87#73+
#78#68#79#87#83#32#51#56#54#32#51#46#48#0#5#2#157#1#104#0#128+
#2#0#0#100#0#50#0#255#255#0#0#255#255#0#0#2#0#2#0#159#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#45#101#120#32#100#58#92#116#101+
#115#116#32#100#58#92#42#46#42#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#87+
#73#78#68#79#87#83#32#86#77#77#32#52#46#48#0#255#255#27#2#172+
#1#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#80#73#70+
#77#71#82#46#68#76#76#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#2#0#0#0#0#0#0#0#0#0+
#0#0#0#0#129#0#0#0#0#0#0#0#0#0#0#0#1#0#0#0#5#0#25#0#3#0#200#0+
#232#3#2#0#10#0#1#0#0#0#0#0#0#0#28#0#0#0#0#0#0#0#8#0#12#0#84#101+
#114#109#105#110#97#108#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#76#117#99#105#100#97#32#67#111#110#115#111#108#101+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#3#0#0#0#80#0#25#0#128+
#2#44#1#0#0#0#0#22#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0+
#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#1#0;
title:=spaces(title,30);
move(title[1],a[$02+1],30);
if length(path)>63 then path:=copy(path,1,63);
path:=path+#0;
move(path[1],a[$24+1],length(path));
if length(params)>63 then params:=copy(params,1,63);
params:=params+#0;
move(params[1],a[$a5+1],length(params));
move(params[1],a[$1c5+1],length(params));
if length(workpath)>63 then workpath:=copy(workpath,1,63);
workpath:=workpath+#0;
move(workpath[1],a[$65+1],length(workpath));
if minimized
then a[$1af+1]:=#$12
else a[$1af+1]:=#$2;
result:=false; // default unsuccessful
pifpath:=newfilename(temppath+'00000000.pif',false);
assignfile(f,pifpath);
rewrite(f,1);
ierr:=ioresult;
blockwrite(f,a[1],length(a),ierr);
closefile(f);
if ierr<>length(a) then exit;
result:=exec(pifpath,'','',wait,0);
application.processmessages;
if not wait then delay(1000); // we must wait one second for Windows to read file
deletefile(pifpath);
end;
오은미 wrote:
> 안녕하세여?
> 전에 글을 올렸다가 많은 도움을 받았었는데여....근데 좀 이상한게 있어서여...
> CreateProcess를 이용해서 DOS 프로그램을 실행시키는데..
> StartUpInfomation 구조체에 윈도우 실행히 보이지 않게하는 값을 세팅을
> 했는데두 불구 하구 도스창에 계속 보이는데 이유가 뭘까여??
>
> 궁금...이상....
>
> 안보이게 해야 하는데....
>
> 갈켜줘여.....
>
> 그럼 즐푸....
>