Progressbar in Statusbar in MDI

How can I put a Progressbar in a Statusbar in a MDI-Main-Form.

If I use the code

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

SetParent ProgressBar.hwnd, StatusBar.hwnd
ProgressBar.Top = Screen.TwipsPerPixelY
ProgressBar.Left = StatusBar.Panels(2).Left + Screen.TwipsPerPixelY
    ProgressBar.Height = StatusBar.Height - Screen.TwipsPerPixelY * 2
    ProgressBar.Width = StatusBar.Panels(2).Width - Screen.TwipsPerPixelX * 2

I can set the Left and Width property.
Is there a way to do this?
Thanks for your help.

Peter Zimmerli
Who is Participating?
przemekConnect With a Mentor Commented:
1) Forget about API.
2) Put PictureBox on MDIForm
Set propery Align = Bottom
3) Put StatusBar on PrictureBox
4) Put ProgressBar on PictureBox over StatusBar ( use Bring to Front ).
   Container of StatusBar and ProgressBar is PrictureBox

Or copy this to Form1.frm and add it to some project
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.MDIForm MDIForm1
   BackColor       =   &H8000000C&
   Caption         =   "MDIForm1"
   ClientHeight    =   3195
   ClientLeft      =   3930
   ClientTop       =   3255
   ClientWidth     =   6585
   LinkTopic       =   "MDIForm1"
   Begin VB.PictureBox Picture1
      Align           =   2  'Align Bottom
      BorderStyle     =   0  'None
      Height          =   615
      Left            =   0
      ScaleHeight     =   615
      ScaleWidth      =   6585
      TabIndex        =   0
      Top             =   2580
      Width           =   6585
      Begin MSComctlLib.ProgressBar ProgressBar1
         Height          =   375
         Left            =   120
         TabIndex        =   2
         Top             =   120
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         _Version        =   393216
         Appearance      =   1
      Begin MSComctlLib.StatusBar StatusBar1
         Height          =   615
         Left            =   0
         TabIndex        =   1
         Top             =   0
         Width           =   4335
         _ExtentX        =   7646
         _ExtentY        =   1085
         _Version        =   393216
         BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
            NumPanels       =   1
            BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

ZimmerliAuthor Commented:
Sorry I mean I can not set the Left and Width property.
You should be multiplying by the Screen.TwipsPerPixel instead of ADDING.

I have code to a smooth progress bar on my web page you can easily modify for this. It's in the Code Snippets section at:

Check it out!


ZimmerliAuthor Commented:
I look in our Home Page. There are very good things there.
(But I don't found a solution for my problem)

If I will set the Progress bar left property I get this

Error 387 was generated by ProgramName 'Left' property can't be set on this control

I think the problem is that the Progressbar is on a MDImainForm.

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects that and the expert will now receive these points, all verified.

Please click on your Member Profile, select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.
Moderator @ Experts Exchange
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.