delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/02/09/03:19:44

From: benny AT crocodial DOT de (Benjamin Riefenstahl)
Subject: Re: Set/GetWindowLong doesn't seem work
9 Feb 1998 03:19:44 -0800 :
Message-ID: <34DEE107.ED703696.cygnus.gnu-win32@crocodial.de>
References: <01bd3483$cd981c20$LocalHost AT ppp>
Mime-Version: 1.0
To: GNU-Win32 Mailing list <gnu-win32 AT cygnus DOT com>

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 AT crocodial DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019