Posts

Adding a printer in VB.NET

I took some time for me before I found out that API AddPrinter can be used to add printer whose driver is already installed. All I wanted to do was to add a Printer if its not present and the driver was built-in Windows XP itself. First I finished adding the printer in VC++ using MFC Application then I wanted to add it using VB.NET either using Declare Function or DllImport by wrapping it in a dll. Then i had to google for a long time when i last arrived at a code that really worked !!! Module Printer_Module 'declare the API in VB Private Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterW" _ (ByVal pName As IntPtr, ByVal Level As Int32, _ &#60MarshalAs(UnmanagedType.LPStruct)&#62 ByVal pPrinter As PRINTER_INFO_2) As Int32 'http://www.vbforums.com/archive/index.php/t-263437.html 'still dont know why PRINTER_INFO_2 is Class instead of a Structure &#60StructLayout(LayoutKind.Sequential)&#62 _ Pu...

DEPLOYING VSTO SOLUTIONS

Image
This is for all people who know whats VSTO (Visual Studio Tools for office) and have developed apps using it and have not been able to deploy to end user systems. This is the most easy solution I have found to deploy document level solutions i.e. for a single excel or word file after a long time struggling. Though there are many ways to deploy VSTO solution for a document level and most handy one i have found so far has been - signing the assembly with a strong name then add entry in the .NET 2.0 security configuration. This is most handy because if you use URL then you cant shift the location of the folder which i needed in my case. Here are the steps. (NOTE: In the end users computer - You need to install feature .NET forms programmability in Office 2003 by using add/remove features in office 2003 installer and then install VSTOR.exe which can be found in the VSTO CD) (NOTE: In the developers computer you need the Visual Studio SDK if you need the Microsoft .NET Framework 2.0 Configu...