Creating an InfoPath Host Application in .NET framework

Creator QR Code 2d barcode in .NET framework Creating an InfoPath Host Application
Creating an InfoPath Host Application
QR Encoder In Visual Studio .NET
Using Barcode maker for ASP.NET Control to generate, create QR image in ASP.NET applications.
Figure 1817: Standard toolbar for the IP Insurance application
Barcode Printer In VS .NET
Using Barcode generation for ASP.NET Control to generate, create barcode image in ASP.NET applications.
add buttons that will be used to open a le, save, cut/copy/paste, and undo/redo We ll also add a Text Box control and a Find button that can be used to search for text in the hosted form Figure 1817 shows how this toolbar will look The Open button will simply display the Open File dialog and allow the user to choose an InfoPath le, as is the case in the InfoPath client application Once the user chooses a le, either formControl1Open or formControl1NewFromTemplate will be called, depending on whether the le is a form (xml) or a form template (xsf or xsn) The Save button in the toolbar will simply call our own SaveForm method Writing the code for the Open and Save buttons is pretty easy because the FormControl class offers methods that will allow us to load and save a form However, if you look closely at the FormControl class, you will see that there are no methods to cut, copy, or paste data and no methods to undo or redo changes So, how do we implement these features Fortunately, as we mentioned, there is a way to access most of the features available in InfoPath even if the functionality isn t available through the FormControl class You can access these features through the IOleCommandTarget interface This interface, which may be familiar to you if you have done any COM programming, allows you to query for the status of various commands and then execute these commands if they are available Since this interface isn t part of the NET Framework, when you are developing a managed code application that hosts the InfoPath form control, you have to use COM interop in order to access it and send commands to the InfoPath form control Fortunately, doing so is relatively straightforward Let s look at how we can implement the other features of our application toolbar by using the IOleCommandTarget interface First, we must de ne the IOleCommandTarget interface and its dependencies Listing 184 shows the code that de nes the IOleCommandTarget interface The interface and the corresponding OLECMD structure and OleCmdf enumeration are exactly what you would see if you looked up this interface in MSDN
Printing QR Code ISO/IEC18004 In C#
Using Barcode creator for .NET framework Control to generate, create QR Code ISO/IEC18004 image in .NET framework applications.
18: Hosting InfoPath
QR-Code Drawer In Visual Studio .NET
Using Barcode generation for Visual Studio .NET Control to generate, create QR Code 2d barcode image in .NET applications.
Listing 184: IOleCommandTarget Interface and Its Dependencies
Encode QR Code In VB.NET
Using Barcode printer for VS .NET Control to generate, create QR Code 2d barcode image in .NET applications.
[StructLayout(LayoutKindSequential)] struct OLECMD { public uint cmdID; public uint cmdf; } private enum OleCmdf { Supported = 1, // The command is supported Enabled = 2, // The command is available and enabled Latched = 4, // The command is a toggle and is currently on Ninched = 8 // Reserved for future use } // Note that the GUID created using guidgen tool that comes // with Visual Studio 2005 [ ComImport, Guid("B722BCCB-4E68-101B-A2BC-00AA00404770"), InterfaceType(ComInterfaceTypeInterfaceIsIUnknown) ] interface IOleCommandTarget { void QueryStatus(ref Guid pguidCmdGroup, uint cCmds, [MarshalAs(UnmanagedTypeLPArray), In, Out] OLECMD[] prgCmds, IntPtr pCmdText); void Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdExecOpt, ref object pvaIn, ref object pvaOut); }
Printing UPC Code In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create UPC Code image in ASP.NET applications.
Now let s look at the methods we will use to query and execute commands using the IOleCommandTarget interface Listing 185 shows three methods two overloaded ExecuteCommand methods and one QueryStatusCommand method As you can probably guess from the names of these methods, the execute methods pass a command to the form control for execution, and the query status method checks to see if a command is available (The rst ExecuteCommand method does the actual work of executing the command, while the second one is added merely for convenience) As you can see from the code in Listing 185, the main execute method rst queries the form control to see if the command to execute is available before passing it to the form control for execution
Drawing Barcode In .NET Framework
Using Barcode maker for ASP.NET Control to generate, create bar code image in ASP.NET applications.
Code39 Creation In .NET
Using Barcode creation for ASP.NET Control to generate, create Code 3 of 9 image in ASP.NET applications.
Code 128 Code Set B Creation In .NET Framework
Using Barcode maker for ASP.NET Control to generate, create Code 128A image in ASP.NET applications.
Make Identcode In .NET Framework
Using Barcode encoder for ASP.NET Control to generate, create Identcode image in ASP.NET applications.
Create Data Matrix In VB.NET
Using Barcode printer for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in VS .NET applications.
Paint UPCA In VS .NET
Using Barcode drawer for VS .NET Control to generate, create UPC-A Supplement 2 image in VS .NET applications.
Data Matrix Recognizer In .NET Framework
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
UCC.EAN - 128 Printer In Java
Using Barcode encoder for Java Control to generate, create UCC - 12 image in Java applications.