News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How to get the standard cursors ?

Started by six_L, November 16, 2024, 03:23:02 AM

Previous topic - Next topic

six_L

Hi,All

How to get the standard cursors ?

;// Create a custom cursor based on a resource.
    invoke  LoadCursor,hInstance,IDC_HAND
    mov     hCursor,rax
;//Windows provides a set of standard cursors that can be used by applications. The following cursor identifiers are defined in WinUser.h
MAKEINTRESOURCE(32631) ;A pen cursor.
How to use the "MAKEINTRESOURCE(32631)"?

Thank you in advance.
regards

Say you, Say me, Say the codes together for ever.

six_L

Hi,All
i know.
look as if:
invoke  LoadCursor,NULL,32631
mov     hCursor,rax
...

invoke   DestroyCursor,hCursor

;//********************************************
ask a question and answer it oneself.
Sorry to trouble you.

Regards
Say you, Say me, Say the codes together for ever.

fearless

#2
Yes, just use the ID or define a constant to use that id:

https://learn.microsoft.com/en-us/windows/win32/menurc/about-cursors

IDC_PEN EQU 32631

six_L

Hi,fearless
Thank you for the respones at first time.

regards
Say you, Say me, Say the codes together for ever.

NoCforMe

The problem is that only some of the standard cursors are defined in our very own windows.inc. Here's the complete list of cursors (from this page at Learn.Microsoft.com) so you can use them in your programs:

NameValue  Type of cursor
IDC_ARROW32512  Normal select
IDC_IBEAM32513  Text select
IDC_WAIT32514  Busy
IDC_CROSS32515  Precision select
IDC_UPARROW32516  Alternate select
IDC_SIZENWSE32642  Diagonal resize 1
IDC_SIZENESW32643  Diagonal resize 2
IDC_SIZEWE32644  Horizontal resize
IDC_SIZENS32645  Vertical resize
IDC_SIZEALL32646  Move
IDC_NO32648  Unavailable
IDC_HAND32649  Link select
IDC_APPSTARTING32650  Working in background
IDC_HELP32651  Help select
IDC_PIN32671  Location select
IDC_PERSON32672  Person select

That particular cursor you wanted, IDC_PEN is one that Micro$oft says "do not have identifiers defined in WinUser.h (or are considered obsolete)":

Value  Type of cursor
32631  A pen cursor
32652  A scrolling cursor with arrows pointing north and south
32653  A scrolling cursor with arrows pointing west and east.
32654  A scrolling cursor with arrows pointing north, south, east and west
32655  A scrolling cursor with an arrow pointing north
32656  A scrolling cursor with an arrow pointing south
32657  A scrolling cursor with an arrow pointing west
32658  A scrolling cursor with an arrow pointing east
32659  A scrolling cursor with arrows pointing north and west
32660  A scrolling cursor with arrows pointing north and east
32661  A scrolling cursor with arrows pointing south and west
32662  A scrolling cursor with arrows pointing south and east
32663  An arrow CD cursor

Of course, even if these are considered "obsolete" they're still displayable by the OS.

Note: These really should all be in windows.inc. Maybe I'll create an auxiliary include file with these and post it here.

Meta note:
I discovered a little trick creating these 2 tables. The default table formatting of this board (Simple Machines) is horrible; it just jams the columns together with hardly any space between them. I tried creating a "blank" row entry, using [td] [/td], but it just did the usual HTML thing (collapse all white space to a single space).

However, I found that you can put in any number of "non-breaking spaces" in a [td] entry, and that will space the table out nicely. You can use the Windows Character Map to find this character ("No-Break Space") and copy it.
Assembly language programming should be fun. That's why I do it.

NoCforMe

Here's that include file for y'all:

;====================================
; IDC_xxx values not in windows.inc
;====================================

IDC_PIN EQU 32671 ;Location select
IDC_PERSON EQU 32672) ;Person select

