Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
These OLE automation samples show you how to use OLE automation and any language
that supports COM to work
with PowerDesigner from outside of PowerDesigner.
You can use, modify, publish or redistribute them without any restriction.
OLE Automation is similar to VBScript. It also uses COM to create, modify and read
objects.
But OLE automation allows you to use any language that supports COM (VBScript, VB,
C#, VB. NET, C++, PowerBuilder,
JavaScript, ...) to work with PowerDesigner objects from outside of PowerDesigner.
To use OLE automation, the PowerDesigner Application object should be registered.
The main differences between using OLE automation and VBScript inside PowerDesigner
are:
- Create a PowerDesigner application object first.
- Prefix all the global properties and methods by the PowerDesigner application
object.
- In VB and VBA programs, use typed variables (Dim model as PdPDM.Model instead of
Dim model).
- In VB and VBA programs, if a function returns an object, the return type of the
function should be declared.
- In VB, VBA, VB .NET and C#, you have to add references for the type libraries you
want to use (PdCommon, PdPDM, ...).
- In VBA forms (Word, Excel, ...), the event handlers of a form should be named
UserForm_<EventName>.
- In some languages, the syntax for class type constant is different.
- Release the PowerDesigner application object before exiting the program.
In some cases, you may need to unregister and register manually (for exemple to
have two versions of PowerDesigner working on the same computer).
3) VBA Samples
==============
Folder: VBA Samples
Files:
* CreateOOM.bas This sample shows how to use VBA to create an
OOM model from outside of PowerDesigner.
* Excel ListColumns This sample shows how to use an Excel macro and
form to allow users to
select a PDM, table and column criteria to create a
customized list of columns
spreadsheet in Microsoft Excel.
* Word ListColumns This sample shows how to use a Word macro and
form to allow users to
select a PDM, table and column criteria to create a
customized list of columns
table in Microsoft Word.
Notes:
The VBA samples work with Microsoft Visual Basic or in an VBA editor (Word macro,
Excel macro, ...).
Files:
* ListClassesVBScript.htm This sample shows how to use VB Script in a
HTML page to invoke PowerDesigner functions.
This program displays classes properties defined in
the active OOM model in the PowerDesigner
output window.
Notes:
To test these HTML files, you can double click on the file.
Subfolders:
* Sample1 This samples shows how to use a VB program to
create a new OOM and display OOM properties.
6) VB .NET Samples
==================
Folder: VB DOTNET Samples
Subfolders:
* Sample1 This sample shows how to use VB .NET to create
a new OOM.
Notes:
To run this program, you can use the compiled .EXE file.
To modify the program or to debug, you need to use Microsoft Visual Studio .NET.
7) C# Samples
=============
Folder: CSharp Samples
Subfolders:
* Sample1 This sample shows how to use C# to create a new
PDM.
Notes:
To run this program, you can use the compiled .EXE file.
To modify the program or to debug, you need to use Microsoft Visual Studio .NET.
8) C++ Samples
==============
Folder: C++ Samples
Subfolders:
* VC++ ListClasses This program allows you to select an OOM model,
display list of classes and create new classes.
Notes:
To compile these programs, you need to use Microsoft Visual Studio.
9) Java Samples
===============
Folder: Java Samples
Subfolders:
* Create OOM This program allows you to create an OOM model
using Java.
Notes:
To compile the program, you need to use Eclipse.
File:
* PBSample1.sru This sample shows how to use PowerBuilder to
create a new OOM.
Notes:
To run this program, you need to copy/paste the code into a PowerBuilder function.