Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic System Architect (steve huntington)
Decrease font size
Increase font size
Topic Title: auto open SA via VB6.0
Topic Summary:
Created On: 25-Sep-2008 03:40
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Arif Hussain, on Monday, October 20, 2008 8:10 AM

Answer:
Try following as your starting point:


Public Const MAX_CONNECT_STRING = 1024

Sub StartSA()

Dim SA_App As Object
Dim EncyPath As String
Dim EncyName
Dim SAStartupPath As String
Dim iStart As Long, iEnd As Long, iLen As Long
Dim ErrMsg As String
Dim UserResponse As Long

' Connect to a running version of System Architect
RetryLoop:
On Error GoTo OfferToRetry
Set SA_App = CreateObject("SA2001.Application")
Set SA_IMF = SA_App.Interface("ISAImf")
Set sa_Ency = SA_App.Encyclopedia
If sa_Ency Is Nothing Then
GoTo OfferToRetry
End If
sa_Ency.OpenObjectsAsReadOnly = True 'need this in case another network user has somthing locked
On Error GoTo 0

EncyPath = String(MAX_CONNECT_STRING, " ")
SA_IMF.SAGetEncyName EncyPath, MAX_CONNECT_STRING
iStart = InStr(1, EncyPath, "(") + 1
iEnd = InStr(1, EncyPath, ")") - 1
iLen = iEnd - iStart + 1
EncyName = Mid(EncyPath, iStart, iLen)

Debug.Print EncyPath
Debug.Print EncyName

GoTo MainExit

OfferToRetry:
'Look in MS Word or it may appear that you are stuck
UserResponse = MsgBox("This report cannot run now. It must wait until System Architect has opened an encyclopedia.", vbInformation Or vbRetryCancel)
If UserResponse = vbRetry Then
GoTo RetryLoop
End If

MainExit:
Set dgmcollection = Nothing
Set sa_Ency = Nothing
Set SA_App = Nothing
Exit Sub

ErrorTrap:

End Sub
 25-Sep-2008 03:40
User is offline View Users Profile Print this message


chunjia wang

Posts: 39
Joined: 11-Oct-2007

hi,all.
I want to open SA via VB6.0.
I also want to judge that the user already selected the exist Encyclopedia.
I write some test code , it only open SA , but I there is no Encyclopedia box .
I want user select the Encyclopedia,and my program read the Encyclopedia's information.

The exist code is:
Report this to a Moderator Report this to a Moderator
 3-Oct-2008 11:34
User is offline View Users Profile Print this message


Arif Hussain

Posts: 53
Joined: 22-Dec-2005

Answer Answer
Try following as your starting point:


Public Const MAX_CONNECT_STRING = 1024

Sub StartSA()

Dim SA_App As Object
Dim EncyPath As String
Dim EncyName
Dim SAStartupPath As String
Dim iStart As Long, iEnd As Long, iLen As Long
Dim ErrMsg As String
Dim UserResponse As Long

' Connect to a running version of System Architect
RetryLoop:
On Error GoTo OfferToRetry
Set SA_App = CreateObject("SA2001.Application")
Set SA_IMF = SA_App.Interface("ISAImf")
Set sa_Ency = SA_App.Encyclopedia
If sa_Ency Is Nothing Then
GoTo OfferToRetry
End If
sa_Ency.OpenObjectsAsReadOnly = True 'need this in case another network user has somthing locked
On Error GoTo 0

EncyPath = String(MAX_CONNECT_STRING, " ")
SA_IMF.SAGetEncyName EncyPath, MAX_CONNECT_STRING
iStart = InStr(1, EncyPath, "(") + 1
iEnd = InStr(1, EncyPath, ")") - 1
iLen = iEnd - iStart + 1
EncyName = Mid(EncyPath, iStart, iLen)

Debug.Print EncyPath
Debug.Print EncyName

GoTo MainExit

OfferToRetry:
'Look in MS Word or it may appear that you are stuck
UserResponse = MsgBox("This report cannot run now. It must wait until System Architect has opened an encyclopedia.", vbInformation Or vbRetryCancel)
If UserResponse = vbRetry Then
GoTo RetryLoop
End If

MainExit:
Set dgmcollection = Nothing
Set sa_Ency = Nothing
Set SA_App = Nothing
Exit Sub

ErrorTrap:

End Sub
Report this to a Moderator Report this to a Moderator
 20-Oct-2008 08:16
User is offline View Users Profile Print this message


chunjia wang

Posts: 39
Joined: 11-Oct-2007

thanks,above.
Now ,I can open SA via VB6.0,but I also want to minimum and lock the SA like "SA Publisher".
The means that user can also use VB Program ,and the SA is lock.
How should I do. thanks.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic System Architect forum.
There are currently 1 users logged in.
The most users ever online was 16 on 30-Oct-2008 at 14:46.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.