?
Solved

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

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

719 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