Jump to content
Sign in to follow this  

Is possible hide propertie's button of _WinAPI_PrintDlg?

Recommended Posts

Hi Forum,


Is possible hide the button properties in _WinAPI_PrintDlg?
I search in MSDN but I can´t find this or this is impossible?

Because you want to hide (or disable) the button? 
And why not? It provides access to a lot of functions a lot of printers, I can not control (yet). This gives the end user the false impression of control. I see no useful reason to display it (or leave enabled). What is really needed is to select the printer, copies, and only.


Best regards,


Edited by Detefon

Visit my repository

Share this post

Link to post
Share on other sites

hi. Try this.

#include <APIDlgConstants.au3>
#include <Memory.au3>
#include <WinAPIDlg.au3>
#include <WinAPIFiles.au3>
#include <WindowsConstants.au3>

Global $hHandle = DllCallbackRegister("_PrintHookProc", "INT_PTR", "hwnd;UINT;wparam;lparam")

Local $tPRINTDLG = DllStructCreate($tagPRINTDLG)
DllStructSetData($tPRINTDLG, 'Size', DllStructGetSize($tPRINTDLG))
DllStructSetData($tPRINTDLG, 'FromPage', 2)
DllStructSetData($tPRINTDLG, 'ToPage', 3)
DllStructSetData($tPRINTDLG, 'MinPage', 1)
DllStructSetData($tPRINTDLG, 'MaxPage', 9)
DllStructSetData($tPRINTDLG, 'Copies', 4)
DllStructSetData($tPRINTDLG, 'PrintHook', DllCallbackGetPtr($hHandle))

If Not _WinAPI_PrintDlg($tPRINTDLG) Then

; Show results
Local $hDevNames = DllStructGetData($tPRINTDLG, 'hDevNames')
Local $pDevNames = _MemGlobalLock($hDevNames)
Local $tDEVNAMES = DllStructCreate($tagDEVNAMES, $pDevNames)
ConsoleWrite('Printer: ' & _WinAPI_GetString($pDevNames + 2 * DllStructGetData($tDEVNAMES, 'DeviceOffset')))
If DllStructGetData($tDEVNAMES, 'Default') Then
    ConsoleWrite(' (Default)' & @CRLF)
ConsoleWrite('First page: ' & DllStructGetData($tPRINTDLG, 'FromPage') & @CRLF)
ConsoleWrite('Last page: ' & DllStructGetData($tPRINTDLG, 'ToPage') & @CRLF)
ConsoleWrite('Copies: ' & DllStructGetData($tPRINTDLG, 'Copies') & @CRLF)

; Free global memory objects that contains a DEVMODE and DEVNAMES structures
_MemGlobalFree(DllStructGetData($tPRINTDLG, 'hDevMode'))


Func _PrintHookProc($hWnd, $iMsg, $wParam, $lParam)
    If $iMsg = $WM_INITDIALOG Then
        ControlHide($hWnd, "", "Button2")
    Return 0
EndFunc   ;==>_PrintHookProc


Edited by Danyfirex

Share this post

Link to post
Share on other sites
Danyfirex, ok, your script worked fine for me, it hide the properties button, but I want understand... 
The _WinAPI_PrintDlg function no have a value to show/hide the button properties, not native / internal shape. 
So you used a gimmick (hack?), thought control this button hid. 
Right?  :think:  

Visit my repository

Share this post

Link to post
Share on other sites

They hid the control ;)

Snips & Scripts

My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ


Share this post

Link to post
Share on other sites

as far I know It doesn`t.

I don't think it's a full gimmick because I using just a callback that msdn says that I can use.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...