Solved

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

Posted on 2003-10-31
5
341 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
  • 2
  • 2
5 Comments
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
_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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now