Site Menu
Main Page
Articles
Free Tools
Nish's Blog
Books by Nish
Photos
Nish's Bio
Contact me

C++/CLI

A first look at C++/CLI

A brief look at the new C++/CLI syntax and how it improves over the old MC++ syntax

C++/CLI in Action - Declaring CLR types

Excerpts from Chapter 1. Topics are (1) Declaring CLR types and (2) Handles: The CLI equivalent to pointers

C++/CLI in Action - Instantiating CLI classes

This is an excerpt from Chapter 1 that covers how CLI classes are instantiated, and discusses constructors and assignment operators

C++/CLI in Action - Using interior and pinning pointers

Excerpt from Chapter 4 on interior and pinning pointers

Using and extending the Orcas marshal_as library

This article covers basic marshal_as usage, as well as how to extend marshal_as to support additional type conversions

A rational attempt to substantiate C++/CLI as a first class CLI language

Why the author thinks that C++/CLI has its own unique role to play as a first-class .NET programming language

C++/CLI Library classes for interop scenarios

The article takes a brief look at some not so commonly used classes such as auto_handle, lock, and ptr

C++/CLI HowTo : Deriving from a C# disposable class

This article walks through the implementation of a C++/CLI class from a disposable C# base

A look at STL/CLR performance for linear containers

The performance of STL/CLR sequence containers are compared with that of corresponding BCL generic collection classes

CAutoNativePtr - A managed smart pointer for using native objects in managed code

CAutoNativePtr is a managed template class that acts as a smart pointer, and is handy for using native objects in managed code.

Function overriding in C++/CLI

Takes a look at new features like explicit overriding, renamed overriding, multiple overriding and sealing a method

Arrays in C++/CLI

The article exposes the new array syntax available in C++/CLI for the declaration and use of CLI arrays

Deterministic Destruction in C++/CLI

Looks at how deterministic destruction is possible with C++/CLI

C++/CLI Properties - Syntactic sugar for accessor methods

Looks at the syntax for the declaration and use of properties in C++/CLI

An overview of interior pointers in C++/CLI

Tries to explain the syntax, usage and behavior of interior pointers in C++/CLI

Guide to using Pinning Pointers

Article on the usage and dangers of pinning pointers

Function pointers and Delegates - Closing the gap!

Explains the usage of the Marshal class methods GetFunctionPointerForDelegate and GetDelegateForFunctionPointer, and compares their performance with the P/Invoke mechanism.

Using generics in C++/CLI

Introduces generics and compares it with templates

CNullable : A convenient Nullable equivalent class for C++/CLI

CNullable can be used to represent a value type (or simple native type) such that the type can be nulled. You can also compare it to nullptr using the == and != operators both of which have been overloaded.

StringConvertor : A convertor class for managed-unmanaged string conversions that handles memory de-allocations

A convertor class for managed-unmanaged string conversions that handles memory de-allocations. Caller need not worry about freeing unmanaged memory allocations.

Using WinForms controls in an MFC dialog

This article is a simple introduction to using the CWinFormsControl MFC class to put a Windows Forms control on an MFC dialog.

Using the Windows Forms 2.0 MenuStrip and ToolStrip controls to give your MFC applications a new look and feel

This article demonstrates how to use the Windows Forms 2.0 MenuStrip and ToolStrip controls in an MFC SDI application, using C++/CLI, to get the Office 2003 style menu and toolbar

C++

To new is C++; To malloc is C; To mix them is sin!

Article explains the differences between malloc/free and new/delete in a C++ context

MFC

Some handy dialog box tricks, tips and workarounds

Hidden modal dialogs, stealing focus, always on top dialogs, going full-screen, expanding and contracting dialogs, removing task bar icon, context sensitive help and many other useful tips and tricks.

The singular non-modality of MFC modal dialogs

Explains the pseudo modality of CDialog based modal dialogs and a problem with the CDialog::EndDialog implementation.

Deploying MFC applications via ClickOnce

A step by step tutorial on how to deploy an MFC application via ClickOnce

