Click here to Skip to main content
12,888,335 members (54,053 online)
Click here to Skip to main content
Add your own
alternative version


77 bookmarked
Posted 23 May 2007

Pretty WinAPI Class

, 23 May 2007
Rate this:
Please Sign up or sign in to vote.
New library version that is not WTL/MFC dependent

Screenshot - DevStudioSmall.jpg

Screenshot - OutlookDemoSmall.jpg

Screenshot - MDISmall.jpg


When I developed GuiToolkit, lots of people wrote me asking for a new version of the library that was not WTL/MFC dependent. In the beginning I thought the idea was preposterous, but after writing some lines I found it interesting and, as you can see, I don't know when I wrote those loads of code. This library is not an alternative to MFC, MTL, etc. Thinking of it that way would be absurd. It is simply a curiosity that may help you understand wrappers. I tried to make the code simple enough that anyone can understand it. Nevertheless, I don't guarantee that it is well written. As always, it can be a terrible or good programming example.

What I expect from you

First of all, I want to thank you for taking your time checking the code or playing a bit with the examples. If you are interested in the project, you can send me new classes or corrections to the code. This time, the entire code is my responsibility except for one array control class published in CodeProject. This one gives me the opportunity to reply to messages.


To develop it, I did not use the formal architecture. I just needed to think about a base scheme and create classes around it from there. As you can see when checking the code, I have a big MFC dependence. That is why some classes have similar names. I designed a similar scheme, at least in the appearance, based on macros. CWin is the fundamental library class. Its function is to surround the Windows API base and the WndProc function. CWin inherits the CMsg message structure; see the file CMacrodefine.h. It contains one NewMsgProc virtual function that is replaced later by the macros that invoke message processing functions. The library is logically arranged by a group of base classes. These classes surround the Windows fundamental controls and other extensions of advanced components under the name of swcext. Unfortunately, I can't make a detailed description so I'm presenting a quick reference to the fundamental files:

  • CApp.h: Class application wrapper, its function is to start the code execution.
  • CCommonCtrl.h: Common Windows controls wrapper, toolbox and status bar decorations.
  • CDialogControl.h: Common dialog box wrapper and base dialog box class.
  • CFrame.h: Wrapper of the base frame for the management of SDI and MDI windows, Docking Bar and the hook menu class.
  • CGdi.h: GDI functions wrapper and window decoration classes.
  • CMenuSpawn.h: Wrapper of the menu extension with icon support and a modern look.

Library features

Here's a list of some main features of this library:

  • Modern look in the Visual Studio 2005 style.
  • The decorated menu is included in the fundamental class that administrates MDI and SDI.
  • All common controls are sub-classed to allow easy message manipulation.
  • LINK_Control function that allows easy message manipulation, text box message manipulation, etc.
  • It doesn't require aditional DLLs.
  • Small executable files.
  • Docking bars included in the main frame.
  • Detachable docking tabs.
  • MDI tabs.
  • The tabs can be moved and docked in another window.
  • Advanced extensions like Comboboxext, Outlook bar, Splitter, List header subclass, Toolbutton extension, Worktab, Visual Studio Toolbox class.
  • Easy migration of GuiToolkit classes.
  • Similar MFC coding style; it is not a companion.
  • Toolbar and Menus with true color support.
  • Toolbars Combobox buttons.

It is free, so use it as you please. I would like you to give me some credit in your developments, though. As you can see, it is a job that consumed a lot of my time and it is not easy to make something from zero. Ideas are always welcome.

What it does not include

I tried to eliminate all of the resource liberation and memory bugs but, as all software comes equipped with its own bugs, please let me know if you find others. Here's a list of some known problems and additional components that I hope to have available in the next version:

  • It does not include a string management class like CString; please suggest one or develop your own.
  • It does not work under Windows 98, as it looks like the hook and a retrocall problem cause a Windows freeze. However, I'm not dedicating time to a dead OS.
  • There is no documentation. I hope to write some articles on my website about the library, but it is possible that you'd prefer me to invest that time developing code or additional components.
  • There is no support; I'm sorry.
  • The autohidden classes of the docking windows are already designed and included, but are not developed.
  • The windows don't have memory (persistent); nevertheless the base code is already developed and needs to be finished.
  • Simple horizontal and vertical docking in Left, Right and Bottom, but why not Top? Good question.
  • In release mode, compile only in level Minimize Size (/01).

Webpages of interest

Please refer to the following webpages for more information:


  • 23 May, 2007 - Version 0.1 released


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

