Code:
void TMainWindow::CMFileInput()
{
char s[MaxBuffer];
char dir[128];
strcpy(dir, "MD C:\\");
strcpy(s, "User Name");
TInputDialog* pDlg;
pDlg = new TInputDialog(this, "Find User","Enter Name of User",
s, sizeof(s));
if (pDlg->Execute() == IDOK) {
strcat(dir, s);
ofstream a_file("C:\\example.bat", ios::trunc );
a_file<<dir;
a_file.close();
int WINAPI WinMain(HINSTANCE h1, HINSTANCE h2, LPSTR s, int i);
{
ShellExecute(
GetDesktopWindow(),
NULL,
getenv("COMSPEC"),
" /C example.bat",
"c:\\",
SW_HIDE);
}
HINSTANCE heh;
heh = ShellExecute(NULL,"open", NULL, NULL, "C:\\" ,SW_SHOWNORMAL);
}
}
Why is your WinMain inside your TMainWindow::CMFileInput() function? Plus it has a semicolon after the declaration, which is odd. If it was me, I would remove these lines:
int WINAPI WinMain(HINSTANCE h1, HINSTANCE h2, LPSTR s, int i);
{
and one of the closing braces at the end of the function.