기본 콘텐츠로 건너뛰기

SmartSketch Application 구하기

C# 프로젝트에서 SmartSketch.tlb 파일을 참조합니다.
= 샘플 코드 =
const string progID = "SmartSketch.Application";
private void GetSmartSketchApp()
{
    try
    {
        mApp = (SmartSketch.Application)Marshal.GetActiveObject(progID);
        mApp.Visible = true;
    }
    catch
    {
        try
        {
            Type acType = Type.GetTypeFromProgID(progID);
            mApp = (SmartSketch.Application)Activator.CreateInstance(acType, true);
            mApp.Visible = true;
        }
        catch
        {
            MessageBox.Show(
              "Cannot create object of type \"" +
              progID + "\""
            );
        }
    }
}

댓글