andyhill Posted November 12, 2023 Share Posted November 12, 2023 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. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 13, 2023 Share Posted November 13, 2023 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? Quote Link to comment Share on other sites More sharing options...
andyhill Posted November 13, 2023 Author Share Posted November 13, 2023 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 ; Quote Link to comment Share on other sites More sharing options...
andyhill Posted November 13, 2023 Author Share Posted November 13, 2023 Bare bones D12 example Project1.zip Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 14, 2023 Administrators Share Posted November 14, 2023 It is Delphi behavior. The last added unit will take precedence. You must make sure VCL.Graphics is added after Windows unit in your Units list. 1 Quote Link to comment Share on other sites More sharing options...
Tokay Posted November 14, 2023 Share Posted November 14, 2023 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; 1 Quote Link to comment Share on other sites More sharing options...
andyhill Posted November 14, 2023 Author Share Posted November 14, 2023 Thank you Farshad, it is the first time that this has happened to me - now wiser 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.