2. When i run the program i have a message box that comes up saying Installation Complete. I want it to come up once the progress bar finish's but right now its comming up right when you hit install.
Does anyone know how to fix this? Here is my code for it:
static HWND hwndPrgBar;
static int i = 1;
static char *Title = TEXT(" Database FX Installer \n\
Developed By: MacKenzie Whipp");
INITCOMMONCONTROLSEX InitCtrlEx;
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrlEx.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&InitCtrlEx);
enum{ID_CREATE_SHORTCUT, ID_TITLE, ID_PROGRESS, ID_INSTALL };
switch(msg)
{
case WM_CREATE:
HWND hInstallButton;
int idInstallButton;
hInstallButton = CreateWindow(TEXT("button"), TEXT("Create Shortcut"),
WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
20, 125, 185, 35,
hwnd, (HMENU) ID_CREATE_SHORTCUT, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
idInstallButton = GetDlgCtrlID(hInstallButton);
CheckDlgButton(hwnd, ID_CREATE_SHORTCUT, BST_UNCHECKED);
CreateWindow(TEXT("STATIC"), Title, WS_CHILD | WS_VISIBLE | SS_LEFT, 50, 20, 300, 230, hwnd, NULL, NULL, NULL);
hwndPrgBar = CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, 50, 100, 190, 25, hwnd, NULL, g_hinst, NULL);
CreateWindow(TEXT("button"), TEXT("Install"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 100, 70, 80, 25, hwnd, (HMENU) ID_INSTALL, g_hinst, NULL);
SendMessage(hwndPrgBar, PBM_SETRANGE, 0, MAKELPARAM(0, 150));
SendMessage(hwndPrgBar, PBM_SETSTEP, 1, 0 );
break;
case WM_TIMER:
SendMessage( hwndPrgBar, PBM_STEPIT, 0, 0 );
i++;
if ( i == 150 )
KillTimer(hwnd, ID_TIMER);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_CREATE_SHORTCUT:
{
if(IsDlgButtonChecked(hwnd, ID_CREATE_SHORTCUT) == BST_CHECKED)
{
//CREATE SHORTCUT IF CHECKED
}
else
{
//dont
}
break;
}
break;
case ID_INSTALL:
{
i = 1;
SendMessage( hwndPrgBar, PBM_SETPOS, 0, 0 );
SetTimer(hwnd, ID_TIMER, 5, NULL);
mkdir("C:\\Program Files (x86)\\Database FX");
CopyFile("F:\\Computer Programming\\Database\\Database_FX.exe", "C:\\Program Files (x86)\\Database FX\\Database_FX.exe", TRUE);
MessageBox(0,"Installation Successful", "Installation Complete", MB_OK );
PostQuitMessage(0);
}
}
break;
case WM_DESTROY:
KillTimer(hwnd, ID_TIMER);
PostQuitMessage(0);
break;
}

New Topic/Question
Reply



MultiQuote




|