jblaox
چهارشنبه 19 تیر 1392, 02:08 صبح
سلام
توجه : فرمت ذخیره فایل cpp به صورت utf-8 است .
من کد زیر برای اجرای برنامه به کار میبرم اما به ورودی آدرس گیر میده :
#include <windows.h>
char szPath[] = "C:\\WINDOWS\\system32\\Calc.exe";
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
szPath, //Path to program
NULL, //Parameters
NULL, //Default directory
SW_SHOW); //How to open
مشکل همون خط اول که گیر میده به آدرس فایل و خطا این است :
error : argument of type "char *" is incompatible with parameter of type "LPCWSTR={const WCHAR={__wchar_t} *}" (Intel C++ 13.0)
البته وقتی اینگونه مینویسم اجرا میشود ، اما آدرس فایل اجرای من متغییر و نه مثل اینجا ثابت !
char szPath[] = "C:\\WINDOWS\\system32\\Calc.exe";
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
_T("open"), //Operation to perform
_T("C:\\WINDOWS\\system32\\Calc.exe"), //Path to program
NULL, //Parameters
NULL, //Default directory
SW_SHOW); //How to open
چه کنم حالا ؟؟
توجه : فرمت ذخیره فایل cpp به صورت utf-8 است .
من کد زیر برای اجرای برنامه به کار میبرم اما به ورودی آدرس گیر میده :
#include <windows.h>
char szPath[] = "C:\\WINDOWS\\system32\\Calc.exe";
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
szPath, //Path to program
NULL, //Parameters
NULL, //Default directory
SW_SHOW); //How to open
مشکل همون خط اول که گیر میده به آدرس فایل و خطا این است :
error : argument of type "char *" is incompatible with parameter of type "LPCWSTR={const WCHAR={__wchar_t} *}" (Intel C++ 13.0)
البته وقتی اینگونه مینویسم اجرا میشود ، اما آدرس فایل اجرای من متغییر و نه مثل اینجا ثابت !
char szPath[] = "C:\\WINDOWS\\system32\\Calc.exe";
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
_T("open"), //Operation to perform
_T("C:\\WINDOWS\\system32\\Calc.exe"), //Path to program
NULL, //Parameters
NULL, //Default directory
SW_SHOW); //How to open
چه کنم حالا ؟؟