Up-Down (SPin Controls and Win32 API 
Author Message
 Up-Down (SPin Controls and Win32 API

I was putting together some PB/DLL code using the spin (up-down) control,
and noticed these lines in the Win32API.INC file supplied by powerbasic:

%UDM_SETRANGE           = (%WM_USER+101)
%UDM_GETRANGE           = (%WM_USER+102)
%UDM_SETPOS             = (%WM_USER+103)
%UDM_GETPOS             = (%WM_USER+104)
%UDM_SETBUDDY           = (%WM_USER+105)
%UDM_GETBUDDY           = (%WM_USER+106)
%UDM_SETACCEL           = (%WM_USER+107)
%UDM_GETACCEL           = (%WM_USER+108)
%UDM_SETBASE            = (%WM_USER+109)
%UDM_GETBASE            = (%WM_USER+110)

I found the same usage in the Borland C++ compilers commctl.h file - that
is, expressing these control messages in terms of WM_USER + (number).

Now my code works fine with these values (UDM_SETACCEL returns 0, but the
set still worked, so that's no doubt an error in the MSDN Library), but I
was thinking.....

I thought the message range WM_USER (x'400') to x'7FFF' was supposed to be
defined as, well, "user-defined."

Does anyone know: Are/have these UDM_xxx messages going to be/been redefined
in terms of "hard" numbers, with a corresponding adjustment in WM_USER to
accommodate the new messages? Or do Microsoft, PowerBASIC and Borland expect
us to remember that private messages need to go in the range WM_USER +(some
undefined number)  to x'7FFF'?

Or am I missing something vis-a-vis common controls or something else?

--
Michael Mattias
Tal Systems
Racine WI USA



Sun, 02 Feb 2003 03:00:00 GMT  
 Up-Down (SPin Controls and Win32 API

Quote:

>I was putting together some PB/DLL code using the spin (up-down) control,
>and noticed these lines in the Win32API.INC file supplied by PowerBASIC:
..snip
>%UDM_SETACCEL           = (%WM_USER+107)
snip...
>I found the same usage in the Borland C++ compilers commctl.h file - that
>is, expressing these control messages in terms of WM_USER + (number).
>Now my code works fine with these values (UDM_SETACCEL returns 0, but the
>set still worked, so that's no doubt an error in the MSDN Library), but I
>was thinking.....

#INCLUDE "commctrl.inc"
FUNCTION PBMAIN
    PRINT %UDM_SETACCEL
    WAITKEY$
END FUNCTION

Returns 1131 for %UDM_SETACCL...  are you sure you did not use an
undeclared variable instead on an equate for your test?

Quote:
>I thought the message range WM_USER (x'400') to x'7FFF' was supposed to be
>defined as, well, "user-defined."

They are, but Microsoft are also 'users', and have thoughtfully
defined some of these values to make life more interesting for you,
especially if you have not chosen your own user-defined message values
carefully.  Acyually there are a LOT of common control message value
defined in this range.

It may be better for you to use RegisterWindowMessage() to protect
your private message values, so you will not conflict with anything
that a common control or 3rd-party library starts dishing out,

Quote:
>Does anyone know: Are/have these UDM_xxx messages going to be/been redefined
>in terms of "hard" numbers, with a corresponding adjustment in WM_USER to
>accommodate the new messages?

Microsoft reserve the right to redefine any of these values, such as
they did when then moved from Win 3.x to Win 95.  Thus far, %WM_USER
has not changed in value or it would have broken a great many existing
applications that are out there.

Quote:
>Or do Microsoft, PowerBASIC and Borland expect
>us to remember that private messages need to go in the range WM_USER +(some
>undefined number)  to x'7FFF'?

You gotta remember this yourself, just like you gotta remember to open
your mouth before placing the glass of water too your lips! (smile!)

Quote:
>Or am I missing something vis-a-vis common controls or something else?

Welcome to the World of Windows... !

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Thu, 06 Feb 2003 10:59:27 GMT  
 Up-Down (SPin Controls and Win32 API

Quote:
> ..snip
> >%UDM_SETACCEL           = (%WM_USER+107)
> snip...

> >Now my code works fine with these values (UDM_SETACCEL returns 0, but the
> >set still worked, so that's no doubt an error in the MSDN Library), but I
> >was thinking.....

> #INCLUDE "commctrl.inc"
> FUNCTION PBMAIN
>     PRINT %UDM_SETACCEL
>     WAITKEY$
> END FUNCTION

> Returns 1131 for %UDM_SETACCL...  are you sure you did not use an
> undeclared variable instead on an equate for your test?

Yes, I am sure.

Just as sure as I am that:

    WM_USER     x'400'  = 1024 decimal
    +                                   107 decimal
    --------------------------------------------------------
                     =                1131 decimal

MCM



Thu, 06 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to: Edit-in-place SPIN box and Up/Down arrow keys

2. spin down a hard-drive

3. Calling Win32 API functions with Gnat 3.09 (Win32 version)

4. Populate Spin Control in Edit In Place

5. SPIN CONTROL !

6. Creating A Spin Control - A Stupid Question

7. Spin Control - Edit In Place

8. Changing SPIN control

9. filter browse and spin control

10. spin control widget needed

11. Shut Down Windows NT With API

12. API call to close down a program

 

 
Powered by phpBB® Forum Software