ChrisL Posted February 19, 2010 Share Posted February 19, 2010 [Function] DWORD MCP_EnumPrinter(PUINT puiNumPrinter, PHANDLE phPrinter) [Description] Find and list printers to be controlled. [Arguments] IN Maximum number of printer handles that can be acquired. puiNumPrinter OUT Number of printer handles that can be found. phPrinter OUT Pointer of an array in which printer handles should be stored. This kind of works but the 0 at the end should point to an array but I guess not an Autoit array $MCP_MAX_OPEN_PRINTER = 3 $ret = DllCall($dll, "DWORD", "MCP_EnumPrinter", "int*", $MCP_MAX_OPEN_PRINTER, "long*", 0) $ret[2] always has the first printer handle but no subsequent handles, the second printer can be accessed by using a handle $h = $Ret[2] +1 but I don't think it is the right way to do it. Any ideas on what the 0 should be and possibly the long* Thanks [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
trancexx Posted February 19, 2010 Share Posted February 19, 2010 Try: $MCP_MAX_OPEN_PRINTER = 3 $tHandles = DllStructCreate("ptr[" & $MCP_MAX_OPEN_PRINTER & "]") $ret = DllCall($dll, "dword", "MCP_EnumPrinter", "dword*", $MCP_MAX_OPEN_PRINTER, "ptr", DllStructGetPtr($tHandles)) For $i = 1 To $MCP_MAX_OPEN_PRINTER ConsoleWrite("pointer " & $i & " = " & DllStructGetData($tHandles, $i) & @CRLF) Next ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
ChrisL Posted February 20, 2010 Author Share Posted February 20, 2010 Thanks I'll try it next week when I'm back at work [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted February 23, 2010 Author Share Posted February 23, 2010 Unfortunately that doesn't work It returns for 2 printers 0x0100001 0 0 0 0 0 0 0 Any other ideas? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
weaponx Posted February 23, 2010 Share Posted February 23, 2010 How can we test this without adequate details? A search for "MCP_EnumPrinter" finds nothing on Google. Link to comment Share on other sites More sharing options...
trancexx Posted February 23, 2010 Share Posted February 23, 2010 Aghh! For $i = 1 To $MCP_MAX_OPEN_PRINTER ConsoleWrite("pointer " & $i & " = " & DllStructGetData($tHandles, 1, $i) & @CRLF) Next ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
ChrisL Posted February 24, 2010 Author Share Posted February 24, 2010 How can we test this without adequate details? A search for "MCP_EnumPrinter" finds nothing on Google.MCP_EnumPrinter wouldn't come up with anything on Google, its a printer made by the company I work for and the information at the top of the page is straight out of the SDK manual.I didn't understand the pointer to an array because it wasn't refering to an Autoit style array. I'm still not convinced after trancexx last post that it is quite right because now I get 0100001 and 0100002 which is almost correct but not a handle to the printers but it is further than I got before without his help. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
wolf9228 Posted February 24, 2010 Share Posted February 24, 2010 (edited) Unfortunately that doesn't work It returns for 2 printers 0x0100001 0 0 0 0 0 0 0 Any other ideas? Try this code $MCP_MAX_OPEN_PRINTER = 3 $ret = DllCall($dll, "dword", "MCP_EnumPrinter", "dword*", $MCP_MAX_OPEN_PRINTER, "ptr*",0) $tHandles = DllStructCreate("HANDLE[" & $MCP_MAX_OPEN_PRINTER & "]",$ret[2]) For $i = 1 To $MCP_MAX_OPEN_PRINTER ConsoleWrite("HANDLE " & $i & " = " & DllStructGetData($tHandles, $i) & @CRLF) Next Edited February 24, 2010 by wolf9228 صرح السماء كان هنا 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