Jump to content

Jirka52

Members
  • Content Count

    35
  • Joined

  • Last visited

Community Reputation

2 Neutral

Technical Information

  • Delphi-Version
    Delphi 12 Athens

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Jirka52

    Problem with linking of Midas.dll on 64 bit

    I tried it, but failed. I am mostly Delphi developer, I have only one application in C++ Builder, so I will try to do it, but this morning I spent one hour and I did not get required result.
  2. Jirka52

    Problem with linking of Midas.dll on 64 bit

    Thank you. It is not problem in Delphi, but C++ Builder it is problem😉
  3. Jirka52

    Problem with linking of Midas.dll on 64 bit

    And another question. I tried to google it, but I did not find anything. Do you know how to create object 64 bit file from "midas.a" or "midas.dll"? I need "midas.o" for linking into exe file => #pragma link "midas" In 32 bit I use #pragma link "Midas.lib". And "Midas.lib" exists in "c:\Program Files (x86)\Embarcadero\Studio\23.0\lib\win32\debug\midas.lib" and in "c:\Program Files (x86)\Embarcadero\Studio\23.0\lib\win32\release\midas.lib". I would like to distribute "exe" file without 64 bit "midas.dll". Thank you very much for answer.
  4. Jirka52

    Problem with linking of Midas.dll on 64 bit

    I overlooked your notice "mkexp midas. midas.dll" It works. Thank you very much!!!!
  5. You can create trhread with TComport for communication with your device. Component is here, install it and use it in your code. Comport is Delphi component, but it works also in C++ Builder, I have been using it in C++ Builder more than 14 years. https://sourceforge.net/projects/comport/
  6. Jirka52

    Problem with linking of Midas.dll on 64 bit

    I know where is midas.dll for 64 bit. I do not know how to link 64 bit verions "midas.a" into 64 bit exe file. File "midas.a" does not exist in 64 bit version. It is not problem in 32 bit, here is "Midas.lib" file - 32 bit, problem is only 64 bit.
  7. I try to prepare my application with TClientDatset for 64 bit, but I have problem with linking of "Midas.dll" into exe file. I have following code for 32 bit, it works. //Midas #include <Datasnap.Midas.hpp> #include <Datasnap.DSIntf.hpp> //force the linker to include the code; It's not enough just to include the header file #pragma package(smart_init) #pragma comment(lib, "Midas.lib") #pragma link "Midas.lib" extern "C" __stdcall int DllGetDataSnapClassObject (REFCLSID rclsid, REFIID riid, void** ppv); int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) { try { bool app_is_terminating = false; //ensure only one instance #ifndef SIMULATION JclAppInstances()->CheckSingleInstance(); #endif //disable windows ghosting ComputingUnit::DisableProcessWindowsGhosting(); Application->Initialize(); Application->MainFormOnTaskBar = true; //register midas.dll RegisterMidasLib(DllGetDataSnapClassObject); //create main form Application->CreateForm(__classid(TfrmMain), &frmMain); It is from this post: https://stackoverflow.com/questions/32658754/deploy-project-without-midas-dll-c However, I con not find a solution for 64 bit. I google it for 2 days now and nothing. The problem is missing "Midas.a" file in 64 bit. I have latest Rad Studio 12.2 with update 2 (RAD Studio 12 Version 29.0.53982.0329), Windows 10. Do you know how to solve this problem on 64 bit? Thank you very much
  8. Jirka52

    x32->x64

    { Demo program for article # 20 "How to extract version information using the Windows API" from http://www.delphidabbler.com/articles.php?id=20. Unit implements class that encapsulates version from an executable file. Copyright (c) 2005, P.D.Johnson (DelphiDabbler) } unit UVerInfoClass; interface uses Windows; const // List of all standard string name cStrNames: array[0..13] of string = ( 'Comments','CompanyName','FileDescription','FileVersion','InternalName', 'LegalCopyright','LegalTrademarks','OriginalFilename','PrivateBuild', 'ProductName','ProductVersion','SpecialBuild', 'Last Compile', 'LastCompiledTime' ); type TTransRec = packed record Lang, // language code CharSet: Word; // character set (code page) end; { PTransRec: Pointer to translation record. } PTransRec = ^TTransRec; { TTransRecArray: Dynamic array of translation records: the translation table. } TTransRecArray = array of TTransRec; { TVerInfo: Class that encapsulates version information stored in an executable file. } TVerInfo = class(TObject) private fFixedFileInfo: TVSFixedFileInfo; // fixed file info record fTransTable: TTransRecArray; // translation table fHasVerInfo: Boolean; // whether file contains ver info fVerInfo: Pointer; // buffer storing ver info function GetString(const Trans, Name: string): string; function GetTranslation(Idx: Integer): string; function GetTranslationCount: Integer; protected function GetVerInfoSize(const FileName: string): Integer; procedure GetVerInfo(const FileName: string; const Size: Integer; const Buffer: Pointer); function GetFFI(const Buffer: Pointer): TVSFixedFileInfo; function GetTransTable(const Buffer: Pointer): TTransRecArray; function GetVerInfoStr(const Buffer: Pointer; const Trans, StrName: string): string; public constructor Create(const FileName: string); destructor Destroy; override; property HasVerInfo: Boolean read fHasVerInfo; property FixedFileInfo: TVSFixedFileInfo read fFixedFileInfo; property Translations[Idx: Integer]: string read GetTranslation; property TranslationCount: Integer read GetTranslationCount; property Strings[const Trans, Name: string]: string read GetString; end; implementation uses SysUtils; { TVerInfo } constructor TVerInfo.Create(const FileName: string); var BufSize: Integer; // size of ver info buffer begin inherited Create; // Get size of buffer: no ver info if size = 0 BufSize := GetVerInfoSize(FileName); fHasVerInfo := BufSize > 0; if fHasVerInfo then begin // Read ver info into buffer GetMem(fVerInfo, BufSize); GetVerInfo(FileName, BufSize, fVerInfo); // Read fixed file info and translation table fFixedFileInfo := GetFFI(fVerInfo); fTransTable := GetTransTable(fVerInfo); end; end; destructor TVerInfo.Destroy; begin // Free ver info buffer FreeMem(fVerInfo); inherited; end; function TVerInfo.GetString(const Trans, Name: string): string; begin Assert(fHasVerInfo); Result := GetVerInfoStr(fVerInfo, Trans, Name); end; function TVerInfo.GetTranslation(Idx: Integer): string; begin Assert(fHasVerInfo); Assert((Idx >= 0) and (Idx < TranslationCount)); // Return string representation of translation at given index Result := Format( '%4.4x%4.4x', [fTransTable[Idx].Lang, fTransTable[Idx].CharSet] ); end; function TVerInfo.GetTranslationCount: Integer; begin Result := Length(fTransTable); end; function TVerInfo.GetVerInfoSize(const FileName: string): Integer; var Dummy: DWORD; // Dummy handle parameter begin Result := GetFileVersionInfoSize(PChar(FileName), Dummy); end; procedure TVerInfo.GetVerInfo(const FileName: string; const Size: Integer; const Buffer: Pointer); begin if not GetFileVersionInfo(PChar(FileName), 0, Size, Buffer) then begin raise Exception.Create('Can''t load version information'); end; end; function TVerInfo.GetFFI(const Buffer: Pointer): TVSFixedFileInfo; var Size: DWORD; // Size of fixed file info read Ptr: Pointer; // Pointer to FFI data begin // Read the fixed file info if not VerQueryValue(Buffer, '\', Ptr, Size) then begin raise Exception.Create('Can''t read fixed file information'); end; // Check that data read is correct size if Size <> SizeOf(TVSFixedFileInfo) then begin raise Exception.Create('Fixed file information record wrong size'); end; Result := PVSFixedFileInfo(Ptr)^; end; function TVerInfo.GetTransTable(const Buffer: Pointer): TTransRecArray; var TransRec: PTransRec; // pointer to a translation record Size: DWORD; // size of data read RecCount: Integer; // number of translation records Idx: Integer; // loops thru translation records begin // Read translation data VerQueryValue(Buffer, '\VarFileInfo\Translation', Pointer(TransRec), Size); // Get record count and set length of array RecCount := Size div SizeOf(TTransRec); SetLength(Result, RecCount); // Loop thru table storing records in array for Idx := 0 to Pred(RecCount) do begin Result[Idx] := TransRec^; Inc(TransRec); end; end; function TVerInfo.GetVerInfoStr(const Buffer: Pointer; const Trans, StrName: string): string; var Value: PChar; // the string value data Dummy: DWORD; // size of value data (unused) Path: string; // "path" to string value begin // Build path from translation and string name Path := '\StringFileInfo\' + Trans + '\' + StrName; // Read the string: return '' if string doesn't exist if VerQueryValue(Buffer, PChar(Path), Pointer(Value), Dummy) then Result := Value else Result := ''; end; end.
  9. You must look at source code
  10. Jirka52

    x32->x64

    Try this function GetVersionInformation(): {$WARNINGS OFF} function LinkerTimeStamp(const AFileName: string): TDateTime; var LI: TLoadedImage; m: TMarshaller; timeStamp: Int64; utcTime: TDateTime; begin Win32Check(MapAndLoad(PAnsiChar(m.AsAnsi(ParamStr(0)).ToPointer), nil, @LI, False, True)); timeStamp := LI.FileHeader.FileHeader.TimeDateStamp; UnMapAndLoad(@LI); utcTime := System.DateUtils.UnixToDateTime(timeStamp); Result := TTimeZone.local.ToLocalTime(utcTime); end; {$WARNINGS ON} function GetVersionInformation(): string; const lastCompileStr: string = 'Last Compile'; cnPackLastCompileStr: string = 'LastCompiledTime'; bitStr: string = '; %d bit'; verInfoStr: string = '%d.%d.%d.%d'; var VerInfo: TVerInfo; //class from unit UVerInfoClass.pas myFileName: string; myResultStr: string; verBitStr: string; FFI: WinApi.Windows.TVSFixedFileInfo; myCompiledTime: TDateTime; Fmt: TFormatSettings; begin Result := ''; myFileName := Application.ExeName; VerInfo := TVerInfo.Create(myFileName); try if VerInfo.HasVerInfo then begin myResultStr := ' ver.'; {get version info} FFI := VerInfo.FixedFileInfo; myResultStr := myResultStr + Format(verInfoStr, [HiWord(FFI.dwFileVersionMS), LoWord(FFI.dwFileVersionMS), HiWord(FFI.dwFileVersionLS), LoWord(FFI.dwFileVersionLS)]); //add bit version {$IFDEF WIN32} verBitStr := Format(bitStr, [32]); {$ENDIF} {$IFDEF WIN64} verBitStr := Format(bitStr, [64]); {$ENDIF} myResultStr := myResultStr + verBitStr; //get date of last compilation if (VerInfo.TranslationCount > 0) then begin myCompiledTime := LinkerTimeStamp(myFileName); if (myCompiledTime <= Now) then begin Fmt.ShortDateFormat := 'dd.mm.yyyy'; Fmt.DateSeparator := '.'; Fmt.LongTimeFormat := 'hh:nn'; Fmt.TimeSeparator := ':'; myResultStr := myResultStr + compiledStr + DateTimeToStr(myCompiledTime, Fmt); end; Result := myResultStr; end; end; finally VerInfo.Free; end; {try} end;
  11. What I see, that you want to put some image into SQL "insert" command. If I try to save some blob, I every time use dataset field and call TClientdataset.ApplyUpdates. Example: //you wan to create new record therefore append dodajslikujds.append; try dodajslikujds.Fieldsbyname('here put correct fieldname').loadFromstream(ms); dodajslikujds.Post; var I := dodajslikujds.ApplyUpdates(0); if (I <> 0) then begin raise Exception.Create('Data was not saved!'); end; {if} except dodajslikujds.Cancelupdates; raise; end;
  12. Jirka52

    Drag Drop via Ole

    You can check in your code these problems with FastMM4. I had the same problem. Look at setting of Fastmm4: https://www.atozed.com/2021/07/detecting-memory-leaks-in-delphi-applications-using-fastmm-4/ It is from blog of @dummzeuch https://blog.dummzeuch.de/2024/09/26/you-should-be-using-the-full-fastmm/ Try to run this code in 64 bit with Fastmm4 and you will probably see exception.
  13. Jirka52

    12.2 Crashing during debugging

    If you use "Twine compile" then you will get following error: [C++ Error] fmain.cpp(15, 26): unknown type name '´╗┐' IDE will survive without problem.
  14. Jirka52

    Breakpoints in Debug + Android 64-bit mode.

    I have this problem on some my projects too. Some projects work ok in 32 and 64 bit debugging and some not. You have 2 possibilites how to sove this: 1. create new blank project and copy all "old" units into new project or second way, it works every time - do remote debugging on localhost in 64 bit - it works, but you must run passerver. But it works only for VCL.
×