IApplication Interface

IApplication Interface | Send Feedback
See Also Members Example

Allows access to all exposed interfaces in the DraftSight API.

# Syntax

Visual Basic |
--- | ---
    Public Interface IApplication

C# |
--- | ---
    public interface IApplication

JavaScript |
--- | ---
    Object dsApplication

COM native C++ |
--- | ---
    interface IApplication

C++ |
--- | ---
    class dsApplication

# Example

The following code snippets show how to get the IApplication object:

- COM native C++ (from the DraftSight API COM native C++ template file DsAddinConnection.h)
- C++ (from the DraftSight API C++ template file dsAddinConnection.cpp)

#### COM native C++

public:

CComQIPtr<IApplication> m_DsApp;

public:
STDMETHOD(ConnectToDraftSight)(LPDISPATCH DsApp, long Cookie, VARIANT_BOOL * IsConnected)
{
m_DsApp = DsApp;
IUnknown* dsUnk = NULL ;
HRESULT hr = DsApp->QueryInterface(IID_IUnknown, (void **) &dsUnk)
}

#### C++

myApplication *myApp = NULL;

const

dsString myApplication::appID = L"Replace_with_add-in's_GUID";

#ifdef

DS_WIN

DSADDINSAMPLE_EXPORT

bool connectToDraftSight(int cookie, dsApplication_c *dsApp)

#else

//DS_WIN

extern "C" DSADDINSAMPLE_EXPORT bool connectToDraftSight(int cookie, dsApplication_c *dsApp)

#endif

//DS_WIN

{

if ( myApp == NULL )

{

> myApp =

new myApplication(dsApp);

myApp->CreateUserInterfaceAndCommands();

return true;

}

return false;

}

Back to top

# Example

Fire Application and Document Events (C#)
Fire Application and Document Events (VB.NET)
Fire Application and Document Events (VBA)
Get and Set Document Settings (C#)
Get and Set Document Settings (VB.NET)
Get and Set Document Settings (VBA)
Get and Set Block Definitions, Block Instances, and BlockAttribute Instances (C#)
Get and Set Block Definitions, Block Instances, and BlockAttribute Instances (VB.NET)
Get and Set Block Definitions, Block Instances, and BlockAttribute Instances (VBA)
Get and Set Print Options (C#)
Get and Set Print Options (VB.NET)
Get and Set Print Options (VBA)
Switch Layouts (C#)
Switch Layouts (VB.NET)
Switch Layouts (VBA)
Insert Lines and Angular Dimension (JavaScript)
Create Circles on Different Layers (JavaScript)
Insert Block, Notes, and Sketch Entities (JavaScript)
Insert Splines (JavaScript)
Insert HyperLink (JavaScript)
Insert and Dimension Sketch (JavaScript)
Mirror Entities (JavaScript)
Add and Modify Custom Data (JavaScript)
Insert Hatch (JavaScript)
Create Model and Sheet Views (JavaScript)

# Object Model

Application

# See Also

####

IApplication Members
Interop.dsAutomation Namespace
IApplication Event ActiveDocumentChangedNotify
IApplication Event DestroyNotify
IApplication Event FileNewNotify
IApplication Event FileOpenPostNotify
IApplication Event FileOpenPreNotify