flat assembler
Message board for the users of flat assembler.

Index > Windows > LoadCursor Function in FASM?

Author
Thread Post new topic Reply to topic
Dracula



Joined: 06 Dec 2010
Posts: 4
Dracula
Hello people!
Why FASM display Errors?

Error: undefined symbol 'IDC_SIZEALL'
Error: undefined symbol 'OCR_NORMAL'



FASM code:
Code:
invoke LoadCursor,0,IDC_SIZEALL
invoke SetSystemCursor,EAX,OCR_NORMAL
    



MSDN LoadCursor Function
http://msdn.microsoft.com/en-us/library/ms648391(VS.85).aspx

MSDN SetSystemCursor Function
http://msdn.microsoft.com/en-us/library/ms648395(VS.85).aspx

-------------------------

Example code:
Code:
include 'win32ax.inc'

.data
     CURSOR_RECT      RECT    <0>
     CURSOR_POINT     POINT   <0>
     String_String    db   "API-Cursor ",0
     X_Y_SHABLON      db   "X = %d   ;   Y = %d",0
     String_CONTENER  db   256 dup (0)

.code
     start:
           invoke GetCursorPos,CURSOR_POINT
           ;-
           invoke wsprintf,String_CONTENER,X_Y_SHABLON,CURSOR_POINT.x,CURSOR_POINT.y
           ;-
           invoke MessageBox,0,String_CONTENER,String_String,0

           ;---------------

           invoke SetCursorPos,500,300

           ;---------------
           mov [CURSOR_RECT.left],450
           mov [CURSOR_RECT.top],250
           mov [CURSOR_RECT.right],550
           mov [CURSOR_RECT.bottom],350
                                                                                                                     
           invoke ClipCursor,CURSOR_RECT  
           ;---------------
                
           invoke LoadCursor,0,IDC_SIZEALL
           invoke SetSystemCursor,EAX,OCR_NORMAL

           ;&&&
           invoke ShowCursor,0
           invoke ShowCursor,1
           ;---------------

     exit:
          invoke ExitProcess,0

.end start     
Post 06 Dec 2010, 16:40
View user's profile Send private message Reply with quote
asmhack



Joined: 01 Feb 2008
Posts: 431
asmhack
alucard
Fasm displays an error because IDC_SIZEALL and OCR_NORMAL are undefined symbols in equates include file. In such cases just use the numerical values from MSDN.

Code:
IDC_SIZEALL equ 32646
OCR_NORMAL equ 32512
    
Post 06 Dec 2010, 17:16
View user's profile Send private message Reply with quote
Dracula



Joined: 06 Dec 2010
Posts: 4
Dracula
asmhack wrote:

Fasm displays an error because IDC_SIZEALL and OCR_NORMAL are undefined symbols in equates include file. In such cases just use the numerical values from MSDN.


Thank you very much, asmhack !!!
Post 06 Dec 2010, 19:13
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Code:
IDC_SIZEALL = 32646
OCR_NORMAL = 32512 
    


Don't use "equ" for numerical constants.
Post 06 Dec 2010, 20:04
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
JohnFound,

For singleton value equ is OK (I mean single fasm token). It may be OK for other cases too, if one's careful:
Code:
page    equ     4096
pages   equ     *page
        invoke  VirtualAlloc, 0, 10 pages, MEM_RESERVE, PAGE_READWRITE    
Post 09 Dec 2010, 21:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.