Link to home
Start Free TrialLog in
Avatar of Mischa_Kuchinke
Mischa_Kuchinke

asked on

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

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
SOLUTION
Avatar of Wim ten Brink
Wim ten Brink
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of Mischa_Kuchinke
Mischa_Kuchinke

ASKER

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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.