|
-
Jul 8th, 2005, 12:31 PM
#1
Thread Starter
Addicted Member
[RESOLVED] add buttons to toolbar in datareport?
I need to export my report to excel. This part is done. My end users want to use the toolbar on the datareport to access the export feature. Can I gain access to the datareport toolbar through some hard to find api or anything?
Other alternatives are welcomed, but I will tell you that they want to view the report before the export is done. Also, my supervisor is against working in reverse. Closing the datareport to click on another export button is what he considers working backwords. Yes, its odd.
Throw your ideas at me and this is my first post so welcome me. 4 years programming in vb. Not a .Net fan. No Crystal Reports.
-
Jul 8th, 2005, 03:58 PM
#2
Re: add buttons to toolbar in datareport?
Welcome...
You will need to subclass the datareport in order to capture the button click events (which is beyond me).
This procedure (found on google) will remove the buttons from the data report toolbar, allowing you to implement your own. Call this routine after you Show the report. The Doevents is necessary as it gives the report time to load.
DataReport1.Show
DoEvents 'or use a Timer
DisableDataReportToolbarButtons DataReport1.Caption
VB Code:
'in a module
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Public Sub DisableDataReportToolbarButtons(ReportFormCaption As String)
Dim tmpHWnd As Long
Dim MainHWnd As Long
Dim ExportHwnd As Long
Dim PrintHWnd As Long
'Drill down window handle "tree" to the toolbar buttons
tmpHWnd = FindWindow(vbNullString, ReportFormCaption)
tmpHWnd = GetWindow(tmpHWnd, GW_CHILD)
tmpHWnd = GetWindow(tmpHWnd, GW_CHILD)
tmpHWnd = GetWindow(tmpHWnd, GW_CHILD)
'Get Print and Export buttons' handles
PrintHWnd = GetWindow(tmpHWnd, GW_CHILD)
ExportHwnd = GetWindow(PrintHWnd, GW_HWNDNEXT)
'Call API to hide the buttons
ShowWindow PrintHWnd, 0&
ShowWindow ExportHwnd, 0&
End Sub
-
Jul 8th, 2005, 09:36 PM
#3
Re: add buttons to toolbar in datareport?
Welcome to VBF!
Or make it MDI Child and use an MDIForm for the Toolbar.
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
|