Suppose you want to add a button to your VB application that refreshes the Pro/E screen. The first thing you do is make a simple Windows DLL project that has 3 files.
pack.def LIBRARY packEXPORTS Connect2Pro @1 Repaint @2 pack.h#include <windows.h>int __declspec(dllexport) Connect2Pro();int __declspec(dllexport) Repaint(); pack.cppint Connect2Pro(){ ProProcessHandle proe_handle; ProError err; ProBoolean random; err = ProEngineerConnect("",NULL,NULL,"",PRO_B_TRUE, 100, &random, &proe_handle); if(err != PRO_TK_NO_ERROR){ return -1; } } return 0;}int Repaint(){ ProWindowRepaint(PRO_VALUE_UNUSED); return 1;} Then add to your VB project these files.
pack.vb Public Class ptk Declare Auto Function Connect2Pro Lib ".\pack.dll" () As Integer Declare Auto Function Repaint Lib ".\pack.dll" () As IntegerEnd Class MainForm.vb...Private Sub ConnectToProE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ConnectToProE.Click Dim res As Integer res = ptk.Connect2Pro() If res = 0 Then MsgBox("Connection to ProE established.") Else MsgBox("Failed to connect to ProE.") End IfEnd SubPrivate Sub Reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset.Click ptk.Repaint()End SubThe last two functions are the part of the Main class. Note that I am using VS .NET.