kevin@msa3b.UUCP (Kevin P. Kleinfelter) (05/08/91)
Is it safe to assume that window class "extra" bytes and window instance "extra" bytes are initialized to 0 by Windows? (i.e. if I RegisterClass with the cbClsExtra field set to 2, will I get a word of 0 or a word of random value. I always seem to get a zero word, but can I COUNT on this.) -- Kevin Kleinfelter @ DBS, Inc (404) 239-2347 ...gatech!nanoVX!msa3b!kevin English Lesson: THEIR home is over THERE. THERE is one house. THEY'RE not home. "Its" & "their" are like 'his'. "They're" == "they are." "It's" == "it is." If you can do regular expressions, you can handle a natural language. Syntax!
risto@tuura.UUCP (Risto Lankinen) (05/13/91)
kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >Is it safe to assume that window class "extra" bytes and window instance >"extra" bytes are initialized to 0 by Windows? >(i.e. if I RegisterClass with the cbClsExtra field set to 2, will I >get a word of 0 or a word of random value. I always seem to get a zero word, >but can I COUNT on this.) Hi! I WOULDN'T COUNT on it. I would also like to DISCOURAGE ANYONE FROM DOING SO, because I'd like to see the following as a documented way to use the RegisterClass() in forthcoming versions of Windows' SDK (Mike Stella, Mike Stella, Robin Illinois Stella Tango Oliver calling do you read me, over ;-) typedef struct { ... // current contents of WNDCLASS ... BYTE bClsExtra[]; // or WORD, or DWORD or whatever as long as something } WNDCLASS,*PWNDCLASS, ... ... so you could use a construct LocalAlloc( ...,sizeof(WNDCLASS)+CLS_XTRA ) and 'npWndCls->bClsExtra[INDEX] = MyData' within the registration itself, to get the extra class bytes defined right when the class is being registered. To make them initialize to zero, one would *use* zero, thus the behaviour in question wouldn't be voided, nor the current actual RegisterClass() usage. Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************
kensy@microsoft.UUCP (Ken SYKES) (05/15/91)
In article <1636@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >Is it safe to assume that window class "extra" bytes and window instance >"extra" bytes are initialized to 0 by Windows? I don't know if you can count on this or not but in general assuming the value of something not initialized by you is a bad practice. Based on your second paragraph you know that too but are hoping to get away without extra initialization. Slacker! ;) Ken Sykes Disclaimer: The above opinions are solely my own.