Initial Commit of the PDM project (ready for DWS migration)
This commit is contained in:
181
documentation/api_extracted/vbreactor.htm
Normal file
181
documentation/api_extracted/vbreactor.htm
Normal file
@@ -0,0 +1,181 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Creating Add-in Hooks (VB.NET)</title>
|
||||
<meta name=MS-HKWD content="Hooks">
|
||||
<meta name=MS-HKWD content="Add-ins, hooks">
|
||||
<meta name=MS-HKWD content="VB.NET, add-ins">
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
|
||||
<style>
|
||||
<!--
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
.auto-style3 {
|
||||
color: #2B91AF;
|
||||
font-size: x-small;
|
||||
}
|
||||
.auto-style1 {
|
||||
font-size: x-small;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><span style="font-weight: normal; font-size: 7.5pt;">SOLIDWORKS PDM Professional API Help</span></h1>
|
||||
<h1>Creating Add-in Hooks (VB.NET)</h1>
|
||||
<div class=Section1>
|
||||
|
||||
<p><span lang=EN-US style='font-family:Verdana'>This
|
||||
topic shows how to implement
|
||||
<a href="EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmAddIn5~GetAddInInfo.html"> IEdmAddIn5::GetAddInInfo</a>
|
||||
and <a href="EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmAddIn5~OnCmd.html"> IEdmAddIn5::OnCmd</a>
|
||||
in your add-in to have SOLIDWORKS PDM Professional notify your add-in
|
||||
whenever a file is added, checked out, or checked in.<br>
|
||||
<br>
|
||||
</span><span lang="en-us"><b><span style="font-family: Verdana">NOTE: </span></b></span>
|
||||
<span lang=EN-US style='font-family:Verdana;
|
||||
mso-ansi-language:EN-US'>Because SOLIDWORKS PDM Professional cannot force a reload of
|
||||
add-ins if they are written in .NET, all client machines must be restarted to ensure that the latest version of the add-in is used.<o:p></o:p></span><span lang=EN-US><font face="Verdana"> </font> </span>
|
||||
<span lang=EN-US style='font-family:Verdana'> </span></p>
|
||||
|
||||
<ol>
|
||||
<li class="kadov-P"><span style="font-family: Verdana">C</span><span lang=EN-US style='font-family:Verdana'>all
|
||||
<a href="EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmCmdMgr5~AddHook.html">IEdmCmdMgr5::AddHook</a>
|
||||
</span><span lang=EN-US style='font-family:Verdana'>from your add-in's GetAddInInfo
|
||||
method
|
||||
for each activity you want your add-in to know about. Implement IEdmAddIn5::GetAddInInfo
|
||||
in your add-in as follows:</span></li>
|
||||
|
||||
<blockquote>
|
||||
<p class=MsoNormal>
|
||||
<span style="font-size: 10pt; font-family: Courier New" lang="EN-US">Public Sub
|
||||
GetAddInInfo(ByRef poInfo As EdmAddInInfo, ByVal poVault As IEdmVault5,
|
||||
ByVal poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo<br />
|
||||
<br /><span style="color: #009900"> </span></span><span class="GramE">
|
||||
<font size="2" color="#008000"><span style="font-family: Courier New">'</span></font></span><span style="font-size: 10pt; font-family: Courier New" lang="EN-US"><font color="#008000"><span class="GramE">Specify
|
||||
add-in information</span></font><span style="color: #009900"><br /></span>
|
||||
poInfo.mbsAddInName = "My first add-in"<br />
|
||||
poInfo.mbsCompany = "The name of my company"</span></p>
|
||||
<p class="MsoNormal">
|
||||
<span style="font-size: 10pt; font-family: Courier New" lang="EN-US">
|
||||
poInfo.mbsDescription = "This is a very nice add-in."<br />
|
||||
poInfo.mlAddInVersion = 1<br>
|
||||
<br>
|
||||
</span><span class="GramE"><font size="2" color="#008000">
|
||||
<span style="font-family: Courier New">'</span></font></span><SPAN class=SpellE><SPAN class=GramE><SPAN lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New; mso-ansi-language:EN-US"><font color=green>Specify
|
||||
minimum version of SOLIDWORKS PDM Professional</font></SPAN></SPAN></SPAN><span style="font-size: 10pt; font-family: Courier New" lang="EN-US"><br />
|
||||
poInfo.mlRequiredVersionMajor = 5<br />
|
||||
poInfo.mlRequiredVersionMinor = 2<br /></span></p>
|
||||
<p class="MsoNormal">
|
||||
<span style="font-size: 10pt; font-family: Courier New" lang="EN-US">
|
||||
</span><span lang="EN-US">
|
||||
<span style="font-size: 10pt; font-family: Courier New">
|
||||
<span style="color: #009900">'Notify when a file has been added<br />
|
||||
</span> poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostAdd)<br /><br />
|
||||
<span style="color: #009900">'Notify when a file has been checked out<br />
|
||||
</span> poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostLock)<br /><br />
|
||||
<span style="color: #009900">'Notify when a file is about to be checked in<br />
|
||||
</span> poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreUnlock)<br /><br />
|
||||
<span style="color: #009900"> 'Notify when a file has been checked in<br />
|
||||
</span> poCmdMgr.AddHook(EdmCmdType.EdmCmd_PostUnlock)<br /><br />End Sub</span>
|
||||
</span></p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<li class="kadov-P">
|
||||
<p style='background:white'><span style="font-family: Verdana">Implement
|
||||
IEdmAddIn5::</span><span lang=EN-US style='font-family:Verdana'>OnCmd in
|
||||
your add-in as follows:</span></p></li>
|
||||
|
||||
<blockquote>
|
||||
<p style='background:white'>
|
||||
<span lang=EN-US style="font-size:10pt;font-family:Courier New">Public Sub OnCmd(ByRef
|
||||
poCmd As EdmCmd, </span>
|
||||
<span lang=EN-US style="font-family:Courier New">
|
||||
<span style="color:blue;" class="auto-style1">ByRef</span></span><span lang=EN-US style="font-size:10pt;font-family:Courier New"><span lang=EN-US style="font-family:Courier New" class="auto-style1"> ppoData <span style="color:blue;">As</span></span><font size="1"> <span class="auto-style3">EdmCmdData</span><span class="auto-style1">[]</span></font>) Implements IEdmAddIn5.OnCmd<br />
|
||||
<br /> <span style="color: #009900">'Check the type of hook that
|
||||
triggered this call<br />
|
||||
</span> Dim name As String<br />
|
||||
Select Case poCmd.meCmdType<br /> Case EdmCmdType.EdmCmd_PostAdd <br /> name = "PostAdd"<br /> Case EdmCmdType.EdmCmd_PostLock <br /> name = "PostLock"<br /> Case EdmCmdType.EdmCmd_PreUnlock <br /> name = "PreUnlock"<br /> Case EdmCmdType.EdmCmd_PostUnlock <br /> name = "PostUnlock"<br /> Case Else <br /> name = "?"<br /> End Select<br />
|
||||
<br /> <span style="color: #009900"> 'Check the upper and lower bounds
|
||||
of the array<br />
|
||||
</span> Dim message As String<br /> message = ""<br /> Dim index As Long<br />
|
||||
index = LBound(ppoData)<br /> Dim last As Long<br />
|
||||
last = UBound(ppoData)<br /><br /> <span style="color: #009900"> </span></span>
|
||||
<span class="SpellE"><span style="background-position: 0 0">
|
||||
<font size="2" color="#008000"><span style="font-family: Courier New">'</span></font></span><SPAN lang=EN-US
|
||||
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US"><o:p><font color=green>Append the paths of all files to a string</font></o:p></SPAN></span><span lang=EN-US style="font-size:10pt;font-family:Courier New"><br /> While index <= last<br /> message = message + ppoData(index).mbsStrData1 + vbLf<br /> index = index + 1<br /> End While<br />
|
||||
<br /> <span style="color: #009900">'Display a message to the user<br />
|
||||
</span>
|
||||
message = "The following files were affected by a " + name + "
|
||||
hook:" + vbLf + message<br /><br />
|
||||
Dim vault As EdmVault5<br /> vault = poCmd.mpoVault<br /> vault.MsgBox(poCmd.mlParentWnd, message)<br />
|
||||
<br />End Sub</span></p>
|
||||
</blockquote>
|
||||
|
||||
<p style='background:white'><span lang=EN-US style='font-family:Verdana'>OnCmd
|
||||
is called for each of the
|
||||
hooks registered in GetAddInInfo. You can tell which hook triggered the call to
|
||||
OnCmd by
|
||||
inspecting the meCmdType
|
||||
member of the <a href="EPDM.Interop.epdm~EPDM.Interop.epdm.EdmCmd.html">EdmCmd</a> structure
|
||||
that is passed as poCmd in OnCmd. meCmdType contains an EdmCmdType constant
|
||||
that indicates the triggering hook.<o:p></o:p></span></p>
|
||||
|
||||
<p style='background:white'><span lang=EN-US style='font-family:Verdana'>The second argument to OnCmd
|
||||
is an array of <a href="EPDM.Interop.epdm~EPDM.Interop.epdm.EdmCmdData.html">EdmCmdData</a> structures. There is
|
||||
one element in the array for each file that is affected by the call. The
|
||||
contents of the structure members vary depending on the type of hook that
|
||||
is executed. See EdmCmdData for a complete list
|
||||
of members and their descriptions.<o:p></o:p></span></p>
|
||||
|
||||
|
||||
<li class="kadov-P">
|
||||
<p class=MsoNormal style='line-height:11.3pt'>
|
||||
<span lang=EN-US style='mso-ansi-language:EN-US'>Click <b>Build > Build
|
||||
Solution</b> to build the add-in.</span></p></li>
|
||||
<li class="kadov-P"><span lang="en-us">I</span><span lang=EN-US style='mso-ansi-language:EN-US'>nstall
|
||||
the add-in through the SOLIDWORKS PDM Professional
|
||||
Administration tool: <br> </span><ol style="font-family: Verdana; font-size: 8pt">
|
||||
<li><span lang="en-us">Open</span><span lang=EN-US style='mso-ansi-language:EN-US'> the SOLIDWORKS
|
||||
PDM Professional Administration tool.<br> </span></li>
|
||||
<li><span lang=EN-US style='mso-ansi-language:EN-US'>Expand the vault where
|
||||
you want to install this add-in and log in as Admin.<br> </span></li>
|
||||
<li><span lang="en-us">Right-click <b>Add-ins</b> and click <b>New
|
||||
Add-in</b>.<b><br> </b></span></li>
|
||||
<li>B<span lang="en-us">rowse to </span>
|
||||
<span lang=EN-US style='mso-ansi-language:EN-US'>
|
||||
<i style='mso-bidi-font-style:
|
||||
normal'>project_path</i><span style='mso-bidi-font-style:
|
||||
normal; '><i>\</i></span></span><span style='mso-bidi-font-style:
|
||||
normal; mso-ansi-language:EN-US' lang="EN-US"><i>project_name\project_name</i><b>\bin\Debug</b>,
|
||||
click <i>project_name</i><b>.dll</b> and <b>EPDM.Interop.epdm.dll</b>.<br> </span></li>
|
||||
<li><span lang="en-us">Click <b>Open</b>.<br> </span></li>
|
||||
<li>Click <b>OK</b>.<br> </li>
|
||||
<li>Click <b>OK</b>.</li>
|
||||
</ol></li>
|
||||
<li class="kadov-P">
|
||||
<p class=MsoNormal style='background:white'>
|
||||
<span style="background-position: 0 0"><font face="Verdana">T</font></span><span lang=EN-US><font face="Verdana">ry adding, checking out, and checking in
|
||||
vault files.</font><o:p></o:p></span></p></li>
|
||||
</ol>
|
||||
|
||||
<p class=MsoNormal style='background:white'><strong>
|
||||
<span lang=EN-US
|
||||
style='font-family:Verdana'>NOTE: </span></strong>
|
||||
<span
|
||||
lang=EN-US style='font-family:Verdana'>OnCmd is not called during check-in if the
|
||||
file is not modified before it is checked in. During check-in of unmodified
|
||||
files, SOLIDWORKS PDM Professional triggers an "undo check-out" event. To handle
|
||||
this "undo check-out" event, add hooks for <a href="EPDM.Interop.epdm~EPDM.Interop.epdm.EdmCmdType.html"> EdmCmdType.EdmCmd_PreUndoLock</a> and
|
||||
<a href="EPDM.Interop.epdm~EPDM.Interop.epdm.EdmCmdType.html">EdmCmdType.EdmCmd_PostUndoLock</a>
|
||||
to your add-in's GetAddInInfo.</span></p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user