안녕하세요.... 댁스터입니다...
외부 실행파일을 자신의 프로그램에서 실행시킬기 위해 ShellExecute()라는
API함수를 사용할 수 있습니다...
HINSTANCE ShellExecute(
HWND hwnd, // handle to parent window
LPCTSTR lpOperation, // pointer to string that specifies operation to perform
LPCTSTR lpFile, // pointer to filename string
LPTSTR lpParameters, // pointer to string that specifies executable-file parameters
LPCTSTR lpDirectory, // pointer to string that specifies default directory
INT nShowCmd // whether file is shown when opened
);
글자가 밀렸군.... 암튼 도움말에 있는 내용을 그대로 올렸습니다..
주석이 있으니까 각 인자들이 무슨 역할을 하는 지는 알 수 있을 껍니다..
자세한 내용은 도움말에 보면 아주 자세히 나옵니다..
간단한 예제입니다...
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', 'notepad', nil, nil, SW_SHOW);
end;
요렇게 하시면 메모장이 뜹니다.... 여기서 'notepad'에는 실행파일이 있는 경로
를 써주셔야 합니다... notepad는 윈도우 디렉토리에 있는 실행파일이기에 path가
잡혀 있어서 기냥해도 실행이 되지만...
참 ShellExecute()함수를 사용하기 위해서는 uses절에 ShellAPI를 추가해야 에러가
안납니다...델파이에서는 ShellAPI라는 유닛에 요함수가 정의 되어 있습니다..
그럼 참고가 되셨길....
THEXDER
|