Progress bar in setup app

I created a custom activity for my installation project and successfully implemented a form that displays a progress bar for the download phase in my installation (I am using WebClient in my custom activity code). So I have two questions that relate to each other.

  • Is there a way to show the loading progress bar in the main customization window rather than create a separate form that I show how I did it? I would prefer that.

  • If not, what can I do to get my form to appear in front of the actual docker when I call form.ShowDialog ()? I also call BringToFront () which doesn't work either. It is there, but it is always located outside the main settings window. There seems to be some way to get the z-order correct.

Thank you for your help.

+2


source to share


2 answers


So, I gave up on the idea of ​​integrating the progress bar into the actual installer screen, but it's just ridiculous what it takes for the Windows Form to appear on top. I need to go to the installer window and send it to the background, because casting the progress bar window just won't work. I switched to Mac development now, so going back to that is just frustrating. I remember that C # .NET was pretty cool. He hasn't gotten ANYTHING on Cocoa / Objective-C.

It pisses me off by calling the BringToFront () method, which simply ignores you. Why do I have to dump the Windows API code to do something fundamental to the GUI like the Z-Order control? Z-Order? Seriously?

In case you're wondering, here's what I did (via google):



[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern bool SetWindowPos(
      IntPtr hWnd, // window handle
      IntPtr hWndInsertAfter, // placement-order handle
      int X, // horizontal position
      int Y, // vertical position
      int cx, // width
      int cy, // height
      uint uFlags); // window positioning flags

public const uint SWP_NOSIZE = 0x1;
public const uint SWP_NOMOVE = 0x2;
public const uint SWP_SHOWWINDOW = 0x40;
public const uint SWP_NOACTIVATE = 0x10;

[DllImport("user32.dll", EntryPoint = "GetWindow")]
public static extern IntPtr GetWindow(
      IntPtr hWnd,
      uint wCmd);

public const uint GW_HWNDFIRST = 0;
public const uint GW_HWNDLAST = 1;
public const uint GW_HWNDNEXT = 2;
public const uint GW_HWNDPREV = 3;

public static void ControlSendToBack(IntPtr control)
{
    bool s = SetWindowPos(
          control,
          GetWindow(control, GW_HWNDLAST),
          0, 0, 0, 0,
          SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
}

      

I get the handle to the installer window and then call ControlSendToBack (). It works, but it sends it back. I tried another method that would just send it back one position, but that didn't work either. Windows programming is as good as it was in 1995. Cool.

0


source


Another way to do this is to use BackgroundWorker. You let the background worker handle the file upload so that it doesn't prevent the UI from updating.



See this link on donnetperls

0


source







All Articles