- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my Quickwin graphics program, I need to call certain API drawing functions instead of the Quickwin functions. Here is a code snippet, which attempts to use the API function "lineto" for example:
SUBROUTINE LINETOAPI
use dflib
use dfwin
use gdi32
!use kernel32 !no help
TYPE (WXYCOORD) WXY
integer(4) lu, penstyle
integer(4) hndle, nxend, nyend, hpen, colorref, nwidth, hpenold
logical(4) ret
! Draw a test line using QuickWin, just to demonstrate things are working.
call moveto_w (0._8, 0._8, wxy)
ISTAT = LINETO_W (.5_8, -.5_8)
! Now try a line using Windows API.
! First, get a handle to the active child window.
hndle = gethwndqq (lu) ! (returns 2884274, 3277512, ...)
! Create a pen.
nwidth = 0
colorref = 255
penstyle = 1
hpen = createpen (penstyle, nwidth, colorref) ! (returns -181401624, -516944594, ...)
! Connect the pen to the window.
hpenOld = SelectObject (hndle, hpen) ! (returns 0)
! Draw a line.
nxend = 10
nyend = -10
ret = msfwin$LineTo (hndle, nxend, nyend) ! (returns .false.)
! That's it.
END
This code does not work. Note the several functions that return handles, where I have noted the response ! (like this). The "createpen" functions returns a negative number, which seems suspicious to me. The "selectobject" function returns 0, indicating failure. The "lineto" function (which I renamed according to online documentation to avoid name conflict with quickwin) returns .false., also indicating failure.
Help!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In general, you should strongly consider abandoning "Quickwin" and creating standard Win32 programs in which you initialize all the required objects and have explicit proc function code for message loop processing. This is straightforward to do wholly in Fortran90 using the resources supplied with IVF (the DVF Win32 resources do work but they are outdated and incomplete). See any of Petzold's older books for instruction on how to write Win32 code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Other information, including the online documentation, strongly implies that the API calls I'm trying should work in Quickwin, so I thought I'd give it a try. If it really is hard or nearly impossible to do, then I will give up.
Re. the device context handle, I thought that the line
hndle = gethwndqq (lu)
would take care of this. Or, possibly
hndle = gethwndqq (qwin$framewindow)
which works for other API calls.
I know I have a lot to learn. I'm just trying to bite off a little at a time. I don't understand why this attempt to use "lineto" seems to be such a big gulp compared to my previous tasks!
Daryl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
However, IIRC, QuickWin is multithreaded and uses double-buffering, so you cannot make the change you want using Windows API. You need to switch completely to using the Windows API as Paul Curtis suggests.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do have a big complaint about the on-line documentation: it implies quite strongly that calls to these API functions will work in quickwin.
Daryl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I understand your statement, you're saying that quickwin has a version of the API function "lineto" that works. I understand that. But are you saying that the actual API call can work in quickwin? Like the documentation says, to use it just rename it to MSFWIN$LINETO? If this works, can you give me a sample code?
The quickwin lineto is crippled, that's why I wanted to use the API lineto. The API lineto either works from quickwin, or it doesn't.
Daryl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can call Win32 API routines from QuickWin. But you may need to go to extra lengths to get the proper handles, DCs, etc, because normally QuickWin handles all of that for you and does not let you extend its functionality. I am not an expert on this - some things you can do with subclassing, as mentioned earlier.
The issue with LINETO is that this name is used both by QuickWin and by Win32. If you have done a USE IFQWIN, you get the QuickWin version. If you want access to the Win32 routine by the same name (but with a different calling sequence) from module GDI32, use MSFWIN$LINETO.
The Poker sample demonstrates subclassing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Daryl
Well, the API LineTo does work (given the right device context), but the catch is that interferes with QuickWin drawing. You can draw using QuickWin, or using API, but not both simultaneously.
You may be interested in my QW_XFT sample, which mixes QuickWin and Xeffort library (which is a thin layer around Win32 API, so the sample uses subclassing, but under the hood). Xeffort provides a rather rich set of wrappers around Win32 GDI functions, inspired by QuickWin (so there's for example XLineTo_W)... or you can call API LineTo(xDC%hDC, ....) directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page