본문 바로가기
개발/mfc

MFC, 외부 프로그램 실행 예제 ShellExecute

by 즐기며 2025. 9. 12.

ShellExecute() 을 이용한 외부 프로그램 실행 방법 입니다.

 

1. ini 파일 수정 하는 메모장 띄우는 거 입니다.

void CDlg_main::OnBnClickedmButEdini()
{
	CString fn,
	   strExeFileName = _T("notepad.exe");

	fn.Format(_T("%s.ini"), pDlgini->getExePathName()  );	//		AfxMessageBox(fn);
	HINSTANCE hErr = ShellExecute(NULL, _T("open"), strExeFileName, fn, NULL, SW_SHOW);
}

 

 

 

2.  browser 띄우기

ShellExecute(NULL,
    _T("open"),
    _T("iexplore"),			// 또는 _T("chrome")
    _T("https://bahk33.tistory.com/238"), //주소
    NULL,
    SW_SHOW);