My name is Francisco Campos, A developer as you.I have the title of Engineer of Systems of the Universidad Autonoma de Colombia.My real Job Information Security officer, experience in security assessment, applications, and other related subjects.

At the moment I live in Bogotá Colombia with my wife Zoraida and my three children Carolina, Andrés and Diego. /

You may also be interested in...

Comments and Discussions

QuestionThank you, Francisco Pin
David O'Neil6-Jul-14 19:57
memberDavid O'Neil6-Jul-14 19:57 
GeneralMy vote of 5 Pin
Agump31-Mar-13 22:49
memberAgump31-Mar-13 22:49 
GeneralImpressive Pin
Mitch D5-Feb-12 15:34
memberMitch D5-Feb-12 15:34 
GeneralCan't compile Dev-C++ (gcc) version :( Pin
tootall25-Jan-11 9:43
membertootall25-Jan-11 9:43 
GeneralRe: Can't compile Dev-C++ (gcc) version :( Pin
Francisco Campos Gualdron15-Mar-12 8:42
memberFrancisco Campos Gualdron15-Mar-12 8:42 
GeneralCompiled Binaries Please Pin
Alex Essilfie30-Jun-10 2:38
memberAlex Essilfie30-Jun-10 2:38 
Generalwm_paint message in loop Pin
rgb912-Jan-09 14:00
memberrgb912-Jan-09 14:00 
GeneralRe: wm_paint message in loop Pin
Francisco Campos Gualdron3-Jan-09 2:44
memberFrancisco Campos Gualdron3-Jan-09 2:44 
GeneralNew Version Pin
Francisco Campos Gualdron7-Nov-08 20:09
memberFrancisco Campos Gualdron7-Nov-08 20:09 
GeneralRe: New Version Pin
maplewang4-Mar-09 1:13
membermaplewang4-Mar-09 1:13 
GeneralToolbars [modified] Pin
Pandele Florin16-Nov-07 5:01
memberPandele Florin16-Nov-07 5:01 
GeneralImpresive effort made useless Pin
Pandele Florin13-Nov-07 6:32
memberPandele Florin13-Nov-07 6:32 
Generalmemory leak in demo Pin
laocaicai17-Oct-07 4:32
memberlaocaicai17-Oct-07 4:32 
GeneralGreat job Pin
maplewang12-Jul-07 16:01
membermaplewang12-Jul-07 16:01 
QuestionCRect Pin
esskar9-Jul-07 23:04
memberesskar9-Jul-07 23:04 
GeneralGood Job Pin
denisswap1-Jun-07 17:25
memberdenisswap1-Jun-07 17:25 
GeneralFYI - VCF, U++ Pin
stephen_w_simpson28-May-07 19:54
memberstephen_w_simpson28-May-07 19:54 
GeneralRe: FYI - VCF, U++ Pin
Francisco Campos Gualdron29-May-07 2:22
memberFrancisco Campos Gualdron29-May-07 2:22 
Generalnice project but.... Pin
DYH26-May-07 1:02
memberDYH26-May-07 1:02 
Hi Francisco.

First of all thanks a lot for your effort on this.

I've noticed rather surprising thing in SWC code. In CWnd::WndProc function, in case of WM_NCCREATE message and if it is a MDI window -- CREATESTRUCT->lpCreateParams (got as lParam) is pointing to a CWin memory overwritten by a MDICREATESTRUCT.

And you seems to know about it, and actually use this! I mean in your code you treat same address first as CWin* and later as MDICREATESTRUCT*. It works now but will break if size/internals of CWind changes.

Does such hackery really needed? I mean in terms maintenance this might be cause of big troubles, as to find such things (not by a chance as in my case) is really hard.

-- serg.
GeneralRe: nice project but.... Pin
Francisco Campos Gualdron29-May-07 2:24
memberFrancisco Campos Gualdron29-May-07 2:24 
GeneralRe: nice project but.... Pin
Jim Crafton13-Nov-07 7:31
memberJim Crafton13-Nov-07 7:31 
Questionhow to get it work under the mingw toolchain? Pin
snija024-May-07 12:54
membersnija024-May-07 12:54 
AnswerRe: how to get it work under the mingw toolchain? Pin
Francisco Campos Gualdron29-May-07 2:31
memberFrancisco Campos Gualdron29-May-07 2:31 
Generalcompile error Pin
kmlch23-May-07 19:17
memberkmlch23-May-07 19:17 
GeneralRe: compile error Pin
Francisco Campos Gualdron29-May-07 2:28
memberFrancisco Campos Gualdron29-May-07 2:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 23 May 2007
Article Copyright 2007 by Francisco Campos Gualdron
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid