Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!dkuug!rcbal!neh From: neh@rci.dk (Niels Erik Holm) Newsgroups: comp.windows.ms.programmer Subject: Windows extra bytes Keywords: RegisterWindow,CreateWindow,cbWndExtra Message-ID: <1991May16.080047.3388@rci.dk> Date: 16 May 91 08:00:47 GMT Organization: RC International, Copenhagen, Denmark Lines: 53 ------------------------------------------------------------------------ How to get the address of the (internal) window structure ???? ------------------------------------------------------------------------ Background: There have been some articles concerning the topic: How to retrieve user-defined data based on the window handle ? Several people have answered that one of the best way (and simplest) is to use the cbWndExtra field when the window class is created, and use GetWindowWord to access the values stored in the extra bytes. I have used this in the following way: struct ... table[MAX_WINS]; /* Structure array of any kind */ hWnd = CreateWindow(....); /* Create the window */ index = get_free_entry(); /* Get free entry into table */ SetWindowWord(hWnd,0,index); /* Store the index in the extra bytes */ ... ix = GetWindowWord(hWnd,0); /* Retrieve the index */ What I would like to is to store the structure (not just the index) associated with the window in the extra bytes allocated behind the (internal) windows structure. ... wc.cbWndExtra = sizeof(struct ...); ... RegisterClass(&wc); /* Register the window class */ My question is now: How can I get the address of the windows structure ? It is necessary to know the address in order to access the extra data area efficiently. Any help is appriciated. Best regards. Niels Erik Holm RC International Denmark Mail address: neh@rci.dk --------------------------------------------------------------------------- Every day, once a day, give yourself a present. Don't plan it, don't wait for it, just... let it happen. Could be a new shirt at the men's store, a catnap in your office chair, or two cups of good, hot, black coffee. (Dale Cooper in Twin Peaks). ---------------------------------------------------------------------------