WinQueryDlgItemText((HWND)parm,IF_DEST,200,destdir); // Extract the destination path
if (strlen(destdir) == 0)
{ WinMessageBox(HWND_DESKTOP,(HWND)parm,"You must provide a destination directory","Attention",0,MB_OK | MB_ICONQUESTION | MB_MOVEABLE);
installing = FALSE;
installed = FALSE;
setButtons((HWND)parm);
WinDestroyMsgQueue(mhmq);
WinTerminate(rhab);
DosExit(0,0);
}
if (destdir[strlen(destdir)-1] == '\\') destdir[strlen(destdir)-1] = 0;
if (DosSetCurrentDir(destdir) != NO_ERROR)
{
if (WinMessageBox(HWND_DESKTOP,(HWND)parm,"Destination directory doesn't exist, should I create it ?","Attention",0,MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE) != MBID_YES)
{
installing = FALSE;
installed = FALSE;
setButtons((HWND)parm);
WinDestroyMsgQueue(mhmq);
WinTerminate(rhab);
DosExit(0,0);
}
strcpy(szArg,destdir);
if (!PathCreate(szArg))
{
WinMessageBox(HWND_DESKTOP,(HWND)parm,"I've got an error while creating the destination directory","Error",0,MB_OK | MB_ICONASTERISK | MB_MOVEABLE);
case WM_CLOSE : if (installing) return((MPARAM) 0); // Don't close if installing
if (installed) return(WinDefDlgProc(wnd,msg,mp1,mp2)); // If installed don't ask for exit confirmation
if (WinMessageBox(HWND_DESKTOP,wnd,"Are you sure you want to quit VClassed's Install?","Confirm",0,MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE) == MBID_YES)
{ return(WinDefDlgProc(wnd,msg,mp1,mp2)); }
else
{ return((MPARAM) 0); }
case WM_DESTROY :
return(0);
default:
return(WinDefDlgProc(wnd,msg,mp1,mp2));
}
}
void main(int argc, char *argv[])
{
HAB mhab;
HMQ mhmq;
HPOINTER icon;
RECTL mrect;
HWND dlgwnd;
char *c;
/* Startup */
mhab = WinInitialize(0);
mhmq = WinCreateMsgQueue(mhab,0);
strcpy(programpath,argv[0]);
if ((c = strrchr(programpath,'\\')) != NULL)
{ c++;
*c = 0;
}
/* Main block */
icon = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,1); // Load pointer for Main dialog
dlgwnd = WinLoadDlg(HWND_DESKTOP,HWND_DESKTOP,&InstProc,NULLHANDLE, DLG_INSTALLVCLASSED,NULL); // Load main dialog
WinSendMsg(dlgwnd,WM_SETICON,(MPARAM) icon,0); // Set new dialog icon