Jump to content

ServerModule TBitmap Winapi.Windows D12 ERROR


andyhill

Recommended Posts

I use the following code in ServerModule that worked fine before D12, if I include the Winapi.Windows unit then all reference to TBitmap (Vcl.Graphics) within the ServerModule fails, please advise - thanks in advance. 

initialization
  RegisterServerModuleClass(TUniServerModule);
  //
  (*
  var Fmt: TFormatSettings;
  GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, Fmt); // Winapi.Windows
  Fmt.ShortDateFormat:= 'dd/mm/yyyy';
  Fmt.DateSeparator:= '/';
  Fmt.DecimalSeparator:= '.';
  *)
  //
end.

Link to comment
Share on other sites

6 hours ago, andyhill said:

I use the following code in ServerModule that worked fine before D12, if I include the Winapi.Windows unit then all reference to TBitmap (Vcl.Graphics) within the ServerModule fails, please advise - thanks in advance. 

Hello,

What exactly is the problem you are facing?

Link to comment
Share on other sites

When Winapi.Windows unit is added to ServerModule (in order to decode LOCALE_SYSTEM_DEFAULT required by GetLocaleFormatSettings)

All reference to Bitmaps in Vcl.Graphics unit no longer works

procedure CustomProc(Sender: TObject);
var 
  bmp: TBitmap;
begin

  bmp:= TBitmap.Create; ERROR UnDeclared Identifier Create
 

Remove Winapi.Windows unit and rem out GetLocaleFormatSettings and all works normally ?

 

unit ServerModule;

interface

uses
  Classes, SysUtils, StrUtils, ShlObj, ActiveX, Vcl.Graphics, Vcl.Imaging.jpeg,
{Winapi.Windows,}
  DateUtils,
  //
  uniGUIServer, uniGUIMainModule, uniGUIApplication, uniGUITypes, uniGUISessionManager,
  //
  IdBaseComponent, IdAntiFreezeBase, IdAntiFreeze, IdComponent, IdTCPConnection, IdTCPClient,
  IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdIOHandler, IdIOHandlerSocket,
  IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdMessage, idAttachmentFile, IdICMPClient, IdHTTP,
  uIdCustomHTTPServer,
  //
  IdSASLAnonymous, IdSASLDigest, IdSASLLogin, IdSASLOTP, IdSASL_CRAM_MD5, IdSASLPlain,
  IdSASL_CRAM_SHA1, IdSASLSKey, IdUserPassProvider
  ;

 

Link to comment
Share on other sites

On 11/13/2023 at 9:04 AM, andyhill said:

When Winapi.Windows unit is added to ServerModule (in order to decode LOCALE_SYSTEM_DEFAULT required by GetLocaleFormatSettings)

All reference to Bitmaps in Vcl.Graphics unit no longer works

procedure CustomProc(Sender: TObject);
var 
  bmp: TBitmap;
begin

  bmp:= TBitmap.Create; ERROR UnDeclared Identifier Create
 

Remove Winapi.Windows unit and rem out GetLocaleFormatSettings and all works normally ?

 

unit ServerModule;

interface

uses
  Classes, SysUtils, StrUtils, ShlObj, ActiveX, Vcl.Graphics, Vcl.Imaging.jpeg,
{Winapi.Windows,}
  DateUtils,
  //
  uniGUIServer, uniGUIMainModule, uniGUIApplication, uniGUITypes, uniGUISessionManager,
  //
  IdBaseComponent, IdAntiFreezeBase, IdAntiFreeze, IdComponent, IdTCPConnection, IdTCPClient,
  IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdIOHandler, IdIOHandlerSocket,
  IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdMessage, idAttachmentFile, IdICMPClient, IdHTTP,
  uIdCustomHTTPServer,
  //
  IdSASLAnonymous, IdSASLDigest, IdSASLLogin, IdSASLOTP, IdSASL_CRAM_MD5, IdSASLPlain,
  IdSASL_CRAM_SHA1, IdSASLSKey, IdUserPassProvider
  ;

 

you can imlicitly indicate which class you need:

bmp1: Vcl.Graphics.TBitmap;

bmp2: Windows.TBitmap;

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...