Solved

EASY QUESTION FOR POINTS

Posted on 2000-03-06
6
126 Views
Last Modified: 2010-04-04


Raymond/ rwilson,

On the code example you gave to me before, how can I have a window pop-up and stay on top until the other application is finished?  Then clear out and then display a message of completion?  I have tried modifing your previous example that work just fine for that purpose, but when I changed it to not use a timer I keep getting "Access Errors".  Remember that this is being used in a "DLL".  

Thanks
Tony
0
Comment
Question by:aj85
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
To do this I would make a little form showing a message (or whatever) with its form style set to fsStayOnTop.

Create and show the form before starting the process, and after the process has completed close and release it.

Perhaps you could post the code you have now with an indication where the error occurs?

Cheers,

Raymond.
0
 

Author Comment

by:aj85
Comment Utility

Raymond,

Here is the code:

Function RunMyProcess : integer;            //TJ
 var           si  : TStartupInfo;
               pi  : TProcessInformation;
               dw1 : dword;
               MergeCmd: ANSIString;
               enabled: boolean;
        begin
        enabled:=false;
        MergeCmd:= 'C:\MSSQL7\MERGE\Merge.Exe';
        ZeroMemory(@si,sizeOf(si)); si.cb:=sizeOf(si);
        si.dwFlags:=STARTF_USESHOWWINDOW; si.wShowWindow:=SW_HIDE;
     if CreateProcess(nil,PChar(MergeCmd),nil,nil,false,0,nil,nil,si,pi)
          then begin
                   with TRunThread.Create(true) do        
                   try
                 processHandle:=pi.hProcess;          
                 processReady:=false;                
                 waitingThread:=GetCurrentThreadID;
            // Error happens here....  When I try to call the form  
                 Resume;                              
           repeat
                 Application.HandleMessage;  
           until Application.Terminated or processReady;  
                                                         
     finally Free end;
          GetExitCodeProcess(pi.hProcess,dw1);
          CloseHandle(pi.hThread);
          CloseHandle(pi.hProcess);  
          begin
          if (dw1) = 0 then
          ShowTimedMessage('Merge Successful!', 5)
          else
          if (dw1) = 1 then
          ShowTimedMessage('Merge Unsuccessful! Please retry....', 5);
      //   ShowTimedMessage('Test (exitCode='+IntToStr(dw1)+')', 5);
            end;
        end;
     end;


Thanks,
Tony



0
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
Tony,

Can you post the code that you use at thsi comment:

// Error happens here....  When I try to call the form  

At least I'll be able to see what is going wrong...

Cheers,

Raymond.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:aj85
Comment Utility


Raymond,
 
I simply call a from called frmUtil.
 
Code: frmUtil.show

I then close it later after the application has terminated.

code: frmUtil.close

I know this is where the error is, I am just not sure why?

Thanks
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
Comment Utility
It sounds like frmUtil has not been created. Check it is autocreated in the project options or you are creating it before showing it with the frmUtil.show .

Cheers,

Raymond.
0
 

Author Comment

by:aj85
Comment Utility


Thanks Raymond.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now