Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

1 MONTH VIP - 5$; 3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

MessageDLG disappear to background

Discussion in 'Delphi Programming' started by aikona, Mar 6, 2014.

  1. aikona
    Offline

    aikona DF Member

    My software usualy runs minimized and is called ( maximized) to the foreground by another application.

    In my software there is a timer that brings up a messageDLG .Most times this message appears in front of all the other aplications but it sometimes happens that this message is hidden behind all the windows.

    Problem 1 : the timed warning is not seen and thus ignored.
    Problem 2 : When my software is then maximized this messageDLG is still in the background and it looks like my software is frozen.

    How can I get this message back to the foreground ... or cancel old message and create new one.

    Eric
     
  2. AdminDF
    Online

    AdminDFAdminDF is a Verified Member DelphiFan Administrator Staff Member DF Staff

    RE:

    maybe this code help to you :

    Code:
     unit Unit1;
     
     interface
     
     uses
       Windows, Messages, SysUtils, Variants, Classes,
       Graphics, Controls, Forms, Dialogs, ExtCtrls;
     
     type
       TForm1 = class(TForm)
       private
         procedure WMTimeChange(var Msg: TMessage) ; message WM_TIMECHANGE;
       public
         { Public declarations }
       end;
     
     var
       Form1: TForm1;
     
     implementation
     {$R *.dfm}
     
     procedure TForm1.WMTimeChange(var Msg: TMessage) ;
     begin
       Windows.MessageBox(
         handle,
         'This is a system modal message'#13#10'from an inactive application',
         'A message from an inactive application!',
         MB_SYSTEMMODAL or MB_SETFOREGROUND or MB_TOPMOST or MB_ICONHAND) ;
     end;
     
     end.

    Run the example and minimize it

    After this goto time and date and try change date or time on your windows;

    Good day
     
  3. aikona
    Offline

    aikona DF Member

    Ok , your code works ,now I just have to figure out how to include it in a timerevent

    This is more or less what I would like to do
    Ontime event

    If Something  = somethingElse then
     if  Messagedlg( 'Do you want to carry on 'mtWarning,[mbOK, mbCancel],0,mbCancel) = mrOk) then
     Begin // Do carry on stuff
     End
     Else // reset timer and display message again


    Thanks

    Eric
     
  4. AdminDF
    Online

    AdminDFAdminDF is a Verified Member DelphiFan Administrator Staff Member DF Staff

    RE:

    i have this code sample 

    Code:
    ===Example test code=========================
    uses
      Unit2;
    
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      iRet: Integer;
      iFlags: Integer;
    begin
    // example 1
       iFlags := MB_OK or MB_SETFOREGROUND or MB_SYSTEMMODAL or 
    MB_ICONINFORMATION;
       MessageBoxTimeout(Application.Handle, 'Test a timeout of 2 seconds.', 
    'MessageBoxTimeout Test', iFlags, 0, 2000) ;
    
    
    // example 2
       iFlags := MB_YESNO or MB_SETFOREGROUND or MB_SYSTEMMODAL or 
    MB_ICONINFORMATION;
       iRet := MessageBoxTimeout(Application.Handle, 'Test a timeout of 5 
    seconds.', 'MessageBoxTimeout Test', iFlags, 0, 5000) ;
       case iRet of
         IDYES:
           ShowMessage('Yes') ;
         IDNO:
           ShowMessage('No') ;
         MB_TIMEDOUT:
           ShowMessage('TimedOut') ;
       end;
    end;
    ============================
    [font=Monaco, Consolas, Courier, monospace]iFlags you can set for this [/font][font=Monaco, Consolas, Courier, monospace]MB_SYSTEMMODAL or MB_SETFOREGROUND or MB_TOPMOST or MB_ICONHAND[/font]
    [font=Monaco, Consolas, Courier, monospace]In this example message after some second close automaticly.[/font]
     
  5. aikona
    Offline

    aikona DF Member

    Thanks

    I'll play around with this code .

    If the user does not take action after say 10 minutes then software will close message and just carry on as if the user said Ok


    Eric
     
  6. falcon2000
    Offline

    falcon2000 Guest

    Let i test this !
     

Share This Page

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block