Solved

OLE: Returning from server application?

Posted on 1997-10-03
9
261 Views
Last Modified: 2010-04-04
I'm using a TOleContainer in my program to add embedded objects to a database. When the user creates a new embedded object, the InsertObjectDialog box appears and opens up the appropriate server application (eg. Word). What I want to do is to save the embedded object to the database when the user returns from the application. How can I tell when the user closes down the application and returns?

I know in Visual Basic that it's OLE container has an Updated event, but Delphi does not. All Delphi has is a modified property. How do I know when to check this modified property to see if the object has changed. I want to check it after the user returns from the server application. But how?

When opening an OLE's server application your program does not stop and wait until the server has closed, it continues to run. That's why putting code to save the object to the database straight after the call to the server application does not work.
0
Comment
Question by:rocknroll
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:rocknroll
ID: 1346766
Edited text of question
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1346767
Why don't you use the modified property?

property Modified: Boolean;

Run-time only. Indicates that the OLE object has been modified (including being deleted or replaced by another OLE object). You can set Modified to False and later check it to see if the OLE object has been modified. If there is no OLE object loaded into the container, Modified returns False.
0
 

Author Comment

by:rocknroll
ID: 1346768
I think my question was misunderstood. Checking the Modified property would work, but when? The following code example will not work.

if OleContainer1.InsertObjectDialog then
begin
   OleContainer1.Modified := False;
   OleContainer1.DoVerb(ovShow);   {execute server application}
   If OleContainer1.Modified = True then
   begin
      {code to save object to database}
   end;
end;

In the above code, when the server application is executed, the IF statement following will be immediately execute, and of course it will not be true.

Is there any possible way of knowing when the user finishes modifying the object in the server application and closes it down and returns to my application. If there isn't, then the only time I can see to check the Modified property would be before my application is closed down, or when the user moves to the next record in the database. Using the Timer to check the Modified property at certain intervals would just be ridiculous.

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1346769
Use it when the ondeactivate method occurs :

property OnDeactivate: TNotifyEvent;

Why isn't it good to check after the user changed to another record?

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:rocknroll
ID: 1346770
I tried the OnDeactivate Event but that didn't work. Closing down the server application doesn't seem to generate any Event in the OleContainer.


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1346771
OnDeActivate doesn't work, strange. Well, then I really don't know how to solve this problem. Sorry. I'll go to look at it, but not at this moment I'm afraid. Don't have much time at the moment. Still, my question, why isn't it good to check after the user changed to another record?
0
 

Author Comment

by:rocknroll
ID: 1346772
When the user changes to another record (check Modified property) may be the only solution I can see at the moment. Thanks for your help anyway ZifNab.
0
 

Expert Comment

by:Tetardd
ID: 3926693
I had the same problem and I found that using the OnResize and OnObjectMove events does the job.
Whenever your object is updated/modified/inserted, these events are fired so you know when to test for Modified = True.

David.
0
 

Expert Comment

by:Tetardd
ID: 3926753
I had the same problem and I found that using the OnResize and OnObjectMove events does the job.
Whenever your object is updated/modified/inserted, these events are fired so you know when to test for Modified = True.

David.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ddeman not working in activex 3 93
proper way to parse text with delphi 7 101
Delphi XE2 application frozen on Windows 10 10 278
Machine not responding during CopyFile() 3 89
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

862 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

23 Experts available now in Live!

Get 1:1 Help Now