|
-
May 13th, 2001, 06:16 AM
#1
Progressbar Problem (api)
hi,
i have created a progress bar via api (don't want to redistrubt the ocx...)
in the design-enviroment the progress abr works fine, but if i compile my code the progress bar will not be created. don't know why *argh*
here is the code for the pgb:
Code:
Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function GetLastError Lib "kernel32" () As Long
Public Declare Function CreateWindowEX Lib "user32" _
Alias "CreateWindowExA" (ByVal dwExStyle As Long, _
ByVal lpClassName As String, _
ByVal lpWindowName As String, _
ByVal dwStyle As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hwndparent As Long, _
ByVal hMenu As Long, _
ByVal hInstance As Long, lpParam As Any) As Long
Public Declare Function DestroyWindow Lib "user32" _
(ByVal hWnd As Long) As Long
Public Declare Function MoveWindow Lib "user32" _
(ByVal hWnd As Long, ByVal X As Long, _
ByVal Y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Public Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Public Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
'// Progess bar class name
Public Const PROGRESS_CLASS = "msctls_progress32"
'// Windows Messages and styles
Public Const WM_USER = &H400
Public Const WS_VISIBLE = &H10000000
Public Const WS_CHILD = &H40000000
Public Const PBS_SMOOTH = &H1
Public Const PBS_VERTICAL = &H4
Public Const PBM_SETRANGE = (WM_USER + 1)
Public Const PBM_SETPOS = (WM_USER + 2)
Public Const PBM_DELTAPOS = (WM_USER + 3)
Public Const PBM_SETSTEP = (WM_USER + 4)
Public Const PBM_STEPIT = (WM_USER + 5)
Public Const PBM_SETRANGE32 = (WM_USER + 6)
Public Const PBM_GETRANGE = (WM_USER + 7)
Public Const PBM_GETPOS = (WM_USER + 8)
Public Const PBM_SETBARCOLOR = (WM_USER + 9)
Public Sub SetMinMax(hWnd As Long, iLowLim As Integer, iHighLim As Integer)
Debug.Print SendMessage(hWnd, PBM_SETRANGE, iLowLim, iHighLim)
End Sub
Public Sub DestroyPGB(hWnd As Long)
DestroyWindow hWnd
End Sub
Public Sub StepPGB(hWnd As Long)
Dim old As Long
Debug.Print SendMessage(hWnd, mdlProgBar.PBM_DELTAPOS, 1, 0)
End Sub
Function CreateProgress(Vertical As Boolean, hwndparent As Long, X As Long, Y As Long, lngheight As Long, lngwidth As Long) As Long
Dim lngType As Long
Dim LNGHWND As Long
If Vertical = True Then
lngType = PBS_VERTICAL
Else
lngType = 0
End If
LNGHWND = CreateWindowEX(0, PROGRESS_CLASS, vbNullString, WS_VISIBLE _
Or WS_CHILD Or lngType, 0, 0, 0, 0, hwndparent, _
0, App.hInstance, ByVal 0)
MoveWindow LNGHWND, X, Y, lngwidth, lngheight, True
CreateProgress = LNGHWND
End Function
thx for help,
taLON
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|