Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

PrintUIEntryW (printui)
 
.
Summary
PrintUIEntryW is the main entrypoint to the printer configuration functions in the PrintUI.dll.

Advantages of using the function directly in your program instead of calling rundll32.exe are meanful error codes

and no external process needs to be called resulting in more control.

C# Signature:

[DllImport("printui.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern void PrintUIEntryW(IntPtr hwnd, IntPtr hinst, string lpszCmdLine, int nCmdShow);

Sample Code:

Get available commands in dialup box

PrintUIEntry(IntPtr.Zero, IntPtr.Zero, @"/?", 0);

Add per machine printer connection (the connection will be propagated to the user upon logon):

PrintUIEntry(IntPtr.Zero, IntPtr.Zero, @"/c \\machine /ga /n\\server\queue", 0);

Delete per machine printer connection (the connection will be deleted upon user logon):

PrintUIEntry(IntPtr.Zero, IntPtr.Zero, @"/c \\machine /gd /n\\server\queue", 0);

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions