Re: Compiler directive for win98?



Is there any way around the run time error without separate builds?

Yes. Load the function within your own code instead of linking to it directly. Take a look at the TlHelp32 unit for examples of loading functions at run time. When the Tool Help DLL is not present, then the functions in that unit simply return default error values instead of calling the DLL's functions.

Thanks Rob, thats a positive!
But the negative is that after looking at Tlhelp32.pas I cant see the wood through the trees for the stdcall:

function SRSetRestorePointA(pRestorePtSpec: PRESTOREPOINTINFOA; pSMgrStatus: PSTATEMGRSTATUS): Bool;
stdcall; external 'SrClient.dll' Name 'SRSetRestorePointA';

There is also another function called LoadLibrary that I found on Google. But neither are apparent in their application.

uses Windows;
//original:
type
TMessageBoxAFunc = function (hWnd: HWND; lpText, lpCaption:
PAnsiChar; uType: UINT): Integer; stdcall;

// so to extrapolate would my function be like:
TSRSetRestorePoint = function SRSetRestorePointA(pRestorePtSpec: PRESTOREPOINTINFOA; pSMgrStatus: PSTATEMGRSTATUS): Bool; stdcall;

//original:
procedure TMainForm.TestBtnClick(Sender: TObject);
var
Handle: THandle;
Func: TMessageBoxAFunc;
begin
Handle := LoadLibrary('user32.dll');
try
Func := GetProcAddress(Handle, 'MessageBoxA');
Func(0, 'test', 'test', MB_OK);
finally
FreeLibrary(Handle);
end;
end;

// then mine something like:
procedure TMainForm.TestBtnClick(Sender: TObject);
var
Handle: THandle;
Func: TMessageBoxAFunc;
begin
Handle := LoadLibrary('SrClient.dll');
try
Func := GetProcAddress(Handle, 'SRSetRestorePointA');
Func(0, 'test', 'test', MB_OK);
finally
FreeLibrary(Handle);
end;
end;

??anything like the above Rob??

I need a conditional to load the dll which can be determined once the program is running and have determined which platform the system is running on like I use something here:

function Tmainform.GetWinVersion: Integer;
var Info: TOSVersionInfoA;
begin
Info.dwOSVersionInfoSize := sizeof(Info);
GetVersionEx(Info);
Result := Info.dwPlatformId;
end;
//sorry, but this info is only for those who have not been down this path before!
Which can be used thusly:
var systems:string;
case GetWinVersion of
VER_PLATFORM_WIN32s: SystemS := 'Windows 3.1x/32s';
VER_PLATFORM_WIN32_WINDOWS: SystemS := 'Windows 95';
VER_PLATFORM_WIN32_NT: SystemS := 'Windows NT';
end;
.



Relevant Pages

  • Re: Page Structure
    ... The page contains a header and left column that remain constant. ... I load a variable according to which the contents of is called. ... Load b.php (left column info) ... (if $var is "elephants" include elephanttext.php) ...
    (comp.lang.php)
  • Page Structure
    ... Load a.php ... Load b.php (left column info) ... (if $var is "elephants" include elephanttext.php) ... (if $var is "tigers" include liontext.php) ...
    (comp.lang.php)
  • Re: best way to inherit funcs from another object
    ... for (var p in obj) { ... you load the script (presumably replacing what ... for methods, or do something similar for data properties, or both. ...
    (comp.lang.javascript)
  • Re: Override static derived variable
    ... > I'll add a bit to Jon's reply since I know you have a Delphi background. ... > .NET does NOT load a class until it is ACTUALLY used. ... private static string var; ... public static string GetVar() ...
    (microsoft.public.dotnet.languages.csharp)