//
archives

Programming Issues/Tips

This category contains 54 posts

Replace all UUIDs in an ATL COM DLL.

1. Introduction. 1.1 Recently, a friend asked me for advise on a very unusual requirement. 1.2 He needs to replace all UUIDs in a COM DLL with new ones. 1.3 He does not have the source codes to the original COM server so any modifications will have to be done on the binary code. 1.4 … Continue reading

Explore Possibilities with MSIL.

1. Introduction. 1.1. It will be hard to find an intermediate and advanced .NET programmer who has not heard of MSIL. 1.2 I have occasionally worked with IL code in the past, specifically when there is a need to modify the declarations of parameters and attributes for the purpose of interop marshaling. 1.3 Then last … Continue reading

Using the WebBrowser Control to Print Documents

1. Introduction 1.1 Recently, a junior colleague approached me for some advise. 1.2 As part of his project work, he had need to programmatically perform printing using C#. 1.3 The document he was assigned to print includes a combination of text and images. 1.4 He had no prior experience in this task and was daunted … Continue reading

Using the TypeLibConverter to Customize Type Library Creation from an Assembly Part 2.

1. Introduction. 1.1 This article is a follow up from part 1. 1.2 In part 1, we presented C# code for a class library named CSTestInterfaceClass.dll in which an interface “ITestInterface” and a coclass “TestClass” is defined. 1.3 ITestInterface contains a single property “MyObject” of type object. Being of type object (a reference type) means … Continue reading

Using the TypeLibConverter to Customize Type Library Creation from an Assembly Part 1.

1. Introduction. 1.1 Creation of COM type libraries from an assembly with COM-visible constructs (e.g. classes, interfaces, etc) is usually performed using REGASM.EXE or TLBEXP.EXE. 1.2 However, these tools provide standardized assembly to type library type transformations which cannot be customized. 1.3 To customize type library creation, the .NET framework provides the TypeLibConverter class. 1.4 … Continue reading

Programmatically Adding/Removing Paths to/from the System Path

1. Introduction. 1.1 Recently, my development team had to programmatically add a new path to the system path. 1.2 After doing some research, we successfully wrote a small program that performs this small feat. 1.3 In this post, I share the code that was used to accomplish this task. 2. Altering the System Path. 2.1 … Continue reading

Using Boost Lambda Expression – Performing Iterations on Vector Elements.

1. Introduction. 1.1 When performing iterations and transformations on STL containers, the Boost Lambda Expressions can be a useful alternative to using regular function class objects. 1.2 For those not familiar with the Boost Lambda Library (BLL), please refer to their library web site for full documentation. 1.3 From the next section onwards, 2 code … Continue reading

Storing C++ Objects in a STL Vector Part 3.

1. Introduction. 1.1 In part 2 of this series of articles, we discussed how to use a STL vector to store pointers to objects. 1.2 The purpose of this was to store items in a vector that are linked to base class objects and through this we create the opportunity to downcast base objects to … Continue reading

Storing C++ Objects in a STL Vector Part 2

1. Introduction. 1.1 In part 1, we concluded that given a base class B, a class D derived from B, and a vector V of class B, it is not possible to store an instance of D in V. Any such instance will be constructed as an object of class B before being stored inside … Continue reading

Storing C++ Objects in a STL Vector Part 1

1. Introduction. 1.1 The STL vector is one of the most useful container classes in STL. 1.2 However, given a base class B, a class D derived from B, and a vector V of type B, it is not possible to store instances of D in V. 1.3 As will be shown later on with … Continue reading