OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > Corel Photo-Paint VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-12-2003, 08:37
mapcar
Guest
 
Posts: n/a
Default ThisDocument Events

Hi there,

I have to trace all Docs opened, created and closed. I've seen other applications have a lot of events handled by ThisDocument, but PP11 only has four of them. GlobalDocument_Open(new)Document works fine, but what about CloseDocument? That's the most important, but can't find it...

Is it possible to add events or something like that? What can I do? Please answer 'idiot proof', i'm not really familiar with VBA.

Thanks, Axel
Reply With Quote
  #2  
Old 16-08-2009, 15:23
Aquila
Guest
 
Posts: n/a
Default ThisDocument events - detect document closed

Below is a somewhat stupid way to check for closure, but it does work just so long as you opened the events with file / open.

I think there are other ways too, but I have to play with it.

-----------------------------------------------


Private m_tStr As String

Private Sub GlobalDocument_OpenDocument(ByVal Document As IPaintDocument)
Dim ppDoc As PHOTOPAINT.Document
Set ppDoc = Document
CheckClose ppDoc
End Sub

Public Function CheckClose(ppDoc As PHOTOPAINT.Document)
While True
DoEventPause 2
If Not IsDocOpen(ppDoc) Then
GoTo JumpOut
End If
Wend
JumpOut:
MsgBox "closed"
End Function

Public Function IsDocOpen(ppDoc As PHOTOPAINT.Document) As Boolean
IsDocOpen = False
On Error GoTo JumpError
m_tStr = ppDoc.Name
IsDocOpen = True
Exit Function
JumpError:
End Function

Public Function DoEventPause(Seconds As Integer)
Dim tStart As Date
Dim tNow As Date
Dim i As Integer
Dim j As Long
j = 1
tStart = Now
While True
For i = 1 To 6000
DoEvents
Next i
j = j + 1
tNow = Now
If Second(tNow - tStart) >= Seconds Then
Exit Function
End If
Wend
End Function
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Are there Other Events in CorelDraw? Jon Lorber CorelDRAW/Corel DESIGNER VBA 2 10-08-2005 10:17
Corel Photo Paint 11 Document Events problem cyrilgupta Corel Photo-Paint VBA 1 07-11-2004 13:51
How to use events from CorelDRAW.Document in my code? me CorelDRAW/Corel DESIGNER VBA 2 30-10-2004 03:49
Have a major problem with events ,commands changing pls help ayo CorelDRAW/Corel DESIGNER VBA 2 20-04-2004 15:53


All times are GMT -5. The time now is 07:34.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com