Using QB4.5 Quick Libraries

General FreeBASIC programming questions.
DonW
Posts: 40
Joined: Feb 16, 2013 0:56
Location: Longview, WA

Using QB4.5 Quick Libraries

Postby DonW » Feb 16, 2013 1:15

I'm new to freebasic, and after browsing the documentation, faq's, and forums, it is still not clear to me as to whether or not one can use QB4.5 Quick Libraries when compiling QB4.5 code. I have a large application written in QB4.5 which makes use of a few routines in a Quick Library. Unfortunately, I do not have the source code to the needed routines in the library that would allow me to include them in a .BI file.
marcov
Posts: 3020
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Using QB4.5 Quick Libraries

Postby marcov » Feb 16, 2013 20:19

Probably not, since those libs are 16-bit code, and FB only generates 32-bits code.(well, and maybe 64-bit)
DonW
Posts: 40
Joined: Feb 16, 2013 0:56
Location: Longview, WA

Re: Using QB4.5 Quick Libraries

Postby DonW » Feb 18, 2013 5:30

The library code executed are several routines contained in PRO.QLB which is a Quick Library supplied by Crescent Software's QickPak Professional released in 1992. The the use of these routines allow me to create message boxes in QuickBasic that have a similar appearance to the message box features in Visual Basic. According to the documentation in the QuickPak manual, the .QLB code being used are assembler subroutines. So if it is not possible to use these assembler subroutines with freebasic, perhaps someone could share some QB compatible BASIC code that would do the same thing.

Thanks.
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Re: Using QB4.5 Quick Libraries

Postby anonymous1337 » Feb 18, 2013 15:34

Hi, DonW. You can actually use the Windows API directly in FreeBASIC. I don't mess with the Windows API too much, but FreeBASIC does have a Visual Designer available for it: viewtopic.php?f=8&t=15796

And some extensions: viewtopic.php?f=8&t=20865

But as far as I know, FreeBASIC doesn't have a simple "MessageBox" command. Maybe it should?
DonW
Posts: 40
Joined: Feb 16, 2013 0:56
Location: Longview, WA

Re: Using QB4.5 Quick Libraries

Postby DonW » Feb 18, 2013 18:25

anonymous1337, thanks for your suggestions, but then I assume I'd need to use the /fb flag instead of the /qb flag when compiling. And that then might not be compatible with my QB code.

Don
Kot
Posts: 336
Joined: Dec 28, 2006 10:34

Re: Using QB4.5 Quick Libraries

Postby Kot » Feb 19, 2013 22:31

Maybe try the great Window9 library by Vanya
http://www.freebasic.net/forum/viewtopic.php?f=14&t=17058
I Daniel
Posts: 43
Joined: May 13, 2010 10:34
Location: Centurion, South Africa

Re: Using QB4.5 Quick Libraries

Postby I Daniel » Feb 21, 2013 8:48

With QB4.5 there is a program that allows you to "dump" the contents of the *.QLB. i.e it shows you the routines in the Qlb (not the actual code though). Can you perhaps use this program and then check if some of the routines are covered in FB.
You could also try the /fblite switch which is still compatible with QB.

I understood that a 32 bit program could in fact call a 16 bit program/dll and as a DLL appears to = QLB. You could just for experimentation use an include file for the QB4.5 Quick library.
But there are fundies here who could probably tell me that it cannot be done and I will not argue with them for I remain an old time QB4.5 programmer who makes use of FBlite for some things not found in QB.
I could also have misunderstood that it was actually meant that a 32 bit program can call a 16 bit program and not that it could use a 16 bit DLL/QLB

But isn't it possible to check what the routine does and then write one in QB as a sub or function ? (I know it is a shlep.)
dodicat
Posts: 6724
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Using QB4.5 Quick Libraries

Postby dodicat » Feb 21, 2013 13:50

You can directly call kernel32.dll in freebasic for a message box.
But I can't get it to work in QB.

Code: Select all

Declare Function msg lib "kernel32.dll" Alias "MessageBoxW"(n1 As Integer,s1 As Wstring,s2 As Wstring,n2 As Integer) As Integer:Sleep 1


msg(0,"hello","Box",0)


But this works in QB with Win XP (without the #lang "qb" of course.

Code: Select all

#lang "qb"

sub messagebox(msg$)
     shell ("msg * "+ msg$)
 end sub
 
 messagebox("hello")
marcov
Posts: 3020
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Using QB4.5 Quick Libraries

Postby marcov » Feb 21, 2013 14:58

I Daniel wrote:With QB4.5 there is a program that allows you to "dump" the contents of the *.QLB. i.e it shows you the routines in the Qlb (not the actual code though). Can you perhaps use this program and then check if some of the routines are covered in FB.
You could also try the /fblite switch which is still compatible with QB.


I understood that a 32 bit program could in fact call a 16 bit program/dll and as a DLL appears to = QLB. You could just for experimentation use an include file for the QB4.5 Quick library.


How did you understand that?

But there are fundies here who could probably tell me that it cannot be done and I will not argue with them for


It's not being "fundie", it is realism. The number of examples that apply to this situation are zero. There might be some ways if the 16-bit code is a win16 dll (over win32s), but that might only work on win3.x and win9x. But to my knowledge there are no such examples that reuse(!) 16-bit dos code.

Moreover, I don't know anybody who does it, or has example code. (reusing existing binaries, and not specially crafting that, since we don't have the QLB source). It is only mentioned as hypothetical option in discussions as this.
I Daniel
Posts: 43
Joined: May 13, 2010 10:34
Location: Centurion, South Africa

Re: Using QB4.5 Quick Libraries

Postby I Daniel » Feb 21, 2013 15:42

>>"How did you understand that? "<<

By using Start.exe where you can call/run a program from qb even if it is a 32 bit and qb is 16 bit. I do it all the time.

Fundie means teacher in this country so why the aggressive tone?

You could rather have explained it better since you are a "Fundie"
marcov
Posts: 3020
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Using QB4.5 Quick Libraries

Postby marcov » Feb 21, 2013 16:48

I Daniel wrote:>>"How did you understand that? "<<
By using Start.exe where you can call/run a program from qb even if it is a 32 bit and qb is 16 bit. I do it all the time.


That's possible for an EXE yes, at least on Windows/x86. On 64-bit 16-bit code gets difficult.

Your generalization to a dll is doubtful. While some 32-bit are rundllable, that is already a special case, let alone 16-bit dlls for _dos_ programs.

Anyway calling as external program and calling a function in a DLL is something totally different. I read over the "program"

Fundie means teacher in this country so why the aggressive tone?


In some others it is fundamentalist. Anyway, I get a bit tired of people that give false hope to systems that are essentially EOL for 10 years or even much longer. Any major investment in them is hardly ever justified.
I Daniel
Posts: 43
Joined: May 13, 2010 10:34
Location: Centurion, South Africa

Re: Using QB4.5 Quick Libraries

Postby I Daniel » Feb 21, 2013 17:24

Thanks. I did say he could possibly write his own. "window" sub. (Okay why re-invent the wheel)
I found it is better to use /fblite than /QB and then work your way up from there.

According to the internet the original PRO.QLB included the source code.

The QB4.5 Handbook was also probably a source of misunderstanding for they give info on how to call routines written in other languages.

Okay I checked Fundi on the internet. Somehow just about every hit on the first page refers to fundamentalism but some time last year I still found references that defined the meaning as a teacher/expert in his field. It comes from the Zulu language (isiZulu). The root word being Funda. (Learn)
It is used widely in South Africa and here it has absolutely no pejorative meaning.
DonW
Posts: 40
Joined: Feb 16, 2013 0:56
Location: Longview, WA

Re: Using QB4.5 Quick Libraries

Postby DonW » Feb 21, 2013 19:26

I have the original QuickPak Pro, and I, too, saw a reference on Ethan Winer's web site that source code was included. However, the source code for subroutines contained in his PRO.QLB library is not listed in the manual.

The .QLB subroutines used by his "MSG.BAS" program (which I use through out my application) are listed in the manual as Assembler subroutines. But again, I do not see any source code referenced for those subroutines...not that it would do me much good because I am not versed in Assembler. And would incorporating Ethan's Assembler language subroutines still compile to a 32bit application?

My goal would be to hopefully use freebasic to convert my QB4.5 application to a 32bit mode so that it could run in 64bit Windows 7 or 8 environments with out having to use a virtual box of some kind. Marketing my application has taken a hit because it won't run on 64bit Windows.

Quite frankly, I can't understand why Microsoft dropped 16bit support in their 64bit version...they still have it in their 32bit Windows 7. Ironically, during their beta phase of 64bit Win7 (at least with the copy I had), support for 16bit apps was still there.

Don
marcov
Posts: 3020
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Using QB4.5 Quick Libraries

Postby marcov » Feb 21, 2013 21:12

DonW wrote: And would incorporating Ethan's Assembler language subroutines still compile to a 32bit application?


No, assembler is machine specific, and 16-bit and 32-bit are different instruction models. In some cases it is easy, in some cases it is total rewrite.


Quite frankly, I can't understand why Microsoft dropped 16bit support in their 64bit version...


Because it is deprecated since 1995 (win16) or longer (dos) ? That's 17 years that the writing was on the wall.....

Anyway, it might not been entirely their choice, Intel/AMD have their influence there too.

they still have it in their 32bit Windows 7. Ironically, during their beta phase of 64bit Win7 (at least with the copy I had), support for 16bit apps was still there.
Don


I sincerely doubt that, since Vista 64-bit already couldn't.
DonW
Posts: 40
Joined: Feb 16, 2013 0:56
Location: Longview, WA

Re: Using QB4.5 Quick Libraries

Postby DonW » Feb 22, 2013 6:48

Thank you regarding the insight on the assembler issue.

However, I'm not sure that Intel/AMD would really influence Microsoft into dropping 16bit support in their Win7 64bit version. My desktop PC has a 64bit dual core AMD cpu, and it is irrelevant as to whether I run a 32bit or 64bit version of Windows on it. I did have a beta copy of Win7 Pro (which should have been 64bit at the time), and I was able to run my compiled QB4.5 application on it. But ironically, Microsoft still supports 16bit applications in their 32bit version of Win7, and I can run my QB4.5 application just fine in that environment.

Don

Return to “General”

Who is online

Users browsing this forum: No registered users and 10 guests