Re: edit box changes color
Why do you want to implement your own window procedure for this edit box? Is it some non-standard one?
Re: edit box changes color
It is custom window proc for my main window's child windows. Newest of them is this edit box. This procedure existed before this edit box. Edit box is the last created control on my main window.
Re: edit box changes color
But you don't "process any messages" to youredit box "inside the window proc". Then why do you set it for this control? :confused:
Re: edit box changes color
What does myWindowProc() actually do? It could be helpful if you posted the code.
Re: edit box changes color
Quote:
Originally Posted by
VictorN
But you don't "process any messages" to youredit box "inside the window proc". Then why do you set it for this control? :confused:
Great question. Actually, I want to write the WM_LBUTTONDOWN code for this edit box. But before I do that, I want to know why is my edit box black when I just use SetWindowLong.
Re: edit box changes color
Quote:
Originally Posted by
2kaud
What does myWindowProc() actually do? It could be helpful if you posted the code.
myWindowProc mostly responds to mouse clicks on child controls. And it works fine.
Re: edit box changes color
Quote:
Originally Posted by
user125
... But before I do that, I want to know why is my edit box black when I just use SetWindowLong.
I guess it is because your procedure does not handle WM_PAINT for edit box.
Re: edit box changes color
Quote:
Originally Posted by
VictorN
I guess it is because your procedure does not handle WM_PAINT for edit box.
You 're right; It doesn't handle anything for edit box, yet. I've just set the procedure as it's window proc, and it changed color. I would like to know what I should do in WM_PAINT to restore my edit box to its default appearance.
Re: edit box changes color
Try to call the default procedure for edit box.
Re: edit box changes color
Quote:
Originally Posted by
user125
myWindowProc mostly responds to mouse clicks on child controls. And it works fine.
Probably not. That's why you have the issue. :) Within myWindowProc() for messages not handled (and for those handled but you also want to be handled by the control) you need to call the default procedure for the specific control using CallWindowProc(). This is the value returned from SetWindowLong(GWL_WNDPROC).
See https://msdn.microsoft.com/en-us/lib...lassing_window for an example.
Re: edit box changes color
Quote:
Originally Posted by
2kaud
Probably not. That's why you have the issue. :) Within myWindowProc() for messages not handled (and for those handled but you also want to be handled by the control) you need to call the default procedure for the specific control using CallWindowProc(). This is the value returned from SetWindowLong(GWL_WNDPROC).
See
https://msdn.microsoft.com/en-us/lib...lassing_window for an example.
Sorry, but I 've always had CallWindowProc() within myWindowProc. I have several completely functional controls handled by this procedure. Only this newest one, the edit box, have this unexpected behaviour. I probably have to write something in WM_PAINT or similar.
Re: edit box changes color
the answer is pretty Obvious imo.
you have an error in your myWindowProc causing that effect.
likely becuase yuou only implemented the few messages you'r einterested in and none of the others
if you replace the messageprocedure, you're responsible to make sure ALL of the message get handled properly.
Either by handlign everything yourself, or by making sure you call the old handler for anything you don't.