VB and QWIN

VB and QWIN

I have built up a rather large inventory of FORTRAN programs (many of which use QuickWin for graphics) and would like to use a better GUI front-end (such as Visual Basic) to launch these programs. It is my understanding that VB calls the FORTRAN programs only via DLLs, but that QuickWin is not compatible with DLLs.

(1) Is there any way to access QWIN routines (or another set of graphics routines that perform the same functions) and use VB as a GUI front-end?
or
(2) Is there another way to a GUI that does not use DLLs?
or
(3) Am I stuck?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Um, (3) I'm afraid... almost.
You'll not be able to connect the existing QuickWin code with anything, since
QW internally maintains screen buffer, active window etc etc.
I had a similar problem when redesigning a large app (~60.000 lines),
mostly GUI operations, from QuickWin into Win32. Well, that was a
huge work that payed out. I had to replace a lot of QW drawing operations
with Win32 equivalents, so I wrote a Win32 wrapper library in fortran
which is very similar (not identical, though) to QuickWin functions.

I think the best choice is to try to write a wrapper library which would
have identical or nearly-identical functionality with QW and which would wrap Win32 routines (which are universally recognized). Then, instead
of modifying all the code, just replace USE MSFLIB with USE MYLIBRARY.

Win32 routines' arguments essentially differ from QuickWin's only that
they require handle of device context (DC) as first argument. (Anyway,
I think that QW design where a graphic function operates on currently
active window is rather stupid). Now, if you'll be able to get a DC handle
from VB code and pass it into fortran DLL (yes, it will have to be
redesigned to be a DLL), the stuff will work. Moreover,
there's an essential difference that in Win32 programmer has to cope
with updating of window contents (QW does that for you), but it can
be worked around too.

Well, if you did not give up, feel free to write me at jdujic@uns.ns.ac.yu
so that I send you my wrapper library source along with few samples and comments. Its usage is something like this:

 
SUBROUTINE DrawSomething(hDC) 
 
USE XFTGDI 
 
TYPE (X_DC):: xDC 
INTEGER hDC 
 
xDC%hDC=GetDC(hWindow) 
CALL XSetViewport(xDC,iX1,iY1,iX2,iY2) 
CALL XSetWindow(xDC,REAL(iX1),REAL(iY1),REAL(iX2),REAL(iY2)) 
 
CALL XSetBrush(xDC,jDefColor(15)) 
CALL XSetPen(xDC,0) 
iSt=XSetFont(xDC,"Arial",8) 
 
iSt=XRectangle(xDC,jX1,jY1,jX2,jY1+10) 
iStep=(jX2-jX1)/15 
 
DO i=0,6 
      iSt=XLine(xDC,jX1+NINT(i*iStep*2.5),jY1+10,jX1+NINT(i*iStep*2.5),jY1+12) 
      iSt=XTextOut(xDC,jX1+NINT(i*iStep*2.5)-3,jY1+12,STRING(i*25,3)//'%',0) 
END DO 
 
iSt=XRectangle(xDC,jX1,jY1,jX1+iPercent*iStep/10,jY1+10,xBrush=X_BRUSH(BS_SOLID,jDefBoja(12),0)) 

Regards

Jugoslav

Jugoslav
www.xeffort.com

Leave a Comment

Please sign in to add a comment. Not a member? Join today