🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.ms-windows.programmer.misc
1 messages
1 total messages Started by Richard Janssen Mon, 25 Jan 1993 12:37
Subclassing dialog controls
#2314
Author: Richard Janssen
Date: Mon, 25 Jan 1993 12:37
74 lines
2995 bytes
Hello, I posted this problem a week ago and got
some answers, but none solved the problem.
That's why I decided to repost and once again
ask if one of you people can help me out.

This is a short description of the problem:

I try to "subclass" controls in a dialog (created from a .DLG template)
by replacing there Window procedure by my own. I do this by calling 
SetWindowLong(..) in the handling of the WM_INITDIALOG message in the
Dialog Procedure.

The old Window procedure of the control (returned by SetWindowLong())
is stored. The new Window procedure of the control is set up to call
the old Window Procedure for all messages that are not processed.

Here is what my code looks like:

(The variable oldWindowProc is part of a C++ class for the
 control, so appropriate storage space the old Window Procedure is
 arranged.)  

/* DIALOG PROCEDURE */  
... DialogProc (...., WORD wParam, ...)     

   switch (wParam)
   {
      case WM_INITDIALOG: 
         oldWindowProc = SetWindowLong(GetDlgItem(hDlg,ID_CONTROL),
                                       MakeProcInstance(hInst,NewWinProc)); 
         break;  
      ...  
   } 



/* NEW WINDOW PROCEDURE */  
... NewWinProc (HWND hWin, WORD wMsg, WORD  wParam, LONG lParam)   
{
   switch (wMsg)
   {
      ...

      default:
         return CallWindowProc(oldWindowProc, wMsg, wParam, lParam);
         break;

   }

}

The actual problem? As soon as the dialog displays the subclassed control
is not displayed!! The Window is created though, which is shown by
Borlands' WinSight (Borland version of Spy).
In fact if the control is a button, it does display if i click my left
mouse button over it. If i release the mouse button outside the button,
the button stays visble! But now comes the strange part: Firt i drag the
dialog box, so that the button is off the screen.  After releasing the
mouse button i again drag the dialog box, moving the button position
back onto the screen. The button is not drawn, it is invisble !!!
Pressing the left mouse button over it displays it again, which
means the window is still there.

I have tried lots of things like calling ShowWindow() and EnableWindow()
after calling SetWindowLong(), it just doesn't work!!!

Can anybody please help me out !! I'm starting to get desperate !!

Mail to me at: R.H.P.Janssen@research.ptt.nl



Thanks ahead, Richard Janssen
PTT Research, The Netherlands
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads