🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to make a dialog box for a userFunction?

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Submitted by Joe on Sat, 09/29/2012 - 10:12 

Hi,

I've been using Microsoft Visual C++ 2010 to create .dlls to link to userfunction blocks in VisSim Embedded Controls Developer very successfully.

When I right click on the userFunction block I can have a menu come up for parameter entry.

Can you please tell me if it is possible to have a file chooser pop up when I right click on the block so that I can load a .txt file to set variables in the .dll?

Thanks very much, Joe

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Submitted by Anders89 on Sat, 09/29/2012 - 10:18.

    Hi Joe, You can put up any dialog box you like in response to a right mouse click. Just create a function that has your core function name with 'PC' appended. VisSim will call it when the user clicks the right mouse on your block. Here is some sample code for 'myBlock':

     #include 'myBlockDlg.h' // MyBlockDlg dialog created using MFC /* Parameter Change function */ EXPORT32 LPSTR EXPORT PASCAL myBlockPC(MYBLOCK_INFO *pi, long *runCount) {   AFX_MANAGE_STATE( AfxGetStaticModuleState() );   CMyBlockDlg  dlg;   dlg.m_serialPort = pi->port;   dlg.m_readKind = pi->readKind;   if (dlg.DoModal() == IDCANCEL)     return 0;   pi->port = dlg.m_serialPort;   pi->readKind = dlg.m_readKind;   return 0; }