6 Replies - 180 Views - Last Post: 08 February 2012 - 04:57 PM Rate Topic: -----

Topic Sponsor:

#1 mackdaman  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: 11-November 09

Windows Installer

Posted 07 February 2012 - 08:16 PM

Okay so im trying to make a installer for my program and everything works great other then the fact of 2 things. 1. When ever i run the installer where the checkbox "Create Shortcut" is there you can only see "Cr" but when u hit the checkbox and then hit the install button the whole "create shortcut" shows up?
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; 
      
  }


Is This A Good Question/Topic? 0
  • +

Replies To: Windows Installer

#2 #define  Icon User is offline

  • Programmer
  • member icon

Reputation: 565
  • View blog
  • Posts: 2,084
  • Joined: 19-February 09

Re: Windows Installer

Posted 08 February 2012 - 11:44 AM

You want the message box to appear after the timer has finished. So move it and the post quit message to the section the timer finishes.
Was This Post Helpful? 0
  • +
  • -

#3 mackdaman  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: 11-November 09

Re: Windows Installer

Posted 08 February 2012 - 03:52 PM

could you show me where in the code to do this?
Was This Post Helpful? 0
  • +
  • -

#4 #define  Icon User is offline

  • Programmer
  • member icon

Reputation: 565
  • View blog
  • Posts: 2,084
  • Joined: 19-February 09

Re: Windows Installer

Posted 08 February 2012 - 04:13 PM

You could try moving this code

  MessageBox(0, "Installation Successful", 
             "Installation Complete", MB_OK );
  PostQuitMessage(0);




into the if block that halts the timer

41    if ( i == 150 ) 
      {
42      KillTimer(hwnd, ID_TIMER);
        // add here?
      }
43    break;


Was This Post Helpful? 0
  • +
  • -

#5 mackdaman  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: 11-November 09

Re: Windows Installer

Posted 08 February 2012 - 04:30 PM

Okay great thankz ! that fixed that problem ! what about the one where it only shows the "cr" of create shortcut? im not sure how to fix that.
Was This Post Helpful? 0
  • +
  • -

#6 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon

Reputation: 314
  • View blog
  • Posts: 902
  • Joined: 28-March 11

Re: Windows Installer

Posted 08 February 2012 - 04:46 PM

Your button is UNDER your static control so it comes to front when you select it.

Static left = 50 (so you only see "cr")
Button left = 20

button top = 125
Static top = 20 + static height = 230!!!!! Your static control is painting into the button, change the static height to see the whole button text

This post has been edited by GunnerInc: 08 February 2012 - 04:47 PM

Was This Post Helpful? 0
  • +
  • -

#7 mackdaman  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 120
  • Joined: 11-November 09

Re: Windows Installer

Posted 08 February 2012 - 04:57 PM

omg i feel stupid -.- thank you !

One last question: Does anyone know a good tut on how to create a shortcut of a file? I want my program to create a shortcut on the desktop but im not sure how to.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1