Solved

Retrieving free GDI-Ressources in Win98 and still executable under Win2000/XP

Posted on 2003-10-31
5
346 Views
Last Modified: 2010-05-18
Hi !

I have a Program that uses a lot of GDI-Ressources for every open Dialog. Under Win98 this is a Problem because there are only limited GDI-Ressources. So before opening a new Dialog I want to test the remaining free GDI-Ressources. There is a possibility with a Windows-98 API Function QT_Thunk. I include it in my Program with this line:  

procedure QT_Thunk; cdecl; external kernel32 name 'QT_Thunk';

So this works fine under Win98, but when I start the program und Win2000 there is an error Message, that this API-Function is not available. I don't want to call the function under Win2000 because I have no GDI-Problem under Win2000.
My Question is, is there a way to have one program that works under Win98 and Win2000 and still retrieves under Win98 the remaining GDI-Ressources?
Or is the only solution to provide different programs for the Platforms Win98 and Win2000/XP

Thanks Mischa
0
Comment
Question by:Mischa_Kuchinke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 125 total points
ID: 9658638
Just ask which version of Windows is currently running... If you use Delphi 7 then use Win32MajorVersion, Win32MinorVersion and Win32BuildNumber from the SysUtils unit, otherwise use the GetVersionEx API to retrieve the Windows version. Delphi 7 also has a function called CheckWin32Version to check the version number.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9658639
Just ask which version of Windows is currently running... If you use Delphi 7 then use Win32MajorVersion, Win32MinorVersion and Win32BuildNumber from the SysUtils unit, otherwise use the GetVersionEx API to retrieve the Windows version. Delphi 7 also has a function called CheckWin32Version to check the version number.
0
 

Author Comment

by:Mischa_Kuchinke
ID: 9658742
Okay that was one part of my problem. The other is, that with the line

procedure QT_Thunk; cdecl; external kernel32 name 'QT_Thunk';

i am always trying to load the function QT_Thunk which raises an error when I am starting the Program in Win2000. But I found something in the Delphi Help Files "Dynamic Loading". So I try perhaps with Dynamic Loading and your Version checking I get what I want.

Lets Try.
0
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 125 total points
ID: 9660127
_imp_QT_Thunk: procedure; cdecl;
hLib: THandle;


hLib := LoadLibrary ( 'kernel32.dll' );
if hLib <> 0 then begin
  @_imp_QT_Thunk  := GetProcAddress ( hLib, 'QT_Thunk');
end else begin
  //Error loading dll
end;
0
 

Author Comment

by:Mischa_Kuchinke
ID: 9662659
Thanks to anyone. Yes Dynamic Loading was the solution and it worked. Together I could check the operation System and then load the Procedure dynamic.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question