Jump to content

DelphiUdIT

Members
  • Content Count

    452
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by DelphiUdIT

  1. In Delphi 11.2 ASLR (and High Entropy too) may be used and is working. But when i tested it in a real running environment, there were some glitches (AV, memory leak, ....) that don't show up if I simply turn off ASLR. I've noticed that the use of 3rd party dlls (SDK or whatever) even if recent plays a role in this. All of course in a 64-bit environment. I didn't go into depth because I'm busy on several fronts, but in the near future I'd like to go into it further. For now I don't use ASLR and High Entropy. Bye
  2. I'm implementing a new feature to the software I've produced that used e-mail as an alert. Now I'm also testing mosquitto as a server and I'm rebuilding a new MQTT client starting from an old repository on github https://github.com/wizinfantry/delphi-mqtt-client (that version is not working with new enviroment and needs some refresh). The current version of mosquitto supports up to the latest version of MQTT (MQTT 5.0 https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.pdf), SSL (up to TLS 1.3), TCP or websockets. Also you can connect to other brokers. And with retains, there's no problem at all losing alerts, especially using mobile devices as clients. In my opinion, since the server (broker) is already ready, implementing MQTT having a good Delphi "component" allows you to easily manage alerts. Bye P.S.: in this Embarcadero article there is more info and link to a client and broker MQTT write in Delphi: https://blogs.embarcadero.com/learn-how-to-use-the-mqtt-protocol-in-delphi-with-this-library/
  3. DelphiUdIT

    Turn display Off/On

    PostMessage(HWND_BROADCAST , WM_SYSCOMMAND, SC_MONITORPOWER, 2); This should works, it always works in every version of Windows. If it not works, it's possible that you have some drivers, services or others that prevents you from turning it off. Any movements of the mouse and key pressing turn on the monitor. Bye
  4. DelphiUdIT

    Turn display Off/On

    To turn monitor on simply simulate a keypressed: //Simulate the pression of SHIFT key ... keybd_event(VK_SHIFT, 0, 0, 0); keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); Bye
  5. DelphiUdIT

    Zeos on Delphi 11.2

    Download from the official GH repository. Unzip to a folder of your liking. In the Packages\DelphiXE10.4 directory open the group project ZeosDbo.groupproj For each single project present, go under options and change, UNDER THE ITEM DESCRIPTION, libsuffix with the value 280 BUILD ALL, after that INSTALL "ZComponentDesign280.bpl". All should be done as Windows 32 as target platform. After that close all. Restart IDE, go to TOOL/OPTIONS/Language/Delphi/Library. Select the Platform and in the Library path you must add the path to the SRC subfolders (includes SRC) ... core, component, dbc, parsesql, plain. You must add in the Library Path of every Platforms that you want to use (Windows 32 and WIndows 64 for example). Now you are ready to use Zeos, but ... in the repository (lib) there are only drivers for 32 bit DB. You must install the runtime DB (FireBird x64 for example) to use it in the 64 bit application. Bye
  6. In the JVCL exist that component: TJvDialButton. You can use it or start study that component. Bye
  7. DelphiUdIT

    Web-fonts v Desktop-fonts

    I'll give you the answer in Delphi as indicated in this link Pascal load font form resource (embedded in exe). Converting it to C shouldn't be a problem. Make a text file and rename it 'resource.rc'; Put inside a line like this (you can insert how many fonts do you need): LCDN RCDATA ".\LCDN.TTF" The meaning of the data is: "Name of the resource" "Resource Type" "Font FIle Name" Insert the file "resource.rc" in you project; By doing so, you insert the font into your executable and you don't have to extract it or anything else. This is a simple code in pascal to use it: function LoadResourceFontByName( const ResourceName : string; ResType: PChar ) : Boolean; var ResStream : TResourceStream; FontsCount : DWORD; begin ResStream := TResourceStream.Create(hInstance, ResourceName, ResType); try Result := (AddFontMemResourceEx(ResStream.Memory, ResStream.Size, nil, @FontsCount) <> 0); finally ResStream.Free; end; end; procedure TForm1.FormCreate(Sender: TObject); begin if LoadResourceFontByName('LCDN', RT_RCDATA) then //THIS 'LCDN' IS THE NAME OF THE RESOURCE Label1.Font.Name := 'LCDN'; //THIS 'LCDN' IS THE INTERNAL NAME OF THE FONT AND SHOULD BE KNOW (CAUSE THE FONT FILE MAY CONTAIN MORE TYPE LIKE BOLD, OR OTHERS) end; end.
  8. Some time ago I had a similar problem with RESOURCESTRING, both in overwriting (with the VirtualProtect function) and with LOADRESSTRING in multithreading. Since that time I have created a unit in which I perform all the functions of loading the resources and their eventual overwriting by calling it at the end of the initialization of all the other modules, and since then I have not had more problems. I mainly use the function for translation purposes.
  9. DelphiUdIT

    IDE it's not working anymore

    I don't know if this will help, but in the "KNOW ISSUE OF THIS UPDATE" (link to Microsoft KB of the last Update: Win 10 last update ). They talk about problems with applications that use "certain" audio devices. Bye
  10. My mistake. This is the correct code: function cntCaseTbl(Z: Int64): Int64; begin Result := 0; //This should be, otherwise the result will be random value if z > 0 then Result := Trunc(Log10(z))+1; else if z = 0 then Result := 1; end;
  11. I have tried all limit values 1, 10, 100, 1000, 10000, ....., 9, 99, 999, 9999, 99999, ...... And all the returned values are correct.
  12. May be you can write the function in this way ? function cntCaseTbl(Z: Int64): Int64; begin if z >= 0 then Result := Trunc(Log10(z))+1; else Result := 0; //This should be, otherwise the result will be random value end;
  13. DelphiUdIT

    Windows XP App

    If you are FTDI chips in use you have only one way to work on XP: you must use the VCP drivers of FTDI (Virtual Com Port) that simulates the standard Windows com serial port. The drivers should be signed with version prior 2.12.24 !!! You'll find the drivers for XP in this page: All VCP FTDI drivers version for all version of SO Of course you can use the driver on XP if the FT4232 chip is supported ..... In your TCOMPort component use COMx, I mean the COM port listed in the device manager of windows. Hope this help. Bye
  14. DelphiUdIT

    Windows XP App

    Of course, he MUST have "grep" ... he has Delphi 10.4
  15. DelphiUdIT

    Windows XP App

    That function is called for example by the library used with FTDI USB to RS232 / RS485 peripherals. If someone has integrated FTDI peripheral functionality as a COM (serial) component that function may be called. But from what I know, the drivers for those devices no longer load in XP. The serial devices of the FTDI are in very common use.
  16. Remember that in the new Intel hybrid architectures (such as Alder Lake) not all cores are usable, or rather not all cores have the same processing "power" (eg. P-Core and E-Core).
  17. Look at this code and run it (VCL Applicaton with a Form, a Button with OnClick Event and a custom class) unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TDoSomething = class Danger: string; constructor create; function Ghost: boolean; end; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; DoSomething: TDoSomething; implementation {$R *.dfm} constructor TDoSomething.create; begin //FROM HERE I NEVER GO THERE .... AND IF I GO THERE BY WRONG, CLOSE THE PROGRAM !!! ExitProcess(0); end; function TDoSomething.Ghost: boolean; begin try result := true; ShowMessage('Here I am, I am a ghost'); except result := false; end; end; procedure TForm1.Button1Click(Sender: TObject); begin if DoSomething.Ghost then //<------- DoSomething is NIL !! ShowMessage('OK, executed') else ShowMessage('KO, some errors append'); end; end. The class is not instantiated, but the GHOST function is executed. Am I missing something? I trust in my abysmal ignorance, because otherwise much more than a certainty collapses ... In tens of years of programming I have never dared to write anything like this, taking some concepts for granted. Aside from the fact that the program doesn't make much sense (good programming rules would also like a "if Assigned(DoSomething) then" before using it), such code cannot run ... at runtime I would expect an error. Hope someone can explain this. Bye
  18. @Dalija Thanks for your article. You have cleared up more than a few doubts.
  19. This is new to me ... a non-instantiated object that "executes" a method .... Yes, of course an exception is thrown: it must be like this because a string needs to have memory allocated. Anyway, thanks for the explanation. I thought that without an "instance" a method could not be executed, or rather that an exception was thrown. You never stop learning. <---- I mean I never stop learning (EDIT) Bye
  20. In general, when I create a new class, a new feature or other, I always think about the possibility that the class is derived (inheritance, polymorphism) and therefore writing a code like the one indicated I would not write it even if it were possible without side effects. Bye
  21. In the latest daily repository available (today 02/21/2022), compiling for Linux64 there are two "probable" bugs: 1) In the file OverbyetIcsSslX509certs.pas on line 1836 the definition of the TMsCertTools class is missing. Solved like this: {$ IFDEF MSWINDOWS} FNewSslCert: = TMsCertTools.Create (self); {V8.67 was TSslCertTools} {$ ELSE} FNewSslCert: = TSSlCertTools.Create (self); {$ ENDIF} 2) In the file OverbyteIcsMailQueue.pas on line 2182 the definition of SetEndofFile is missing (in Linux it does not exist), replaced as follows: {$ IFDEF MSWINDOWS} SetEndOfFile (FHandle); // truncate file size {$ ELSE} ftruncate (FHandle, Count); // truncate file size {$ ENDIF} Inserted in the uses the unit Posix.UniStd Changes not tested yet, but the build is done. PS: I will send you a postcard as soon as possible Bye
  22. DelphiUdIT

    Bug - Linux 64 Compiled

    Sorry, I didn't realize the question was for me ... No, I only compiled for Linux. I wanted to see if everything was standing with Linux because I should start with a project with which the ICS components would suit me. But I haven't done anything yet "run" ... I don't know when I'll start, and I'm not a master in Linux programming. Bye
  23. DelphiUdIT

    Bug - Linux 64 Compiled

    Ok, take care about the new line inserted "ftruncate (FHandle, Count)": It may be that the line is also "ftruncate (FHandle, FLen)", I don't know which of the two variables is correct to be used.. {$ IFDEF MSWINDOWS} SetEndOfFile (FHandle); // truncate file size {$ ELSE} ftruncate (FHandle, Count); // <- ftruncate (FHandle, FLen); ???? {$ ENDIF} Bye
  24. You can create applications of various types, each with its own characteristics: - a Windows service, this is an application with no user interface that runs as a service; - a console application, also an application without a graphical interface, runs on the command line. All these have the access point in the .dpr file, but the path develops in a different way than in a graphic application (typically with a Form). Bye
  25. DelphiUdIT

    enable/disable the internet connection?

    I think the arguments we are discussing are a bit confusing: the title of the topic was "enable / disable the internet connection" and not how, why and when to update Windows. Now we are talking about all but nothing .... Bye
×