BLOG main image
분류 전체보기 (65)
JSP (6)
Android (1)
ASP.NET (0)
MSSQL (4)
PHP (18)
ASP (11)
오픈 API (1)
HTML (2)
JavaScript (0)
Windows Programming (8)
컴퓨터교양 (14)
객체 지향 (0)
리뷰 및 생각 (0)
Visitors up to today!
Today hit, Yesterday hit
daisy rss
tistory 티스토리 가입하기!
2010. 9. 13. 02:51

ShellExecute()는 윈도우쉘 명령을 실행시킬 때 쓰는 함수이다.
내가 사용하는 용도는 두가지이다.
한가지는 탐색기를 열 때(지정한 폴더로 이동시키는 것 까지),
나머지 한가지는 파일(윈도우즈 확장자 연결 프로그램으로 등록된 확장자를 가진 파일)을 열 때 이다.

먼저 탐색기를 여는 방법이다.
ShellExecute(0, 'explore', PChar(descDir), nil, nil, SW_SHOWNORMAL);

다음으로 파일을 열 때 이다.
var
  fileFullPath : String;
  errCode : Cardinal;

begin
    errCode := ShellExecute(handle, 'open', Pchar(fileFullPath) , nil, nil, SW_SHOW);
    if errCode = 31 then ShowMessage('HWP가 설치되어 있지 않습니다'); //실행화일 없을때
    if errCode = 2 then ShowMessage('파일이 존재하지 않습니다');      //파일 없을때
end;