Luigi Posted September 15, 2014 Share Posted September 15, 2014 (edited) 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, Detefon Edited September 15, 2014 by Detefon Visit my repository Link to comment Share on other sites More sharing options...
Solution Danyfirex Posted September 15, 2014 Solution Share Posted September 15, 2014 (edited) hi. Try this. expandcollapse popup#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, 'Flags', $PD_ENABLEPRINTHOOK) 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 DllCallbackFree($hHandle) Exit EndIf ; 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) Else ConsoleWrite(@CRLF) EndIf 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')) _MemGlobalFree($hDevNames) DllCallbackFree($hHandle) Func _PrintHookProc($hWnd, $iMsg, $wParam, $lParam) If $iMsg = $WM_INITDIALOG Then ControlHide($hWnd, "", "Button2") EndIf Return 0 EndFunc ;==>_PrintHookProc Saludos Edited September 15, 2014 by Danyfirex Luigi 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Luigi Posted September 15, 2014 Author Share Posted September 15, 2014 (edited) Oh this is amazing! Thank you Danyfirex! ^^ Edited September 15, 2014 by Detefon Visit my repository Link to comment Share on other sites More sharing options...
Luigi Posted September 15, 2014 Author Share Posted September 15, 2014 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? Visit my repository Link to comment Share on other sites More sharing options...
MikahS Posted September 15, 2014 Share Posted September 15, 2014 They hid the control Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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 Link to comment Share on other sites More sharing options...
Danyfirex Posted September 15, 2014 Share Posted September 15, 2014 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. saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Luigi Posted September 16, 2014 Author Share Posted September 16, 2014 I understand now, not bad for me, it only news! Visit my repository Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now