;================================================================
; The following values have no officially-defined IDC_xxxx names.
; Appropriate names have been assigned here.
;================================================================
IDC_PEN EQU 32631 ;A pen cursor
IDC_ARROW_NS EQU 32652 ;A scrolling cursor with arrows pointing north and south
IDC_ARROW_EW EQU 32653 ;A scrolling cursor with arrows pointing west and east
IDC_ARROW_NSEW EQU 32654 ;A scrolling cursor with arrows pointing north, south, east, and west
IDC_ARROW_N EQU 32655 ;A scrolling cursor with an arrow pointing north
IDC_ARROW_S EQU 32656 ;A scrolling cursor with an arrow pointing south
IDC_ARROW_W EQU 32657 ;A scrolling cursor with an arrow pointing west
IDC_ARROW_E EQU 32658 ;A scrolling cursor with an arrow pointing east
IDC_ARROW_NW EQU 32659 ;A scrolling cursor with arrows pointing north and west
IDC_ARROW_NE EQU 32660 ;A scrolling cursor with arrows pointing north and east
IDC_ARROW_SW EQU 32661 ;A scrolling cursor with arrows pointing south and west
IDC_ARROW_SE EQU 32662 ;A scrolling cursor with arrows pointing south and east
IDC_ARROW_CD EQU 32663 ;An arrow cd cursor
Assembly language programming should be fun. That's why I do it.

six_L

Hi,NoCforMe
Thank you for providing the information.
Your sheet looks nicely.

Regards
Say you, Say me, Say the codes together for ever.

NoCforMe

Thanks.
There's one typo there; I'm sure you'll see it.
I'm not going to correct it. Why? Because the stupid f**king editing function here (this board, Simple Machines) totally mangles my nice formatting every time I modify a post. I've reported this to SMF, but it's so far down their priority list it'll probably never get fixed.
Assembly language programming should be fun. That's why I do it.

TimoVJL

In Windows 10 WinUser.h
#define IS_INTRESOURCE(_r) ((((ULONG_PTR)(_r)) >> 16) == 0)
#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))
#define MAKEINTRESOURCEW(i) ((LPWSTR)((ULONG_PTR)((WORD)(i))))
#ifdef UNICODE
#define MAKEINTRESOURCE  MAKEINTRESOURCEW
#else
#define MAKEINTRESOURCE  MAKEINTRESOURCEA
#endif // !UNICODE

/*
 * Standard Cursor IDs
 */
#define IDC_ARROW          MAKEINTRESOURCE(32512)
#define IDC_IBEAM          MAKEINTRESOURCE(32513)
#define IDC_WAIT            MAKEINTRESOURCE(32514)
#define IDC_CROSS          MAKEINTRESOURCE(32515)
#define IDC_UPARROW        MAKEINTRESOURCE(32516)
#define IDC_SIZE            MAKEINTRESOURCE(32640)  /* OBSOLETE: use IDC_SIZEALL */
#define IDC_ICON            MAKEINTRESOURCE(32641)  /* OBSOLETE: use IDC_ARROW */
#define IDC_SIZENWSE        MAKEINTRESOURCE(32642)
#define IDC_SIZENESW        MAKEINTRESOURCE(32643)
#define IDC_SIZEWE          MAKEINTRESOURCE(32644)
#define IDC_SIZENS          MAKEINTRESOURCE(32645)
#define IDC_SIZEALL        MAKEINTRESOURCE(32646)
#define IDC_NO              MAKEINTRESOURCE(32648) /*not in win3.1 */
#if(WINVER >= 0x0500)
#define IDC_HAND            MAKEINTRESOURCE(32649)
#endif /* WINVER >= 0x0500 */
#define IDC_APPSTARTING    MAKEINTRESOURCE(32650) /*not in win3.1 */
#if(WINVER >= 0x0400)
#define IDC_HELP            MAKEINTRESOURCE(32651)
#endif /* WINVER >= 0x0400 */

#if(WINVER >= 0x0606)
#define IDC_PIN            MAKEINTRESOURCE(32671)
#define IDC_PERSON        MAKEINTRESOURCE(32672)
#endif /* WINVER >= 0x0606 */


May the source be with you

NoCforMe

Timo: I've already provided that info* IN ASSEMBLY LANGUAGE. Why do you keep insisting on posting C code?

* Everything that's not already in windows.inc.
Assembly language programming should be fun. That's why I do it.

TimoVJL

Quote from: NoCforMe on November 17, 2024, 07:13:25 PMTimo: I've already provided that info* IN ASSEMBLY LANGUAGE. Why do you keep insisting on posting C code?
was not for you, just others, who want to know, from where those things come.
May the source be with you