newbie question: hellowin on Windows NT

Quoß, Clemens clemens.quoss@gzs.de
Fri Oct 27 13:41:00 GMT 2000


Hello Rick,
thanks for your answer. I actually forgot one line of code:
Instead of ...
 if (!hPrevInstance) {
 wndclass.style = CS_HREDRAW | CS_VREDRAW;
 wndclass.lpfnWndProc = WndProc;
 wndclass.cbClsExtra = 0;
 wndclass.hInstance = hInstance;
 wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
 wndclass.lpszMenuName = NULL;
 wndclass.lpszClassName = szAppName;
 RegisterClass (&wndclass);
 } /* if */
it had to be ...
 if (!hPrevInstance) {
 wndclass.style = CS_HREDRAW | CS_VREDRAW;
 wndclass.lpfnWndProc = WndProc;
 wndclass.cbClsExtra = 0;
 wndclass.cbWndExtra = 0; <==== forgotten line
 wndclass.hInstance = hInstance;
 wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
 wndclass.lpszMenuName = NULL;
 wndclass.lpszClassName = szAppName;
 RegisterClass (&wndclass);
 } /* if */
I think this does the same as you suggested.
I have another question, though. I know that this is not a mailing list 
on how to learn programming Windows, but maybe someone has
a quick answer here:
Petzold writes in his book, that when you move the thumb on a vertical 
scrollbar, you receive a WM_VSCROLL message with wParam 
SB_THUMBPOSITION when the mouse button is released.
 <<sysmets2.c>> <<sysmets.h>> 
When I inspect this piece of code (sysmets2.c, you also need sysmets.h to 
compile it) with gdb and move
the thumb on the vertical scrollbar I always get 4 WM_VSCROLL
messages:
1. WM_VSCROLL message: wParam = 5 (SB_THUMBTRACK)
2. WM_VSCROLL message: wParam = arbitrarious (integer value > 100.000, seems 
to depend on how far the mouse was moved), lParam = 0
3. WM_VSCROLL message: wParam = arbitrarious (integer value > 100.000, only 
slightly different from 2. message), lParam = 0
4. WM_VSCROLL message: wParam = 8 (SB_ENDSCROLL), lParam = 0
When I simply tip on the thumb without moving it, I get 3 WM_VSCROLL messages:
1. WM_VSCROLL message: wParam = 5 (SB_THUMBTRACK), lParam = 0
2. WM_VSCROLL message: wParam = 4 (SB_THUMBPOSITION), lParam = 0
3. WM_VSCROLL message: wParam = 8 (SB_ENDSCROLL)
What I would expect from what Petzold writes is that I get everytime a 
SB_THUMBPOSITION with the lParam containing the integer value of the 
thumb position (range depending on the SetScrollRange Command issued
on WM_CREATE).
The book I got is 'Programming Windows 3.1', but the API cannot have changed
that fundamentally, can it?
When I compile the same source with my MSVC++ 16bit Standard Edition Compiler,
it works fine. But I have not debugged it now to have a look on the WM_VSCROLL
issued there.
Does anyone has any suggestions here?
TIA
Clemens Quoss
> Hi, 
>> I see the same behaviour. 
> Zero the wndclass structure before you use it...add the following at around line 34 
> memset (&wndclass, 0, sizeof(wndclass)); 
>>> Rick 
>> > -----Original Message----- 
> > From: "Quoß, Clemens" [< mailto:clemens.quoss@gzs.de >] 
> > Sent: 25 October 2000 09:52 
> > To: 'cygwin@sources.redhat.com' 
> > Subject: newbie question: hellowin on Windows NT 
> > 
> > 
> > 
> > Hello, 
> > 
> > [...]
> > 
> > <<hellowin.c>> <<tocygwin.txt>> > > 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysmets.h
Type: text/x-c
Size: 2925 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20001027/4ac4befd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sysmets2.c
Type: text/x-c
Size: 4541 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20001027/4ac4befd/attachment-0001.bin>


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /