
    %
i                     z    d dl Z d dlZd dlZd dlZd dlZ G d d          ZddZd Ze	dk    r e             dS dS )	    Nc                   :    e Zd Zd Zej        ej        fdZd ZdS )ExplorerEventsc                 >    t          j        d ddd           | _        d S )Nr   )
win32eventCreateEventevent)selfs    C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32com/demos/eventsApartmentThreaded.py__init__zExplorerEvents.__init__!   s    +D!Q==


    c                     t          j                    }t          d|z             t          j        | j                   d S )Nz/OnDocumentComplete event processed on thread %dwin32apiGetCurrentThreadIdprintr   SetEventr   )r	   pDispURLthreads       r
   OnDocumentCompletez!ExplorerEvents.OnDocumentComplete$   s=    ,..?&HIIIDJ'''''r   c                     t          j                    }t          d|z             t          j        | j                   d S )Nz#OnQuit event processed on thread %dr   )r	   r   s     r
   OnQuitzExplorerEvents.OnQuit*   s=    ,..3f<===DJ'''''r   N)__name__
__module____qualname__r   	pythoncomEmptyr   r    r   r
   r   r       sQ        > > > (1IO ( ( ( (( ( ( ( (r   r      c                     t          j                    }	 t          j        | fddt          j                  }|t          j        k    rdS t          j                    |z
  |k    rdS t          j                     d)NTr      F)timeperf_counterr   MsgWaitForMultipleObjectsQS_ALLEVENTSWAIT_OBJECT_0r   PumpWaitingMessages)r   timeoutstartrcs       r
   WaitWhileProcessingMessagesr+   0   s~    E( 1Haj5
 
 )))4%'7225%'''(r   c                  
   t           j                            dt                    } t	          j                    }t          d|z             d| _        	 |                     t	          j	        d                     n,# t          j        $ r}t          d|           Y d }~nd }~ww xY wt          | j                  st          d           |                                  t          | j                  st          d           d } d S )NzInternetExplorer.Applicationz1TestExplorerEvents created IE object on thread %d   z..\readme.htmlz+Warning - could not open the test HTML filez%Document load event FAILED to fire!!!zOnQuit event FAILED to fire!!!)win32comclientDispatchWithEventsr   r   r   r   VisibleNavigateGetFullPathNamer   	com_errorr+   r   Quit)iexplorer   detailss      r
   TestExplorerEventsr8   C   s   11& H (**F	
=
FGGGHF(23DEEFFFF F F F;WEEEEEEEEF 'x~66 75666MMOOO 'x~66 0.///HHHs   'A; ;B$
BB$__main__)r   )
r"   r   r   win32com.clientr.   r   r   r+   r8   r   r   r   r
   <module>r;      s   .              ( ( ( ( ( ( ( ( ( ( ( (&  < z r   