Skip to main content

Posts

Showing posts from March, 2009

Creating Calendar ActiveX Control Using ATL

This Article is used to build a full fledged ATL COM calendar Control. This article is divided into six steps. Step 1: Creating the Project Step 2: Adding a Control to Project Step 3. Adding a Methods to Control Step 4: Changing Control's Drawing Code Step 5: Adding an Event to the Control Step 6: Adding a Property Page to Your Control Creating the project First we have to create the initial ATL project using the ATL COM AppWizard. Click New on the File menu, then choose the Projects tab.Select the ATL COM AppWizard. Type 'CalendarServer' as the project name. In step2 check 'Support MFC' check box and click on Finish. Adding a

ATL COM Controls

This Article is used to bulid a full fledged ATL COM explorer Control. This article is divided into six steps. Step 1: Creating the Project Step 2: Adding a Control to Project Step 3. Changing Control's Drawing Code Step 4: Adding a Methods to Control Step 5: Adding an Event to the Control Step 6: Adding a Property Page to Your Control Creating the project : First we have to create the initial ATL project using the ATL COM AppWizard. click New on the File menu, then choose the Projects tab. Select the ATL COM AppWizard. Type 'MultiControls' as the project name. In step2 check 'Support MFC' check box and click on Finish. Adding a Control : To add an object to an ATL project, you use the ATL Object Wizard. Click New ATL Object on the Insert menu, and the ATL Object Wizard appears. I

Aggregation - Reusability In COM-II

One way to reuse a component within another component is using containment . Another way to do so is using aggregation . In containment the outer component makes use of the inner component, but does not directly expose the inner component to its clients. The outer component can choose to use the inner component to implement some of its functionality. If the outer component decides to implement one or more of the interfaces of the inner component it must provide a wrapper for every method in the exposed interfaces. The method wrappers can simply call the inner component’s methods directly, or they can perform additional tasks such as validating parameters, recording usage, or otherwise extending the inner component’s interface. Sometimes, it’s more convenient to expose the interfaces of the inner object directly, without writing a collection of wrappers. This is aggregation. A client creates the outer object, and when it asks QueryInterface(

Reusability In COM

COM promotes language-independent reuse. But so far we�ve only looked at clients using COM objects. Once the COM component is built it can be used by a client written in any language: VC, VB, Java, etc. Even scripting languages can use the component. But that�s only part of the reuse story. At times we may want to reuse an existing component while building another component. This way we can take advantage of the existing features of a component, and add to its functionality without being required to recompile the existing component. COM doesn�t support inheritance in the same sense as C++ does. This means we can�t derive one COM component from another the way we derive one C++ class from another. COM offers two primary mechanisms for reusing existing components to build other components. These are containment and aggregation . In this episode we would look at the first of these mechanisms, i.e., containment. In containment we can have one component as a member variable of another. T

Why You Should Use Unicode

When developing an application, we highly recommend that you use Unicode characters and strings. Here are some of the reasons why:  Unicode makes it easy for you to localize your application to world markets.  Unicode allows you to distribute a single binary (.exe or DLL) file that supports all languages.  Unicode improves the efficiency of your application because the code performs faster and uses less memory. Windows internally does everything with Unicode characters and strings, so when you pass an ANSI character or string, Windows must allocate memory and convert the ANSI character or string to its Unicode equivalent.  Using Unicode ensures that your application can easily call all nondeprecated Windows functions, as some Windows functions offer versions that operate only on Unicode characters and strings.  Using Unicode ensures that your code easily integrates with COM (which requires the use of Unicode characters and strings).  Using Unicode ensures that your code easily in

Why You Should Use Unicode

When developing an application, we highly recommend that you use Unicode characters and strings. Here are some of the reasons why:  Unicode makes it easy for you to localize your application to world markets.  Unicode allows you to distribute a single binary (.exe or DLL) file that supports all languages.  Unicode improves the efficiency of your application because the code performs faster and uses less memory. Windows internally does everything with Unicode characters and strings, so when you pass an ANSI character or string, Windows must allocate memory and convert the ANSI character or string to its Unicode equivalent.  Using Unicode ensures that your application can easily call all nondeprecated Windows functions, as some Windows functions offer versions that operate only on Unicode characters and strings.  Using Unicode ensures that your code easily integrates with COM (which requires the use of Unicode characters and strings).  Using Unicode ensures that your code easily in

Debugger Tips

Visual Studio's (native) C++ debugger has many useful features that can make your debugging much more pleasant, if you know what they are. These tend to accumulate over releases, and get forgotten and unused, unless you happen upon an archaic piece of documentation. On this topic, then, there are special expression and format specifiers that you can use to better examine the content in the debugger's watch windows. For example, say we break after the following bit of code: int i = 0x12345678; You can use the by, wo , and dw operators to view contents of a variable as an unsigned byte, word, or dword: i 0x12345678 int by i 0x78 'x' unsigned char wo i 0x5678 unsigned short dw i 0x12345678 unsigned long You can also use the operators on a register to do the same to the destination of the r