Keyboard messages/accelerators handling in MFC dialog based applications

This article explains how you can override PreTranslateMessage and ProcessMessageFilter in dialog based apps.

Tutorial - Modeless Dialogs with MFC

Some tips/suggestions on using modeless dialogs with MFC.

Delay MessageBox with auto-close option

This message box delays its dismissal by disabling the OK button for a delay interval. It also has an optional auto-close feature. There are two versions, one uses a WH_CBT hook and some basic window tricks like sub-classing to achieve its goal. The other one is more MFC-ied. (Co-Authored by Shog9)

Window Sizer

A hot-key based program that lets you resize your current window to any size. Useful for web designers and GUI developers as it helps avoid frequent screen-resolution changes.

Creating draggable windows - SDI and dialogs

Shows how you can create windows that can be dragged around, not just through the title bar, but anywhere within the window body.

Using color gradients as backgrounds in your dialogs and views

Beginner article that shows how you can create horizontal, vertical and diagonal backgrounds. Also tells you what to watch out for, to avoid flickering when doing complicated drawing.

Tile, center and stretch a bitmap as your MFC dialog background

A small CDialog derived class that helps avoid frequent copy/pasting of the same code, when using a bitmap as dialog background.

CDocument::DoSave revealed

Explains how you can suppress the File-Save-As dialog in a Doc/View app, how to save files to multiple formats, and how DoSave is implemented.

Adding a status bar to an MFC dialog

Shows how you can have status bars in your dialog based apps.

MFC under the hood

Explains the basic MFC program flow including where WinMain and the message loop are hidden.

CInputBox 1.0

A CFrameWnd derived class that provides functionality similar to the VB InputBox function. You don't need a dialog resource to use the class!

Win32

How to drag a virtual file from your app into Windows Explorer

Shows how to use CFSTR_FILEDESCRIPTOR and CFSTR_FILECONTENTS to perform drag/drop with virtual files

CProcessData : A template class to ease up SendMessage calls across processes

CProcessData is a template class that makes it easy to use data allocated in a different process, and is useful when making inter-process SendMessage/PostMessage calls.

Beginner's introductory guide to writing,installing,starting,stopping NT services

Includes a generic skeleton for a simple NT service. Explains how to install,start and stop the service programmatically.

CServiceHelper

A simple class to install, uninstall, start, stop, pause, continue Win32 services.

CExpire - A C++ class that implements time and run based restrictions

Shareware authors can use this class to limit the number of runs or the number of days that a program will function.

CFloppyDisk 2.0

A class for reading and writing floppy disk sectors directly [Win 95/98/ME/NT/2K/XP]

CFormatDriveDialog - A wrapper class for the undocumented SHFormatDrive API function

A wrapper class for SHFormatDrive (XP/2K only). Corrects some errors in KB article Q173688.

A newbie's elementary guide to spawning processes

Gives an elementary introduction to the use of ShellExecute/ShellExecuteEx, CreateProcess, WaitForSingleObject. How to bring up the Find window, the Properties window.

Manipulating Windows using messages and simple CBT hooking

Demonstrates techniques using windows messages and hooks, which allow us to automate a windows properties dialog or even custom applications.

How to accurately detect if an application is theme-enabled?

Describes a function that overcomes the inadequacies of IsAppThemed and IsThemeActive.

Casting Basics - Use C++ casts in your VC++.NET programs

Demonstrates and compares the various casting operators available. Also suggests when to use and what to use!

Changing default icons for folders and drives

Shows how to globally change the icons for folders and drives. Also shows some nifty tricks you might find handy in your applications.

Getting and setting desktop folder names

Gives you copy/paste-able functions to retrieve the localized folder names, and to set/get user-defined folder names for dekstop folders.

Beginner's Tutorial - Using global hotkeys

Explains how to register, use and unregister hotkeys.

MultiMail 2.0 - Freeware SMTP stress testing tool

This free program can be used to stress test SMTP servers. It also aids anti-Spam tool developers as a useful mail-bombardment tool.

Send mail without specifying an SMTP server

