?
Solved

Using resource templates in Win32 Apps

Posted on 2003-02-24
3
Medium Priority
?
287 Views
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.

0
Comment
Question by:GPaterson
  • 2
3 Comments
 
LVL 2

Expert Comment

by:Snurre
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...

switch(Message)
{
case WM_INITDIALOG:
     return TRUE;

case WM_PAINT:
     do Something;
     break;
}

someting like that, was this what you meant??
     

0
 
LVL 1

Author Comment

by:GPaterson
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?
0
 
LVL 2

Accepted Solution

by:
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;

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

     case WM_COMMAND:
          switch(LOWORD(wParam))
          {
          case IDOK:
               EndDialog(AboutWindow, 0);
               return FALSE;
                         
          case IDC_MO_INTERNET:
               ShellExecute(AboutWindow, "open", "http://othello.hda.nu", 0, 0, 0);
            EndDialog(AboutWindow, 0);
            return TRUE;
          }
          break;
     }

     return FALSE;
}

0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

594 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