|
-
Oct 6th, 2000, 04:27 AM
#1
Thread Starter
Fanatic Member
Hi everyone
I have a main form which loads a crystal reports preview form.
I want to be able to set the main form to fall behind the reports preview form after it is loaded.
Can anybody help
Thanks
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Oct 6th, 2000, 06:05 AM
#2
_______
<?>
Code:
'How to set a form as bottom of the order and keep it there
'using subClassing
'
'I didn't write this it was handed over to me..I tried it out
'and it does seem to do the trick..however you must end it by
'using dblClick on form..if you use the stop key in VB it will
'crash....so it must be unloaded via code
'bas module code
Public Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" _
Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_PAINT = &HF
Public Const WM_ACTIVATE = &H6
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const HWND_BOTTOM = 1
Public winProc As Long
Public Function WindowProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim lFlags As Long
lFlags = SWP_NOSIZE Or SWP_NOMOVE
Select Case wMsg
Case WM_ACTIVATE
SetWindowPos hwnd, HWND_BOTTOM, 0, 0, 0, 0, lFlags
Case Else
WindowProc = CallWindowProc(winProc, hwnd, wMsg, wParam, lParam)
Exit Function
End Select
End Function
Public Sub SubClass(hwnd As Long)
On Error Resume Next
winProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Sub UnSubClass(hwnd As Long)
If winProc Then
SetWindowLong hwnd, GWL_WNDPROC, winProc
winProc = 0
End If
End Sub
'Form Event Code
Private Sub Form_Activate()
Me.ClipControls = False
Me.BorderStyle = 0
Me.Caption = ""
Me.Refresh
End Sub
Private Sub Form_DblClick()
UnSubClass Me.hwnd
Unload Me
End Sub
Private Sub Form_Load()
SubClass Me.hwnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnSubClass Me.hwnd
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 6th, 2000, 07:48 AM
#3
Thread Starter
Fanatic Member
Thanks HeSaidJoe
I'll try that
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

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
|