Click here to Skip to main content
16,012,025 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: can I dynamically convert a base class object into a derived class object? Pin
Stephen Hewitt18-Jan-06 23:17
Stephen Hewitt18-Jan-06 23:17 
GeneralRe: can I dynamically convert a base class object into a derived class object? Pin
Prakash Nadar18-Jan-06 23:19
Prakash Nadar18-Jan-06 23:19 
QuestionChild Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas18-Jan-06 18:55
Axonn Echysttas18-Jan-06 18:55 
AnswerRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt18-Jan-06 19:11
Stephen Hewitt18-Jan-06 19:11 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas18-Jan-06 19:56
Axonn Echysttas18-Jan-06 19:56 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt18-Jan-06 20:00
Stephen Hewitt18-Jan-06 20:00 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas18-Jan-06 20:28
Axonn Echysttas18-Jan-06 20:28 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt18-Jan-06 20:57
Stephen Hewitt18-Jan-06 20:57 
Looks like it's because the child has 0 width and height. Also the hInstance is set wrong. Try this (but correct the hInstance):

<br />
hwndControl = CreateWindowEx //Creating the window.<br />
(<br />
NULL, //ExStyles.<br />
"Static", //Class name.<br />
Text, //Text of the label.<br />
lStyle, //Styles. = WS_CHILD | WS_VISIBLE<br />
0, //X.<br />
0, //Y.<br />
100, //Width.<br />
100, //Height.<br />
hwndThis, //Parent, the one created before...<br />
NULL, //Menu.<br />
(HINSTANCE)hwndThis, // <---This should be a HINSTANCE, not a HWND cast to a HINSTANCE<br />
NULL //CreateStruct.<br />
);<br />


In general casting should be avoided. For example without the (HINSTANCE) cast you would get a compiler but with it you're telling the compiler "just do it" and circumventing type checking.

Steve

-- modified at 3:05 Thursday 19th January, 2006
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas18-Jan-06 21:22
Axonn Echysttas18-Jan-06 21:22 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt18-Jan-06 21:44
Stephen Hewitt18-Jan-06 21:44 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas18-Jan-06 22:00
Axonn Echysttas18-Jan-06 22:00 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt18-Jan-06 22:03
Stephen Hewitt18-Jan-06 22:03 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas19-Jan-06 0:44
Axonn Echysttas19-Jan-06 0:44 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas19-Jan-06 1:07
Axonn Echysttas19-Jan-06 1:07 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt19-Jan-06 1:55
Stephen Hewitt19-Jan-06 1:55 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas19-Jan-06 2:23
Axonn Echysttas19-Jan-06 2:23 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Stephen Hewitt19-Jan-06 3:27
Stephen Hewitt19-Jan-06 3:27 
GeneralRe: Child Static Control not displayed when created when parent hidden !? Why!! Pin
Axonn Echysttas19-Jan-06 4:15
Axonn Echysttas19-Jan-06 4:15 
QuestionWPARAM and LPARAM ? Pin
Owner drawn18-Jan-06 17:50
Owner drawn18-Jan-06 17:50 
AnswerRe: WPARAM and LPARAM ? Pin
Prakash Nadar18-Jan-06 17:57
Prakash Nadar18-Jan-06 17:57 
AnswerRe: WPARAM and LPARAM ? Pin
Christian Graus18-Jan-06 17:58
protectorChristian Graus18-Jan-06 17:58 
QuestionRe: WPARAM and LPARAM ? (What about HWND...Where should it go?) Pin
Owner drawn18-Jan-06 18:02
Owner drawn18-Jan-06 18:02 
AnswerRe: WPARAM and LPARAM ? (What about HWND...Where should it go?) Pin
Prakash Nadar18-Jan-06 18:15
Prakash Nadar18-Jan-06 18:15 
AnswerRe: WPARAM and LPARAM ? Pin
Blake Miller19-Jan-06 8:02
Blake Miller19-Jan-06 8:02 
GeneralRe: WPARAM and LPARAM ? Pin
Owner drawn19-Jan-06 16:54
Owner drawn19-Jan-06 16:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.