Hi,
Does anybody have examples on how to make win32 APIs calls for common dialogs (I am trying to open the Print Dialog). My code compiles but does not display the dialog or return an error. I think the problem I am having is returning the handle to the current window. I make the Powerplay application active and the getforgroundwindow call returns a number, but I do not think I am doing it properly. Some example code would be GREAT
Here is what I have so far:
Type PRINTDLGS
lStructSize As Long
hwndOwner As Long
hDevMode As Long
hDevNames As Long
hDC As Long
flags As Long
nFromPage As Integer
nToPage As Integer
nMinPage As Integer
nMaxPage As Integer
nCopies As Integer
hInstance As Long
lCustData As Long
lpfnPrintHook As Long
lpfnSetupHook As Long
lpPrintTemplateName As String
lpSetupTemplateName As String
hPrintTemplate As Long
hSetupTemplate As Long
End Type
declare function PrintDlgA lib "comdlg32" alias "PrintDlgA" (pPrintDlg as PRINTDLGS) as Long
Declare Function GetForegroundWindow Lib "user32" () As Long
Sub Main()
Dim objPPApp as Object
dim PrintDlg as PRINTDLGS
PrintDlg.lStructSize = Len(PrintDlg)
set objPPApp = CreateObject("Powerplay.Application"
'make Powerplay visible
objPPApp.Visible 1
PrintDlg.hwndOwner = GetForegroundWindow()
Result = PrintDlgA(PrintDlg)
End Sub
Does anybody have examples on how to make win32 APIs calls for common dialogs (I am trying to open the Print Dialog). My code compiles but does not display the dialog or return an error. I think the problem I am having is returning the handle to the current window. I make the Powerplay application active and the getforgroundwindow call returns a number, but I do not think I am doing it properly. Some example code would be GREAT
Here is what I have so far:
Type PRINTDLGS
lStructSize As Long
hwndOwner As Long
hDevMode As Long
hDevNames As Long
hDC As Long
flags As Long
nFromPage As Integer
nToPage As Integer
nMinPage As Integer
nMaxPage As Integer
nCopies As Integer
hInstance As Long
lCustData As Long
lpfnPrintHook As Long
lpfnSetupHook As Long
lpPrintTemplateName As String
lpSetupTemplateName As String
hPrintTemplate As Long
hSetupTemplate As Long
End Type
declare function PrintDlgA lib "comdlg32" alias "PrintDlgA" (pPrintDlg as PRINTDLGS) as Long
Declare Function GetForegroundWindow Lib "user32" () As Long
Sub Main()
Dim objPPApp as Object
dim PrintDlg as PRINTDLGS
PrintDlg.lStructSize = Len(PrintDlg)
set objPPApp = CreateObject("Powerplay.Application"
'make Powerplay visible
objPPApp.Visible 1
PrintDlg.hwndOwner = GetForegroundWindow()
Result = PrintDlgA(PrintDlg)
End Sub