Hi, I'm using RECT r; GetClientRect(hWnd,&r); CreateWindow(WC_EDIT,etc,etc,r.right,r.bottom....); to get the client area of my window and putting an edit control in there which should fit precisely. I noticed that the returned value for the first window created by the application is wrong. The height is 10 pixels short(about the same height as a titlebar). When used with any subsequently created windows the value is correct. Does anybody know what this is about? Maybe a bug?
Harco
Posts
-
GetClientRect with initial window wrong? -
Finding the sum of all intergers between x & yFinding the sum of the numbers between two integers can be done as follows: int i = x + 1; // we start counting 1 higher then x // or make this i = x if you want to include x int sum = 0; while (i < y) { // repeat while we haven't reached y // or make this i<=y if you want to include y sum = sum + i; i++; } voila. or shorter: int sum = 0; for (int i=x+1;i
-
inhereted static member referencingI have the following class:
class BaseClass { static char* wp; void Dynamic(char* s) { this->wp = s; } }
and a derivative:class Derived : public BaseClass { // static char* wp; // have been trying this, not sure if needed }
Basically, what I want to accomplish is this: I want to reference the static member wp of the derived class in the inhereted function and reference the BaseClass member in the Baseclass function so..BaseClass *bc = new BaseClass(); Derived *d = new Derived(); bc->Dynamic("something"); d->Dynamic("something else");
After this code, I want bc::wp != d::wp, but alas, bc::wp == d::wp == "something else". I would LIKE to have bc::wp == "something" and d::wp == "something else". Anybody have any clues as to how I might realise this? And yes I do realise I could make them non-static, but I am interested in a way of doing this... if at all possible. -
SetWindowLong using a class member function?This is exactly what I have now.. and doesn't work. Are you sure this is supposed to work?
-
SetWindowLong using a class member function?Hi I have the following situation: SetWindowLong(hWnd,GWL_WNDPROC,(LONG)MyOwnWndProc); MyOwnWndProc is a member function of a class I've made. Now I was wondering if it's possible to somehow convert a pointer to the function or something to a LONG. In its current state this won't compile. I've already tried making a class member pointer, and tried to convert that to a LONG, but alas no go. And no, I don't want to use a non-class function. I really need to know if it's possible with a class function. Many thanks in advance, DanglingDude
-
Creating a button without using CButtonAaaah, this is exactly what I needed. Thanks alot!
-
Creating a button without using CButtonHi, Don't ask me why, but I wanna create a button the hard way. I don't want to use the CButton class. So basically I want to call the CreateWindow function with a class I registered my self. I already discovered I can use the predefined control-class WC_BUTTON with the following call to get a button on my window: CreateWindow(WC_BUTTON,"caption",,0,0,200,200,hWnd,NULL,hInstance,NULL); only problem is, I can't link an eventhandler to the button, right? Or maybe I just don't know how.. Anyways, the other way I thought of was registering my own class (using RegisterClass and the WNDCLASS struct) and specifying my own WndProc to handle events. But how do I configure the class as a button, in other words how do I make it look like a button, which is pushable? Or will it actually be that hard that I need to define my own graphics, on MBUTTONDOWN the sunken box is painted, etc. I'm just interested in the way this stuff works... if somebody knows something, please let me know too :) Many thanks in advance, DanglingDude.