This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Set/GetWindowLong doesn't seem work


Hi Daniel,


Daniel Mironowicz wrote:
> SetWindowLong(hwnd, 0, (LONG)hEdit);
> And when i use GetWindowLong(hwnd, 0) to get edit handle I don't get it.

I think you forgot to reserve the space for that data. In the
initialization of the WNDCLASS struct for the DocWindow, do

    wnd.cbWndExtra = sizeof(LONG);


Other things I notice:

- You call GetWindowLong() on your MDI frame once, but you never set
anything in that window. You should probably rename your variables to
make sure you know which of your three HWNDs you are dealing with in
each place.

- You should memset() all structures to 0 before using them. It's a good
habit to get into with structures, especially with those that you didn't
define yourself. I got bitten by that one precisely with WNDCLASS.

- In Win/32 you can call GetLastError() if *anything* fails. This gives
you a hint most of the time (at least it does for me).


so long, benny
======================================
Benjamin Riefenstahl (benny@crocodial.de)
Crocodial Communications EntwicklungsGmbH
Ophagen 16a, D-20257 Hamburg, Germany
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]