Solid Edge Framework Type Library
ApplicationWindowEvents Property
Solid Edge Framework Type Library > Application Object : ApplicationWindowEvents Property
Description
Returns the ApplicationWindowEvents object for the referenced Application object.
Property type
Read-only property
Syntax
Visual Basic
Public Property ApplicationWindowEvents As ApplicationWindowEvents
Example
Imports System
Imports System.Runtime.InteropServices
Imports System.Windows.Forms

Namespace Examples
    Partial Public Class Form1
        Inherits Form

        Private _application As SolidEdgeFramework.Application
        Private _applicationWindowEvents As SolidEdgeFramework.ISEApplicationWindowEvents_Event

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            ' Connect to a running instance of Solid Edge.
            _application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

            ' Connect to events using delegate event model.
            _applicationWindowEvents = CType(_application.ApplicationWindowEvents, SolidEdgeFramework.ISEApplicationWindowEvents_Event)

            ' Attach to specific events.
            AddHandler _applicationWindowEvents.WindowProc, AddressOf _applicationWindowEvents_WindowProc
        End Sub

        Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
            If _applicationWindowEvents IsNot Nothing Then
                ' Dettach from specific events.
                RemoveHandler _applicationWindowEvents.WindowProc, AddressOf _applicationWindowEvents_WindowProc
            End If

            _applicationWindowEvents = Nothing
            _application = Nothing
        End Sub

        Private Sub _applicationWindowEvents_WindowProc(ByVal hWnd As Integer, ByVal nMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer)
            ' Handle WindowProc.
        End Sub
    End Class
End Namespace
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Examples
{
    public partial class Form1 : Form
    {
        private SolidEdgeFramework.Application _application;
        private SolidEdgeFramework.ISEApplicationWindowEvents_Event _applicationWindowEvents;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Connect to a running instance of Solid Edge.
            _application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

            // Connect to events using delegate event model.
            _applicationWindowEvents = (SolidEdgeFramework.ISEApplicationWindowEvents_Event)_application.ApplicationWindowEvents;

            // Attach to specific events.
            _applicationWindowEvents.WindowProc += _applicationWindowEvents_WindowProc;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_applicationWindowEvents != null)
            {
                // Dettach from specific events.
                _applicationWindowEvents.WindowProc -= _applicationWindowEvents_WindowProc;
            }

            _applicationWindowEvents = null;
            _application = null;
        }

        private void _applicationWindowEvents_WindowProc(int hWnd, int nMsg, int wParam, int lParam)
        {
            // Handle WindowProc.
        }
    }
}
See Also

Application Object  | Application Members