A class derived from CSMTPConnection that queries the MX record for a target domain and uses that to send mail.

CFileTar 1.0 - pack and unpack file archives

A class for packing and unpacking file archives.

MAC Address Changer for Windows XP/2003

A freeware program (with source code) that allows you to change the MAC ID of your network adapter.

Shell Tray Info - Arrange your system tray icons

A tool with full source code that enumerates tray icons and allows you to reposition them as well as send mouse messages.

WPF

WPF Tutorial - Part 1 : Transformations

A brief introduction to using transformations with the WPF

WPF Tutorial - Part 2 : Writing a custom animation class

This article covers how animations can be applied on properties that do not have an associated animation class

Using data selectors to create a listbox with expand/collapse support

This article shows how to use data template selectors and also how to create a hierarchical listbox

Managed C++

Introduction to Managed C++

An attempt to get a beginner started on Managed C++

Using managed arrays

Declaring and using managed .NET arrays with MC++

Using IJW in Managed C++

A basic introduction to using IJW instead of P/Invoke in Managed C++.

Screen and Form capture with Managed C++

This is further demonstration of MC++ IJW capabilities.

Implementing Callback functions using IJW (avoiding DllImport)

Shows how you can call native API functions that require callbacks using IJW, and without the use of DllImport attribute. The technique allows you to pass a delegate as the callback function just as in the MS recommended manner except, I show you how to do this without the ugly DllImport attribute.

MC++ TCP server talking to MFC & MC++ TCP clients

Basic demonstration of the TcpListener/TcpClient classes.

The virtual bool bug

Describes the virtual bool bug that exists in mixed mode Managed C++ programs that access unmanaged classes.

OLE DB - First steps

Basic introduction to using OLE DB to insert, update and read records from a database.

OLE DB - Bound controls

Shows how you can use data bound controls with OLE DB.

N-Track : Work-Time tracking system

A work time tracking system that includes a Managed C++ remoting server and MFC clients that use the managed extensions. The application demonstrates how to mix managed and unmanaged code.

Implementing custom collection classes with MC++

Tutorial on creating your own collection classes that are enumerable and sortable. Explains in detail the usage of the IEnumerable, IEnumerator, IComparable and IComparer interfaces.

Dynamically loading a DLL - MC++

Shows how you can load an assembly at run time, instantiate a class in that assembly and call methods on the class.

Managed C++ and Windows Forms

An introduction to Windows Forms using Managed C++

Managed C++ and Windows Forms - Image Viewer

Demonstrates adding menus, showing open-dialog boxes, showing images, scrolling.

Outlook style GUI - three-way split form

Demonstrates the usage of splitters, treeviews, listviews, panels, toolbars.

Multi-line InputBox control - MC++

A .NET port of my MFC CFrameWnd derived InputBox class, written using MC++

How to have an Auto-Completing ComboBox in .NET

Shows how to derive a class from ComboBox and add an Auto-Complete feature to it. The example uses Managed C++.

Creating and Resolving shell links

An MC++ class that uses IJW to invoke the IShellLink interface.

How to pass data to worker threads

Shows how you can pass data to your worker threads.

Thread Sychronization using monitors

Introduction to using the Monitor class for accessing shared resources from multiple threads.

Limiting your .NET apps to a single instance

Shows how to use the Mutex class to limit your app to a single instance using a named mutex.

Serialization Primer - MC++

A basic introduction to serialization using Managed C++

Basic stuff on Files, Directories and Streams

Demonstrates the use of the reader/writer classes as well as the file/directory info classes.

How to do Synchronous and Asynchronous web downloads

Explains the usage of WebRequest, WebResponse and related classes.

Managed Exception Handling using VC++.NET

An introduction to managed exception handling in MC++ programs.

C# and .NET

A data-bound multi-column combobox

An ownerdrawn multi-column combobox class with support for data-binding

Using a TypeDescriptionProvider to support dynamic run-time properties

This articles explains how to implement a TypeDescriptionProvider for a class to support multiple object types using a single class type

Typed URLs Cleaner utility for Windows Vista

