How to make a dialog box for a userFunction?

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

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

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    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; }