Jump to content

Mr. E

Members
  • Content Count

    41
  • Joined

  • Last visited

Posts posted by Mr. E


  1. Thank you @JonRobertson

    Using the words you provided, I managed to find the section to adjust/wrap the code to more than 80 columns when formatting with Ctrl-D

    Tools -> Options -> Formatter -> Delphi -> Line breaks -> Right margin.

    I changed it from 80 to 120 to test it and it does work.

    image.thumb.png.48c0a3ef586f678189cd4b4ae6851e88.png

     

    image.thumb.png.3c77b56e34a8393ea20b61c064217c0f.png

     

    I also discovered that searching for the words "right margin" does not locate the "Formatter" section I was looking for.

    image.png.966dd9ada20657716e7638d96f991333.png

     

    This other post ("Change the scroll width of the Delphi IDE Editor window"), complete what I needed to adjust the code formatting.

    Quote

    ..I can find two separate setting in the Delphi (XE) IDE that affect the editor width:

    1) the right margin setting under [Editor Options][Display]

    2) the right margin setting under [Formatter][Delphi][Line Breaks]

    The 1st option only seems to affect the width of the visible right margin in the editor, the 2nd option affects the wrap width of the auto-formatter. ...


     

     


  2. I have always been unable to find an answer to the following:
    The vertical line I point to in the image:

    381622336_simplequestionaboutideeditor.thumb.png.0c06e554f3e59832ed16a69e16e6248b.png


    Does it have a name?
    Can its horizontal position (width or column) be changed?

     

    Is it correct for what I think it is?
    When using Format Code (Ctrl-D), it makes all the code stay inside the limit of that column.

     

    Thanks in advance.


  3. @PeterBelow @programmerdelphi2k

    Sorry for the delay and thank you very much,

    I hope to update this weekend by uninstalling those two Parnasus packages.

     

    On 12/10/2022 at 8:08 PM, programmerdelphi2k said:

    you can register your key in my.embarcadero.com and download your iso, not?

    Yes, I did this but after using the webinstaller.

     

    I'm not sure, but reinstalling with the ISO is not recommended since I installed with the web installer, right?

    If I manage to upgrade; later I will try to create a new VM and install from scratch using the ISO (but that's a lot of work accumulated at the moment); I just have the doubt if it won't cause me a problem with the CData connectors license that was "registered?" with the current VM.

     

    Regards!


  4. 17 minutes ago, programmerdelphi2k said:

    always prefere download ISO for avoid any problems while installing ... here RAD Studio 11.2 complete = +18GBytes in disk after installation!

    Yes, I also prefer the ISO, but when we bought the license my salesman did not provide me the ISO in time and I had to use the web install; the urgency forced me to use it and now I regret it.

    I have done some research and I see that the registry data of the web install and ISO install are not compatible. I guess if I uninstall and reinstall with the ISO I will be shooting myself in the foot.


  5. Greetings,

     

    How long does it take to update Delphi 11?

    The resource and performance monitor do not show any activity (hdd, network).


    It is a Windows 11 Pro VM on Proxmox, with adequate resources; I disabled the Firewall and it has no antivirus.

    I have almost an hour and I don't see any progress in the update/installation (web install).

     

    I'm going to wait another hour; but, I am tempted to stop the VM, restore it (I did a previous backup) and retry.

     

    image.thumb.png.562bad52fcc1bb5981ef7aadd6bbfea2.png


  6. Although I like your solution better. Perhaps something could be programmed to make use of "msg":

     

    Msg: Sends a message to a user on a Remote Desktop Session Host (RD Session Host) server.

     

    Quote

    Syntax

    
    msg {<UserName> | <SessionName> | <SessionID>| @<FileName> | *} [/server:<ServerName>] [/time:<Seconds>] [/v] [/w] [<Message>]
    

    Examples

    • To send the message entitled "Let's meet at 1PM today" to all sessions for User1, type:

      msg User1 Let's meet at 1PM today
    • To send the same message to session MODEM02, type:

      msg modem02 Let's meet at 1PM today
    • To send the message to session 12, type:

      msg 12 Let's meet at 1PM today
    • To send the message to all sessions contained in the file USERLIST, type:

      msg @userlist Let's meet at 1PM today
    • To send the message to all users who are logged on, type:

      msg * Let's meet at 1PM today
    • To send the message to all users, with an acknowledgment time-out (for example, 10 seconds), type:

      msg * /TIME:10 Let's meet at 1PM today

    Although it seems that there are problems in windows server 2016 or 2019.


  7. Greetings, I need your guidance.


    I made an ActiveX control which I need to use in one big applications (ParnetMenu) for various containers, but it is somewhat elaborate to update.

     

    So, to get out of trouble, I made an emergent application as a simple container for this ActiveX control.
    On my development machine, the application closes correctly and disappears from the processes running on Windows 10 pro 64 bit (virtualized in virtualbox).

    The problem occurs with end users (Windows 10 pro 64 bit), when closing the application it remains running in the windows processes and it is necessary to go and terminate the process manually.

     

    In fact, my main application (ParnetMenu) where I will use this control, suffers the same problem but there we programmed a button that looks for the id of each container and closes the process, using the TDOSCommand component and performs a Taskkill to close the screens that use these ActiveX controls.

    (Force closure)

    image.png.9d465a90dc744fda1a47ea24ee8b0ffa.png

        exe := stringReplace(button.Caption, ' ', '_',
          [rfReplaceAll, rfIgnoreCase]);
        button.visible := false;
        PID := escribeVar(exe);
        PID := 'Taskkill /F /PID ' + PID;
        dos.CommandLine := PID;
        dos.Execute;

    In this emergent application I have tried several things, attached actual and previous code:

    • First by clicking on "X" in the application I release the control and Terminates de application. It did not work.
    • Second. Then I removed the buttons and add a panel with a button to try another way.

     

    Same result the application remains running in the background:

    image.thumb.png.56fb47b4f753ab3508580c5d6cf668b8.png

     

    The layout of the application:

    2021-07-02_13-47-container.thumb.png.402e2a50467a8b14667651408f25f12b.png


    This is the code for this emergent container:

    unit MainForm;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs
      , SALMVCC_To_Cancel_AX_TLB, RzButton, Vcl.ExtCtrls, System.ImageList, Vcl.ImgList, Vcl.StdCtrls
      ;
      
    type
      TMain = class(TForm)
        il1: TImageList;
        pnl1: TPanel;
        bb1: TRzBitBtn;
        lbl1: TLabel;
        procedure FormCreate(Sender: TObject);
        procedure bb1Click(Sender: TObject);
      private
        { Private declarations }
        var
          CADISalidasCancelacionAutorizacion: TcoADI_SALMVCC_To_Cancel;
        procedure doLoadOCX;
      public
        { Public declarations }
      end;
    
    var
      Main: TMain;
    
    implementation
    
    {$R *.dfm}
    
    procedure TMain.bb1Click(Sender: TObject);
    begin
      lbl1.Visible:= True;
      self.Refresh;
      Sleep(200); // to give time for the message to be displayed.
      CADISalidasCancelacionAutorizacion.Destroy;
      Sleep(500); // to give time for the message to be released?
      Application.Terminate();
      Sleep(2500); // Just to debug this problem
      System.Halt(0);
      //TerminateProcess; // don't know how to use yet
    end;
    
    procedure TMain.doLoadOCX;
    begin
      CADISalidasCancelacionAutorizacion := TcoADI_SALMVCC_To_Cancel.Create(self);
      CADISalidasCancelacionAutorizacion.Parent:= self;
      CADISalidasCancelacionAutorizacion.Align:= alClient;
    end;
    
    
    {procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      CADISalidasCancelacionAutorizacion.Free;
      Application.Terminate;
    end;}
    
    procedure TMain.FormCreate(Sender: TObject);
    begin
      doLoadOCX;
    end;
    
    end.

     

    I had previously used this, but it didn't work either.

    procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      CADISalidasCancelacionAutorizacion.Free;
      Application.Terminate;
    end;

     

    Note: My PC has no antivirus running (except Microsoft's), my users use Avast and there is already an exception for them not to send the application to the sanbox. I even tried disabling the antivirus on a computer and the problem persists.

     

    Regards and thank you.

    -------

    Addendum:

    The main goal is not only to solve this problem with the emergent application. But also to eliminate the use of TaskKill in my ParnetMenu application; and to eliminate the hang that occurs.

    And of course, occasionally I will be able to create more definitive applications using the ActiveX container.

     

     

     

     


  8. Indeed in my case, the solution is: backup and delete from the registry the guilty one, In my case my version is "..\BDS\18.0\.."

    Quote

    Luis Navarro from Embacadero just explained to me:

    Close the IDE, then delete the OmniThread folder from MyDocuments\Embarcadero\Studio\17.0\CatalogRepository After that, you have to edit the registry and delete also the Omnithread folder from HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\17.0\CatalogRepository\Elements

    This worked like a charm.
    Note that for me there was no registry key in the above path for OmniThread yet. Perhaps the key only gets written upon successful installation of the package.
    In that case you only need to delete the PackageName directory and reinstall.

     

    Thank you @FredS


  9. Regards, this problems occurs from time to time in getit now I got bitten again.

    Hopefully someone knows how and where I can tell to Getit that EurekaLog isn't installed so I can reinstall it.

     

    This is the little story:

    I got the EurekaLog Tools (free) v 7.0 installed, today I see the new version 7.7.5.0. and I do this:

    • EurekaLog Tools 7 was installed via Getit
    • Without uninstall the v7 in getit: I install the v7.7.5.0; the process goes without error, and the install remove the previous one, the IDE restarts; (I was expecting that Getit remove the old one and take out from Getit but no).
    • In Getit now I see two versions installed. (annoying), then
    • In Getit I uninstall the v7, it removes in GetIt and from Programs and Features too. Now I don't have the programs installed (but Getit shows as installed).
    • In Getit that shows 7.7.5.0 is installed, when I try to uninstall, I got this error, and I can't reinstall again:

     

    image.png.dc312193eeac87a706e5d8d9627ddcb6.png

     

    This happens with other package, but I don't remember how I "remove it", still get it shows the old version to install, as a reminder that I don't remember :classic_blink:

    image.png.765f87ebfb4be87209246ab6d2608494.png

     

    Thanks in advance.


  10. @Kryvich THANK YOU! (I'm screaming, Yes!)

    This is like seeing a sunrise and wondering how it's this possible? 🌞

    image.png.611325b4600644b7759af07dbecdb0ce.png

    I'm reading your code, is slick and to the point.

    This isn't trivial for anyone without previous knowledge, I need a lot of theory to learn (web, sockets, mORMot, etc.)

    --

    How can I mark the post as solved (with a lot to read/learn) ?

     

     

     

    • Like 1

  11. 3 minutes ago, Kryvich said:

    But you can use other third-party library, ... I can recommend THttpRequest class from SynCrtSock.pas, mORMot. Something like this:

    This!

    Now I need to learn how fill the parameters, as the example provided:

    POST https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl HTTP/1.1
    Content-type: text/xml;charset="utf-8"
    Accept: text/xml
    SOAPAction: http://tempuri.org/IConsultaCFDIService/Consulta
    cache-control: no-cache
    Host: consultaqr.facturaelectronica.sat.gob.mx
    accept-encoding: gzip, deflate
    content-length: 414
    Connection: close
     
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
       <soapenv:Header/>
       <soapenv:Body>
          <tem:Consulta>
             <!--Optional:-->
             <tem:expresionImpresa><![CDATA[?re=LSO1306189R5&rr=GACJ940911ASA&tt=4999.99&id=e7df3047-f8de-425d-b469-37abe5b4dabb]]></tem:expresionImpresa>
          </tem:Consulta>
       </soapenv:Body>
    </soapenv:Envelope>

    Looking the mORMot unit/doc and searching for examples.

     

    Thank you!


  12. @KryvichThank you, I appreciate your work.

    The problem: the sat.gob.mx has been doing changes to their web services, this is the second variant of the w.s., and they decide to hide the wsdl for this and many others services.

    Luckily an authorized certification provider (PAC) create this test service, cloning the functions of the real w.s.

    Hiding the wsdl services is forcing us to use it using a HTTP POST Request in Delphi. This is what I seek to learn, preventing more changes in the future.

    This sat is tied to m$ technologies, leaving us (the Delphi devs.) with the burden to adapt our approach to each changes or new services they publish.

    Again thank you very much.


  13. Regards,

    I'm searching how to create an HTTP POST request, but I can't manage to do it.

    This is a SOAP Service that I can consume using the ?wsdl (now is hidden); but some nice provider write this:

    Quote

    https://developers.sw.com.mx/knowledge-base/servicio-publico-de-consulta-estatus-cfdi-sat/
    Consumo a través de un POST

    Debido a que el SAT oculto la declaración del WebService en productivo lo consumiremos a través de un HTTP Request POST indicándole los datos correspondientes.

    ----

    Consumption through a POST
    Because the SAT hidden the WebService declaration in productive, we will consume it through an HTTP Request POST indicating the corresponding data.

    POST https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl HTTP/1.1
    Content-type: text/xml;charset="utf-8"
    Accept: text/xml
    SOAPAction: http://tempuri.org/IConsultaCFDIService/Consulta
    cache-control: no-cache
    Host: consultaqr.facturaelectronica.sat.gob.mx
    accept-encoding: gzip, deflate
    content-length: 414
    Connection: close
     
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
       <soapenv:Header/>
       <soapenv:Body>
          <tem:Consulta>
             <!--Optional:-->
             <tem:expresionImpresa><![CDATA[?re=LSO1306189R5&rr=GACJ940911ASA&tt=4999.99&id=e7df3047-f8de-425d-b469-37abe5b4dabb]]></tem:expresionImpresa>
          </tem:Consulta>
       </soapenv:Body>
    </soapenv:Envelope>

    I try something like this, using Indy; but the web is a dark box for me in Delphi.

    // I'm trying using the REST clients, the Indy Http, ... 
    uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Xml.xmldom, Xml.XMLIntf, Vcl.ComCtrls, Xml.Win.msxmldom, Xml.XMLDoc
      ,Vcl.StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, Xml.omnixmldom, IPPeerClient,
      REST.Client, Data.Bind.Components, Data.Bind.ObjectScope, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL,
      IdSSLOpenSSL;
    
    ...
    uses IdMultipartFormData;
    ...
    procedure TForm3.Button3Click(Sender: TObject);
    var
      data: TIdMultiPartFormDataStream;
    begin
      data := TIdMultiPartFormDataStream.Create;
      try
        // add the used parameters for the script
        data.AddFormField('expresionImpresa', '?re=LAN8507268IA&rr=LAN7008173R5&tt=5800.00&id=4e87d1d7-a7d0-465f-a771-1dd216f63c1a');
        // Call the Post method of TIdHTTP and read the result into TMemo
        Memo1.Lines.Text := IdHTTP1.Post('https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc', data);
        //ERROR
        //HTTP/1.1 415 Cannot process the message because the content type 'multipart/form-data; boundary=--------111018174150958' 
        //was not the expected type 'text/xml; charset=utf-8'.
        //---------------------------
      finally
        data.Free;
      end;
    end;
    
    
    procedure TForm3.Button2Click(Sender: TObject);
    var S: TStringList;
       M: TStream;
    begin
     S := TStringList.Create;
     M := TMemoryStream.Create;
     try
       S.Values['expresionImpresa'] :=
       '?re=LAN8507268IA&rr=LAN7008173R5&tt=5800.00&id=4e87d1d7-a7d0-465f-a771-1dd216f63c1a';
       //'![CDATA[?re=LAN8507268IA&rr=LAN7008173R5&tt=5800.00&id=4e87d1d7-a7d0-465f-a771-1dd216f63c1a]]';
    
       IdHTTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;
       //IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
       IdHTTP1.Post('https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc', S, M);
       Memo1.Lines.Add(Format('Response Code: %d', [IdHTTP1.ResponseCode]));
       Memo1.Lines.Add(Format('Response Text: %s', [IdHTTP1.ResponseText]));
       // ERROR:
       //HTTP/1.1 415 Cannot process the message because the content type
       //'application/x-www-form-urlencoded' was not the expected type 'text/xml; charset=utf-8'.
       //---------------------------
       M.Position := 0;
       S.LoadFromStream(M);
       Memo1.Lines.AddStrings(S);
     finally
       S.Free;
       M.Free;
     end;
    end;

    Consuming the web services is a lot easier, just I need to Import the WSDL (is hidden right now but I still manage to get before), create the unit and start using the service, the consume is just:

    procedure TwsConsultaCFDIEmpresa.doConsulta (const representacionI : string);
    var
      ics : IConsultaCFDIService;
      vAcuse : Acuse2;
    begin
      try
        ics := GetIConsultaCFDIService(false);
        // representacionI is something like:
        // ?re=LAN8507268IA&rr=LAN7008173R5&tt=5800.00&id=4e87d1d7-a7d0-465f-a771-1dd216f63c1a
        vAcuse:= ics.Consulta(representacionI);
      finally
      	with vAcuse do
        ShowMessage(CodigoEstatus +'/ '+EsCancelable +'/ '+ Estado  +'/ '+EstatusCancelacion);    
      end;
    end;

     

    I need to read some basic documentation, but alas, I don't know how to start. Maybe with a working example can I go forward.

    I don't know if using the "REST clients" are something that I need.

     

    Edit: Using Firefox I got an extension named "Httprequester" but I can't make a successful request/POST. :classic_sad:

    Thanks in advance


  14. I wonder if there is a way of mute topics that aren't interested for me and got a lot of attention/posts that make it shows over and over.

    Using the "Fluid" option allows to see only that Forum, but sometimes a lot of topics are a little "annoying". :classic_wink:

    Then if I want to read it again, unmuting that topic can be helpful too.

     

    (Thinking twice, seems like this topic is a good & bad example :classic_unsure: )

    Regards

    • Like 1

  15. 9 hours ago, Primož Gabrijelčič said:

    This is mentioned in the book: http://www.omnithreadlibrary.com/book/chap10.html#howto-com 

     

    P.S. Make sure that you don't call any VCL code from you background threads!

    Thank you @Primož Gabrijelčič, now I know what to read & learn "7.12 OmniThreadLibrary and COM/OLE" :classic_love:

     

    Edit:

    Seeing your recommendation about VCL; if I need to update a TListView with the output of each call of the web service, then I'll need to divide my code so I can update that VCL controls. 💭

     

    Edit #2:

    @Primož Gabrijelčič Is correct this approach?

    Asyn(do_something_with_the_webservices)
    .Await(
        procedure
        begin
          // Can I update ListView controls here?
          // ... more code inside
        end);

     

    Edit #3 . (To myself) First read the docs, then ask later! [ self.slap :classic_blink:]

    ..


  16. Is possible to add this feature: Bookmarks ?

    From time to time I read some very interesting post, that qualify as tips & tricks that need to be bookmarked for further reference.

    Maybe it exists and I don't know how to use it; this forum is full of features.

    I use other forums that use "discourse" and have this useful feature.


  17. 5 minutes ago, Schokohase said:

    But this is not an OTL issue.

    ...

    You will have the same problems when working with TThread or TPL or OTL or ... anything else which will use a thread different from the main thread.

    Hence the nature of this post, for the new users of this great library.

    But it's official, I need to read more documentation of OTL, learn and be aware of changes that need care, Delphi really do a great job lifting the weight for us.

     

    I manage to fix one application; and I got a some more that can beneficed using OTL.

     

    Some other app trows me an unexpected AV error, it just consume another web services, open some xml file, inspect that some elements are present then upload to that service.

    At the end, closing the app got this: Delphi and threads: “System Error. Code: 1400. Invalid window handle (need to read tomorrow and fix it)

    Regards!


  18. 18 hours ago, Markus Kinzler said:

    A click on the star/circle leads to the first unread post.

    OK, I can't find any star/circle using Waterfox+Linux/Manjaro.

    By circle you mean the "avatar/circle" at the right?

    If I hover the mouse over a topic I can see the start of the post and a second tab with (maybe) the fist/last unread post.


  19. @Primož Gabrijelčič, yes the exception pops up. I remotely connect to my office to check it, and now I see that I'm using and OTL old version, updating now.

    The exception occurs, following @Schokohase advice and was right.

    Looks like access that web services needs your advice to works. So I need  to add "ActiveX" on the uses clause:

    uses ...
      , ActiveX
      , OTLparallel;
      
    // add the 
    procedure TForm1.doConnectionToService
    begin
       try
         CoInitialize(nil);
         //...
         wsServicio := Servicio.GetServicioSoap(cbUseWSDL.Checked);
         //...
       except
         on E : Exception do
         begin
         	//...
         end;
       end;
       CoUninitialize;
    end;
    
    // on my clic event
    procedure TForm1.bbConectarClick(Sender: TObject);
    begin
      bbConectar.Caption:= 'Comprobando Acceso...';
      bbConectar.Enabled:= False;
      
      // The old annoying unresponsive way:
      // doConectar;
      // bbConectar.Caption:= '&1) Comprobar Acceso';
      // bbConectar.Enabled:= True;
      
      // The new code without unresponsive GUI! Thank you Primoz G.
      Async(doConectar)
        .Await(
        procedure
        begin
          bbConectar.Caption:= '&1) Comprobar Acceso';
          bbConectar.Enabled:= True;
        end);
    end;

    Maybe there need to be a new entry in the OTL FAQ because I don't find any reference (I wasn't searching thoroughly).

     

    Thank you for the help!

     

    Regards

     

    image.png


  20. Using Linux - WaterFox. When I go to some category and read all the posts+responses, I expect to see the content mark as read. Sometimes works but others the forum/category doesn't. Even if I check the "Mark forum as read" the label "New" doesn't disappear.

     

    As last resort I click on "Mark site read" at the bottom, that works.

     

    I don't take a previous screenshot, but I see that something has changed using that option: the icons on the left or something shows gray/changed. It's "looks all read" :classic_blink:, this is good of course.

     

    image.png.c8a25dc4bb9fca0cba13f6f36f7d9c79.png


  21. I don't find any information about OTL related with this msxml issue.

    Looks like is not related, maybe is something wrong with my project configuration.

    I'll check the project/IDE, recompile the original code and see if this error occurs. (fingers crossed) :classic_unsure:

×