Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Using resource templates in Win32 Apps

Posted on 2003-02-24
Medium Priority
Last Modified: 2010-04-01
This should be a simple question to most of you experts,
In an effort to move with the times I have decided to try using resource templates instead of manually coding all my gui's.
I have added a resource template for a dialog box to my Win32 application however, the events... option when right clicking on the control is disabled and I cant figure out how to enable it so that I can tie in events to functions in my program. I also cant seem to get a ResourceView tab in my project inbetween ClassView and FileView.

So basically, my question is, how do I manually go about adding the ability to work with resource templates to my Win32 App.

Please dont answer with a solution like "Create and MFC app wizard project" or something simillar as this is not what I want to acheive.

Question by:GPaterson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 8010310
First of all... Did u choose Resource Script so you diden't pick the wrong one when creating the Resource...

And you can tie events in the Dialog... in the
switch(Message) you can add the events you need

for ex...

     return TRUE;

case WM_PAINT:
     do Something;

someting like that, was this what you meant??


Author Comment

ID: 8015277
Ah, I had added the wrong one at first. Now that I add a resource script and not a template the ResourceView has appeared and the Class Wizard is now available when I right click on a recource but the events... option is still not available. What do I need to do to enable that?

Accepted Solution

Snurre earned 280 total points
ID: 8018547
To do that, you need to create the following...

//In your program's Main Header File you add this...
BOOL CALLBACK DlgAbout(HWND AboutWindow, UINT Message, WPARAM wParam, LPARAM lParam);

// The in the *.cpp File you write something like this...
BOOL CALLBACK DlgAbout(HWND AboutWindow, UINT Message, WPARAM wParam, LPARAM lParam)
     HWND Version;

     case WM_CREATE:
          Version = GetDlgItem(AboutWindow, IDC_VERSION);
          SetDlgItemText(AboutWindow, IDC_VERSION, "Some Text);          
          return TRUE;

     case WM_COMMAND:
          case IDOK:
               EndDialog(AboutWindow, 0);
               return FALSE;
          case IDC_MO_INTERNET:
               ShellExecute(AboutWindow, "open", "", 0, 0, 0);
            EndDialog(AboutWindow, 0);
            return TRUE;

     return FALSE;


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question