Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA & API - Strange problem using
Hi all,
I have a 'Please wait' form that shows a progress bar, and messages to the user. I am using the below code to hide the title-bar on window Initialise: CODE Private Sub UserForm_Initialize() lFrmHdl = FindWindowA(vbNullString, Me.Caption) ShowTitleBar False Me.Show vbModeless End Sub Public Function ShowTitleBar(ByVal bState As Boolean) Dim lStyle As Long Dim tR As RECT '// Get the window's position: GetWindowRect lFrmHdl, tR '// Modify whether title bar will be visible: lStyle = GetWindowLong(lFrmHdl, GWL_STYLE) ' If Not bState Then lStyle = lStyle And Not WS_SYSMENU lStyle = lStyle And Not WS_MAXIMIZEBOX lStyle = lStyle And Not WS_MINIMIZEBOX lStyle = lStyle And Not WS_CAPTION blnTitleVisible = True Else lStyle = lStyle Or WS_SYSMENU lStyle = lStyle Or WS_MAXIMIZEBOX lStyle = lStyle Or WS_MINIMIZEBOX lStyle = lStyle Or WS_CAPTION blnTitleVisible = False End If SetWindowLong lFrmHdl, GWL_STYLE, lStyle '// Ensure the style takes and make the window the '// same size, regardless that the title bar '// is now a different size: SetWindowPos lFrmHdl, 0, tR.Left, tR.Top, tR.Right - tR.Left, tR.Bottom - tR.Top, _ SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED End Function <<< END CODE <<<< My problem is, somewhere there must be a memory leak or something because I get an 'The object invoked has disconnected from it's clients' error followed by a crash of Excel... The strange thing is, this all works fine with my splash form, it's just with the wait form that runs during the macro that there is a problem. Is there anyway to ignore that error? thanks Philip |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
strange problem | Excel Discussion (Misc queries) | |||
Strange Problem | Excel Discussion (Misc queries) | |||
Strange Problem... | Excel Discussion (Misc queries) | |||
strange problem subtotal | Excel Programming | |||
Strange problem | Excel Programming |