473,473 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to make the DlgProc a class method?

1 New Member
Hi all,
I'm writing a Win32 app with VC 2005 unmannaged code.
I started a new project from scratched.
I want to have a class for the Dialog form that handle everyting for that form (processing messages and so on...).
In the WinMain() I want to create an object of the class I wrote.
Because DefProc is a CALLBACK function, i'm having hard time to change it to be another method in my form class.
I want to be able to create multiple instances of the same class.
How to change this DlgProc as a class method?
Thanks in advanced, Rami.

here is the Dialog Procedure that I want to make a class method:

Expand|Select|Wrap|Line Numbers
  1. LRESULT CALLBACK dlgTest_DlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, LPARAM dwInitParam )
  2. {
  3.     switch( uMsg )
  4.     {
  5.         //case WM_INITDIALOG : //Initilize the form controls.
  6.  
  7.         case WM_COMMAND :
  8.             ControlEvents(LOWORD(wParam), HIWORD (wParam));
  9.             return TRUE;
  10.  
  11.         case WM_CLOSE:
  12.             PostQuitMessage(0);
  13.             return FALSE;
  14.  
  15.         case WM_DESTROY:
  16.             DestroyWindow (hDlg);
  17.             return FALSE;
  18.  
  19.         default :
  20.             return( FALSE );
  21.     }
  22.  
  23.     return( FALSE );
  24. }
  25.  
Please note that the 'ControlEvent' is a class method that process each control events on the form, but for this to work I need the dlgTest_DlgProc to also be a class method.
Jul 5 '07 #1
1 3003
weaknessforcats
9,208 Recognized Expert Moderator Expert
Try making dlgTest_DlgProc a friend to your class. That way it does not need to be a member function and it will have access to the object's private data.
Jul 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Nick | last post by:
I have the following code: var obj = {a:0, b:1, ...} function f() {...} obj.f = f // This will make a instance method? How to make a Class method for the class of obj? Or what's the...
5
by: Hitesh Patel | last post by:
hi friends, read following code and my problem. class B { private: public: void fun1(void) {
10
by: Nicolas Fleury | last post by:
Hi everyone, I was wondering if it would make sense to make staticmethod objects callable, so that the following code would work: class A: @staticmethod def foo(): pass bar = foo() I...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
28
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
11
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke...
7
by: Kurda Yon | last post by:
Hi, I have a class called "vector". And I would like to define a function "dot" which would return a dot product of any two "vectors". I want to call this function as follow: dot(x,y). Well,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.