Click here to Skip to main content
6,935,947 members and growing! (19,336 online)
Email Password   helpLost your password?
 
Platforms, Frameworks & Libraries » WTL » General     Intermediate License: The Code Project Open License (CPOL)

Resourceless dialogs

By Trilobyte

How to create a resourceless dialog in wtl using the Resourceless Dialog Toolkit from Trilobyte-Solutions.nl
C++, Windows, Visual-Studio, WTL, Dev
Posted:15 Aug 2004
Updated:16 Aug 2004
Views:42,512
Bookmarked:14 times
printPrint Friendly   add Share
      Discuss Discuss   Broken Article?Report  
16 votes for this article.
Popularity: 4.37 Rating: 3.63 out of 5
2 votes, 12.5%
1
2 votes, 12.5%
2
1 vote, 6.3%
3
4 votes, 25.0%
4
7 votes, 43.8%
5

Introduction

There is one problem if you have designed a dialog and you want to share it with other people. For example: I thinking about creating a typical "Tip of the Day" dialog able to read in a xml file. I wanted to share it with anyone who needs it. The problem was: How can I distribute the code without messing around with multiple resource scripts. I searched the Internet for a while and found some information about the Windows API. It was rather easy, but it had some nasty things you needed to look out for. Example all data had to be aligned at DWORD boundaries. I found out is was really hard to create a dialog without the dialog editor, so I wrote a small tool capable of parsing a resource script and export a dialog from it. I packet those two things together and the Resourceless Dialog Toolkit was born.

Using the code

I have spent a few hours to create documentation and a tutorial, so I'm giving you a small class showing you how the code works.

class CSampleDlg: public CResourcelessDlg<CSampleDlg>, 
  public CWinDataExchange<CSampleDlg>
{
public:
  BEGIN_MSG_MAP(CSampleDlg)
    MSG_WM_INITDIALOG(OnInitDialog)
    CHAIN_MSG_MAP(CResourcelessDlg<CSampleDlg>)
  END_MSG_MAP()
  BEGIN_DDX_MAP(CSampleDlg)
  END_DDX_MAP()

  // Dialog function

  void CreateDlg()
  {
    CreateDlgTemplate("About", DS_SETFONT|DS_MODALFRAME
      |WS_CAPTION|WS_SYSMENU, 
      0, 0, 0, 186, 138, 8, "MS Sans Serif", "", "");
    AddStatic("Dialog Extractor v1.0", 0, 0, 60, 20, 67, 8, IDC_STATIC);
    AddStatic(IDR_MAINFRAME, SS_ICON, 0, 20, 20, 20, 20, 18);
    AddButton("", 0 | BS_GROUPBOX, 0, 7, 7, 172, 103, IDC_STATIC);
    AddStatic("(c) Copyright 2004", 0, 0, 60, 30, 58, 8, IDC_STATIC);
    AddStatic("By: Trilobyte-Solutions", 0, 0, 60, 41, 70, 8, IDC_STATIC);
    AddStatic("Updates and additional information about"
      " this program can be found at 
      the Trilobyte Solutions website.", 0, 0, 60, 59, 113, 26,  IDC_STATIC);
    AddStatic("www.Trilobyte-Solutions.nl", 0, 0, 60, 94, 84, 8, IDC_STATIC);
    AddButton("OK", 0|BS_DEFPUSHBUTTON, 0, 67, 117, 50, 14, IDOK);
  }
  LRESULT  OnInitDialog(HWND, LPARAM)
  {
    DoDataExchange(false);

    CenterWindow(GetParent());
    return IDOK;
  }
};
As you see it is really easy to use the code. More information can be found in the documentation and tutorial inside the toolkit.

If you want to know more about the underlaying technique. Look one of the following items up in the MSDN: DLGTEMPLATE, DLGITEMTEMPLATE, CreateDialogIndirectParam and DialogBoxIndirectParam. If there are enough request, I will write a article about the Windows dialog API.

The Tip of the Day dialog

The dialog I told you about earlier in this article is not ready yet. At the end of the next week it probably will be ready.

History

The code is version 1.0. The tool is version 1.1, there were some bugs found.

Additional Information

For additional information, questions and bug report, visit my website: http://www.trilobyte-solutions.nl/, or contact me at bertwillems@trilobyte-solutions.nl.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Trilobyte


Member
I am Bert Willems a 24 year old developer living in Drachten, The Netherlands. I was born on 4 July 1985 in Drachten. My great passion is development of software, I simply love doing it. Since I was young I have been fascinated by technique and constructing things, first with Lego and later on things for the computer. I started with simple websites and some scripting of games, and then I decided I would make a career out of it and started with the development of business software. I am not sure why I love programming so much, but I know it has something to do with expressing my creativity in it.
Occupation: Technical Lead
Company: Premotion, Liones Internet BV
Location: Netherlands Netherlands

Other popular WTL articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 20 of 20 (Total in Forum: 20) (Refresh)FirstPrevNext
GeneralNew location for the article downloads PinmemberTrilobyte1:19 30 Apr '09  
GeneralVery Nice! [modified] Pinmembermcc2vc16:23 5 Dec '08  
GeneralSynchronicity! PinmemberJerry Evans6:25 16 Aug '04  
Generalsource code Pinmemberbishbosh021:41 16 Aug '04  
GeneralRe: source code PinmemberMr. TriloByte4:50 16 Aug '04  
GeneralRe: source code Pinmemberbishbosh0220:55 16 Aug '04  
General[Msg Deleted] PinmemberRodrigo Pinho Pereira de Souza6:49 1 Sep '05  
GeneralRe: source code PinmemberRalph Walden5:27 24 Aug '04  
GeneralRe: source code PinmemberRodrigo Pinho Pereira de Souza9:50 2 Sep '05  
GeneralDialog Extractor update PinmemberMr. TriloByte0:09 16 Aug '04  
GeneralSource code of the Resource extractor? PinsussJeroen Walter23:02 15 Aug '04  
GeneralRe: Source code of the Resource extractor? PinmemberMr. TriloByte0:02 16 Aug '04  
GeneralRe: Source code of the Resource extractor? PinsussAnonymous21:57 3 May '05  
The file is not loaded:

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /var/www/html/download.php on line 113
Access denied for user: 'ts@localhost.localdomain' (Using password: YES)
GeneralRe: Source code of the Resource extractor? PinsussAnonymous22:01 3 May '05  
GeneralRe: Source code of the Resource extractor? PinmemberRodrigo Pinho Pereira de Souza9:48 2 Sep '05  
Generalis it realy needed ? PinmemberMandalay21:00 15 Aug '04  
GeneralRe: is it realy needed ? PinsussJeroen Walter23:13 15 Aug '04  
GeneralRe: is it realy needed ? PinmemberRalph Walden5:18 24 Aug '04  
GeneralRe: is it realy needed ? PinmemberSimon Cooke13:17 21 Jan '05  
GeneralRe: is it realy needed ? PinmemberJeroen Walter4:34 24 Jan '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

PermaLink | Privacy | Terms of Use
Last Updated: 16 Aug 2004
Editor: Nishant Sivakumar
Copyright 2004 by Trilobyte
Everything else Copyright © CodeProject, 1999-2010
Web18 | Advertise on the Code Project