void __fastcall TForm2::Button1Click(TObject *Sender)
{
ShellExecute(NULL,String("open").c_str(),String("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe").c_str(),String(" http://www.naver.com/").c_str(),NULL,SW_SHOW);
}
이렇게 해 보세요.
린포스 님이 쓰신 글 :
: 학교 과제로 C++ 빌더를 시작하게된 학생입니다.
:
: 다름이 아니라 버튼을 누르면 크롬을 켜서 네이버를 켜지도록 만들기 위해 ShellExecute 함수를 사용하게 되었습니다.
:
: 다음이 버튼에 넣은 프로그램문입니다.
:
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
: ShellExecute(NULL,"open","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"," http://www.naver.com/",NULL,SW_SHOW);
: }
:
: 그리고 위에 프로그램문을 빌드를 하면 다음의 두 에러가 뜹니다.
:
: [bcc32 Error] Unit1.cpp(19): E2034 Cannot convert 'char const[5]' to 'const wchar_t *'
: [bcc32 Error] Unit1.cpp(19): E2342 Type mismatch in parameter 'lpOperation' (wanted 'const wchar_t *', got 'const char *')
:
: 제가 뭔가 잘못 적은 것이 있나요?? 무엇이 잘못되었는지 가르쳐주셨으면 합니다.
|