Problems with LPRECT..
-
LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300;
This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why? -
LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300;
This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why?LPRECT
is a pointer to aRECT
, so your code dereferences an uninitialized pointer. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas." -- Buffy -
LPRECT rect; rect->left = 100; rect->right = 200; rect->top = 100; rect->bottom = 300;
This is the code that should be executed when i click a button. However, when I click it, I get an error, it terminates my process. Why?Don't use LPRECT. Basically that means CRect *pRect, which is probably not what you really want. Use RECT instead. Then you can create an object just like something else. MFC uses CRect which can implicitly cast to RECT. This class contains some really handy methods. For instance Width() and Height().