Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-10-31
5
Medium Priority
?
350 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 375 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 375 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

926 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