Jump to content

Ian Branch

Members
  • Content Count

    1435
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Ian Branch


  1. Hi Cristian,

    Clearly I don't understand the documentation.

     

    Hi David,

    IIUC the code had the 'True' & 'False' around the wrong way??

    I also think the 

    Msg.Result := 0; // disallow Windows from shutting down

    was in the wrong place and should have been before the ShowMessage, AND should have been..

     Msg.Result := 1;  // disallow Windows from shutting down

    I'm trying here guys but this is all new to me.


  2. Hi Cristian,

    Thank you for your input.

    I don't want to stop it, just delay/pause it while the App writes to the log and closes the database gracefully.   Hence the 

    procedure TMainForm.SaveData;

    Then Windows can shut down.

    ATT the message display is purely to confirm that something is happening in the routine.


  3. Hi Guys,

    Thanks to all for your input.

    I am out of my league here but this is what I have att from Dr Google. ;-).

      private
      { Private declarations }
      DataToBeSaved: Boolean;
      procedure WMQueryEndSession(var Msg: TWMQueryEndSession);
        message WM_QueryEndSession; // detect Windows shutdown message
      procedure SaveData; // routine to save data to disk

    Then..

    procedure TMainForm.WMQueryEndSession(var Msg: TWMQueryEndSession);
    begin
      if DataToBeSaved then
        if MessageDlg('Windows is shutting down! First save data changes?',
             mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
          Msg.Result := 0; // disallow Windows from shutting down
          beep;
          SaveData;
        end;
      Msg.Result := 1;     // allow Windows shutdown
    end;
    
    // Set DataToBeSaved to False after saving data
    procedure TMainForm.SaveData;
    begin
      // Save data to disk files
      // ...
      DataToBeSaved := False;
    end;
    .....
    .....
    procedure TMainForm.FormCreate(Sender: TObject);
    begin
      //
      DataToBeSaved := True;
      // 
      ....
      .... 

    In my Win 10 dev PC, when I tell windows to shutdown it goes straight  to the green Shutting Down screen.  I never see the MessageDlg prompt. 😞

    Am I missing some other nuance?

    I noted David's comments and reference.  I need this to work on my Win 10 PC as well as the Customer's Win 7, later I hope to be Win 10, PCs.

    Again, thoughts, suggestions, code appreciated.

     

    Regards & TIA,

    Ian


  4. Hi Team,

    D10.3.3.

    I want to detect Windows shutdown in Win 7 and Win 10 in order to ensure data is saved before the App gets clobbered.

    I have tried a few examples using..

      { Private declarations }
      procedure WMQueryEndSession(var Msg: TWMQueryEndSession);
      message WM_QUERYENDSESSION;

    plus its associated routine, without success.

    I suspect the above may be OK in Win 7, haven't tried it yet, but not for Win 10.

    Anybody got code working as desired in Win 10?

    Regards & TIA,

    Ian


  5. Hi Remy,

    Thanks for the reply/info.

    I used the term 'generic' as it didn't have any '260' in the .bpl file names as opposed to the 'Indy10' I have installed from GitHub.

    I'm not going to play with the Registry. 😉

    Modifying the source for the 3rd party library will obviously be required each time there is an update.  Not the most desirable thing to deal with.

    I shall consider my options further.

    Regards & Tks again,

    Ian.


  6. Hi Team,

    I have Indy10 installed with my D10.3.3.  No problem.  Works fine.  When I installed Indy10 I removed the generic Indy libraries.  Turns out that was a mistake. :-(

    For reasons of comparability another 3rd Party library I need to reinstall the generic Indy that came with D10.3.3.  Whilst retaining Indy10.

    Can anybody advise where/how I might do that please?

     

    Regards & TIA,

    Ian


  7. Hi Team,

    Please pardon my ignorance here, I have never done anything with Threading and I have no idea if any of the 3rd Party stuff I use does.  I suspect not but it is possible I suppose.

    So, to my Question..

    Given my non-threaded environment, aside from the Debugging aspects, I use EurekaLog, does FastMM5 provide any benefit over the native Delphi (10.3.3) memory manager?

     

    Regards & TIA,

    Ian

     

     


  8. Hi Team,

    D10.3.3, Windows 10, Canon printers.

    I switched to the IDE Dark mode a little while ago to see if I could get used to it.  It's growing on me.

    I went to print a section of code from a project with Use color & Syntax print on.  I could hardly read it.  The colors weren't right.  I immediately blamed the ink cartridge(s).  After replacing all of them I still had the same issue. :-(

    I was now starting to suspect the printer so I printed a picture from a separate app.  All good!

    OK.  I know it used to be OK and the only thing I could think was different was IDE Light v Dark mode.

    I switched back to Light mode.  Viola!  All was good again, with the printing colors all good and legible.

    So - Is this a configuration issue with my Delphi?  If so where?  Or, is it a bug?

    Sticking with Light mode for now.

     

    Regards & TIA,

    Ian


  9. Hi Team,

    Some time in the not too distant past I sought a method for minimizing the main form but not any open sub forms.

    I 'sourced' the technique from somewhere but cannot for the life of me remember what was required, nor, as I have the source code of the relevant App it is working in, can I divine what I did to make it work. 😞

    It is going to be something simple but I just can't see it. 😞

    Appreciate any thoughts/suggestions on the minimizing.  Don't need comments on my memory. 😉

     

    Regards & TIA,

    Ian


  10. 3 minutes ago, Fr0sT.Brutal said:

    DB should never accept or send a timestamp as a string

    Database Dates are always as datetime.  Where it falls down is when creating a filter.

    e.g.

    '13-Mar-20' is not a valid date.  This is from a Calendar component picking up the PCs short date format.

    '13/03/2020' is a valid date.

    So, my objective is to force the, dates in this case, to the same format as required.

    I get the same issue with Currency symbols, etc.


  11. Hi Team,

    I don't even know if this is practical or possible but it probably is given the capability of Delphi.

    I have a Multi-User Customer who is more than a little negligent in setting up his workstations with the correct Language/Region settings. :-(

    In their Customer Table is a field called Country.  In it is the Company's Country name.  e.g. Australia, India, Fiji, Angola, etc.

    What I would like to do is to read that name and based on it retrieve from somewhere the relevant Language/Regional settings and set Delphi's Settings accordingly, such that no matter what the Workstation settings are, the Delphi App is working with and according to the Country parameters.

    Thoughts/suggestions appreciated.

    Regards,

    Ian


  12. Atilla,

    On the iPad, I did find that when I clicked the button and moved the mouse/pointer down to the TImage, the first press of the screen left a dot but wouldn't track.

    It is a relatively old 9.7" iPad, don't know if that has any bearing.  Might see if I can find someone with an iPad stylus to try.

    Thanks for all your help.

    Regards,

    Ian

×