Click here to Skip to main content
15,861,168 members
Articles / Desktop Programming / MFC
Article

Pretty WinAPI Class

Rate me:
Please Sign up or sign in to vote.
4.90/5 (36 votes)
23 May 20074 min read 95.4K   2.7K   80   26
New library version that is not WTL/MFC dependent

Screenshot - DevStudioSmall.jpg

Screenshot - OutlookDemoSmall.jpg

Screenshot - MDISmall.jpg

Introduction

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.

Overview

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:

History

  • 23 May, 2007 - Version 0.1 released

License

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


Written By
Colombia Colombia
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.

Francisco.camposg@outlook.com

Comments and Discussions

 
QuestionThank you, Francisco Pin
David O'Neil6-Jul-14 19:57
professionalDavid O'Neil6-Jul-14 19:57 
GeneralMy vote of 5 Pin
Agump31-Mar-13 22:49
Agump31-Mar-13 22:49 
GeneralImpressive Pin
Mitch D5-Feb-12 15:34
Mitch D5-Feb-12 15:34 
GeneralCan't compile Dev-C++ (gcc) version :( Pin
tootall25-Jan-11 9:43
tootall25-Jan-11 9:43 
GeneralRe: Can't compile Dev-C++ (gcc) version :( Pin
Francisco Campos Gualdron15-Mar-12 8:42
Francisco Campos Gualdron15-Mar-12 8:42 
GeneralCompiled Binaries Please Pin
Alex Essilfie30-Jun-10 2:38
Alex Essilfie30-Jun-10 2:38 
Generalwm_paint message in loop Pin
rgb912-Jan-09 14:00
rgb912-Jan-09 14:00 
GeneralRe: wm_paint message in loop Pin
Francisco Campos Gualdron3-Jan-09 2:44
Francisco Campos Gualdron3-Jan-09 2:44 
GeneralNew Version Pin
Francisco Campos Gualdron7-Nov-08 20:09
Francisco Campos Gualdron7-Nov-08 20:09 
GeneralRe: New Version Pin
maplewang4-Mar-09 1:13
maplewang4-Mar-09 1:13 
GeneralToolbars [modified] Pin
Pandele Florin16-Nov-07 5:01
Pandele Florin16-Nov-07 5:01 
GeneralImpresive effort made useless Pin
Pandele Florin13-Nov-07 6:32
Pandele Florin13-Nov-07 6:32 
Generalmemory leak in demo Pin
laocaicai17-Oct-07 4:32
laocaicai17-Oct-07 4:32 
if demo leaves alone for about 5 minutes,it'll dead,
can you check its why?
GeneralGreat job Pin
maplewang12-Jul-07 16:01
maplewang12-Jul-07 16:01 
QuestionCRect Pin
esskar9-Jul-07 23:04
esskar9-Jul-07 23:04 
GeneralGood Job Pin
denisswap1-Jun-07 17:25
denisswap1-Jun-07 17:25 
GeneralFYI - VCF, U++ Pin
stephen_w_simpson28-May-07 19:54
stephen_w_simpson28-May-07 19:54 
GeneralRe: FYI - VCF, U++ Pin
Francisco Campos Gualdron29-May-07 2:22
Francisco Campos Gualdron29-May-07 2:22 
Generalnice project but.... Pin
DYH26-May-07 1:02
DYH26-May-07 1:02 
GeneralRe: nice project but.... Pin
Francisco Campos Gualdron29-May-07 2:24
Francisco Campos Gualdron29-May-07 2:24 
GeneralRe: nice project but.... Pin
Jim Crafton13-Nov-07 7:31
Jim Crafton13-Nov-07 7:31 
Questionhow to get it work under the mingw toolchain? Pin
snija024-May-07 12:54
snija024-May-07 12:54 
AnswerRe: how to get it work under the mingw toolchain? Pin
Francisco Campos Gualdron29-May-07 2:31
Francisco Campos Gualdron29-May-07 2:31 
Generalcompile error Pin
kmlch23-May-07 19:17
kmlch23-May-07 19:17 
GeneralRe: compile error Pin
Francisco Campos Gualdron29-May-07 2:28
Francisco 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.