![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Hello Frank,
I'm not sure, but try this:
:noname ( -- res )
[DEFINED] NUMERICS [IF] #NS FSTACK [THEN]
MSG window-MESSAGES ; 4 CB: window-callback
The goal is to have a fp-stack space in the callback task context.
Charles
----- Original Message -----
From: "Dr. Frank N. DiMeo" <dimeo_at_ece.villanova.edu>
To: <sftalk_at_forth.com>
Sent: Friday, January 31, 2003 5:26 PM
Subject: [sftalk] Problem with Access Violation
>
> I am having a problem (ACCESS VIOLATION) when trying to use a real
> number save in a list. The number is to be used in drawing a line in
> response to a mouse click.
> I have seen in sftalk reference to similar problems, but still can't get
> it right. Can someone please tell me clearly what is going on?
> The following is some simple code illustrating the problem. It randomly
> works !!!
> Thank you,
> F DiMeo
>
>
> empty
> REQUIRES FPMATH
> 4 IMPORT: MoveToEx
> 3 IMPORT: LineTo
> page
>
> { ==== Create a list of real numbers, save addr to temp ===== }
>
> 0 value temp
> create info falign 25e f, 20e f, 75e f, 0e f,
> info faligned to temp
> \ info's aligned addr save in
> temp
>
> { =========== utilitiy words for MoveToEx and LineTo ======== }
>
> : myMoveTo HWND GetDC -rot 0 MoveToEx drop ;
> : myLineTo HWND GetDC -rot LineTo drop ;
>
> : drawlineA 0 temp f@ f>s myMoveTo 150 180 myLineTo ;
>
> { =========================================================== }
>
>
> [SWITCH window-MESSAGES DEFWINPROC
> WM_RBUTTONDOWN RUNS drawlineA \
> randomly works, but does draw sometimes!!!
> WM_CLOSE RUN: HWND DestroyWindow DROP 0 ;
> SWITCH]
>
> :noname MSG window-MESSAGES ; 4 CB: window-callback
>
> : CREATE-WINDOW ( -- handle )
> 0 \
> exended style
> Z" simple-window" \ window
> classname
> Z" empty " \
> window title
> WS_OVERLAPPEDWINDOW \ window style
> 0 0 1300 800 \ x y cx cy
> 0 \
> parent window handle
> 0 \
> window menu handle
> HINST \
> instance handle
> 0 \
> creation parameter
> CreateWindowEx ;
>
> : REGISTER-CLASS ( ----- )
> Z" simple-window" \ window
> classname
> window-callback \ application
> callback name
> DefaultClass DROP ; \ DefaultClass
> returns hClass
>
> : SHOW-WINDOW ( handle-----)
> SW_SHOWNORMAL ShowWindow DROP ; \ ShowWindow returns hWnd
>
> : window ( -- )
> REGISTER-CLASS
> CREATE-WINDOW
> SHOW-WINDOW ;
>
>
> { ============== The follwing is the result of a WM_RBUTTONDOWN message
> ACCESS_VIOLATION SNAPSHOT +77
> Registers Dstack Rstack
> EAX 77E3B543 00000000 77E266FD
> EBX DEADBEEF 00000080 0040F14C
> %SRC\I386\WIN32\SF\START.F +47
> ECX 01010101 00411128 00000001
> EDX FFFFFFFF 7FFDF000 004063A0 PASCAL-CALL +33
> ESI 77E14BE0 77E992A6 0040F14C
> %SRC\I386\WIN32\SF\START.F +47
> EDI FFFFFFFF 0006D08C 0012FFB4
> EBP 0012FFB4 000003E6 0040F128
> %SRC\I386\WIN32\SF\START.F +11
> ESP 00127F2C 7FFDF000 00402100
> EFL 00010246 00290000 00000000
> EIP 0040308C 00000003 2B000000
> ===================================================================== }
>
>
> ----------------------------------------------------------------------
> sftalk_at_forth.com The SwiftForth programming discussion email list
> To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
> For help with listar commands, send subject "help" to listar_at_forth.com
> Archives are located at http://www.forth.com/sftalk -- check them out!
> Search the archives! Visit http://www.forth.com/search for details.
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Fri Jan 31 2003 - 09:20:15 PST
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:28 PST