This utility will remove non-web URLs from the shared typed URLs history in Vista, so IE won't show non-web URLs in the dropdown.

The coding gentleman's guide to detecting the .NET Framework

A C++ class that will detect and enumerate the active CLR versions on a machine

A modal dialog that fades the background to gray-scale imitating the XP shutdown screen

DimmerDialog is a .NET class that shows a modal dialog which grays out the rest of the background, just like the Windows XP Shutdown dialog. This can be used when your application needs to show a very important message box or form that requires immediate user attention.

MessageBoxManager - A Windows Forms component that provides enhanced MessageBox functionality

MessageBoxManager is a Windows Forms component that you can drag & drop into a Windows Forms project's main form, and it gives you enhanced message box functionality without forcing you to change your existing calls to any of the MessageBox.Show() overloads

Simulating polymorphic operator overloads with C#

Article shows how to overcome the C# insistence on operator overloads being static and describes a method for simulating polymorphic behavior for operator overloads.

Introduction to inheritance, polymorphism in C#

An elementary introduction to inheritance, polymorphism in C# using simple code snippets.

A statistical analysis of the performance variations of assorted managed and unmanaged languages

This article compares and contrasts the relative performances of various languages like native C++, Visual Basic 6, C#, VB.NET, Managed C++, MC++ and native code mix, ngen'd assemblies etc. using a prime number generation function as a generic benchmark. (Co-Authored by RamaKrishna)

Enums and Structs in C#

Two oft-overlooked value types that C# offers and where they can be used.

Delegates Tutorial - MC++ and C# - The dual perspective

Introduces and walks you through the use of delegates in .NET. Compares and contrasts the different approaches that MC++ and C# adopt in the use of delegates. With examples in both languages.

Getting unsafe with pointers in C#

Introduction to unsafe code.

Drag and Drop between list boxes - Beginner's Tutorial

An introduction to drag and drop in .NET

Clipboard handling with .NET

An introduction to using the clipboard

Adding tray icons and context menus

Beginner's Tutorial on adding tray icons and setting context menus.

Absolute beginner's introduction to remoting

Introduces .NET remoting and the use of asynchronous callbacks using simple code snippets.

FontComboBox - a font listing combo box for .NET

A fully owner drawn ComboBox derived class for enumerating and choosing fonts.

An editable multi-line listbox for .NET

An owner drawn listbox that supports multi-line word-wrapped text as well as in-place editing.

Ordered ListBox

A ListBox derived class that supports internal ordering and re-ordering of items.

ToolTipListBox - a list box with tool tips

A ListBox derived class that shows tool-tips for items that won't fit within the width of the list box.

.NET port of Joe's AutoRepeat Button class

This ports Joe Newcomer's AutoRepeat Button class to a .NET control.

Events and event handling in C#

An introduction to using events and event handlers in C#

Registry handling with .NET

Shows with some code snippets how registry handling is a piece of cake with .NET

Pre-beginner's guide to using a timer

Shows how you can use a timer proc in your windows forms apps.

Using events for thread synchronization

An introduction to using signaled events for thread synchronization in .NET

Bug when using the java.util.zip classes to write zip files

Describes an issue when writing a binary file into a zip file using the java.util.zip classes

A tool to strip zips of unwanted files before submitting to CodeProject

The CPZipStripper tool with source code

ASP.NET

A quick guide to using nested repeaters in ASP.NET

Using nested repeaters in ASP.NET with an XML data store

Winsock

CSmtpProxyMT 1.0

An SMTP proxy class with ability to insert signatures to outgoing mails.

CPopProxyMT - A multi-threaded POP3 proxy skeleton

CPopProxyMT is a skeletal class that wraps a multi-threaded POP3 proxy.

Beginning Winsock Programming - Simple TCP server

An introduction to WinSock programming. A simple TCP server is explained.

Beginning Winsock Programming - Simple TCP client

A simple TCP client is explained.

Beginning Winsock Programming - Multithreaded TCP server with client

Explains a multithreaded TCP file server, a custom TCP chat protocol and a custom TCP client.