NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read properties of custom controls?

   I added a checkbox to a custom operator interface. Since the "Break/Resume" and "TERM/RESTART" buttons are activex, I also made my checkbox an activex checkbox. I'm using CVI for my code. How can I read the status of the checkbox during execution? I'm guessing I need to use a TS_PropertyGetVal call of some sort, but don't know what I would enter as my third parameter.
0 Kudos
Message 1 of 13
(4,660 Views)

Steve,

I'm assuming you're using a TestStand activeX checkbox. If so, you can use GetObjHandleFromActiveXCtrl to get a handle to it and then use TSUI_CheckBoxGetChecked to get its value. If you're using a Microsoft control, then you can use MSForms_IMdcCheckBoxGetValue and then use CA_VariantGetBool to retrieve the value.

Regards,

Song Du
Systems Software
National Instruments R&D
0 Kudos
Message 2 of 13
(4,634 Views)
GetObjHandleFromActiveXCtrl requires "Panel Handle" and "Control Id" as inputs. How do I obtain these parameters?
0 Kudos
Message 3 of 13
(4,620 Views)
Panel Handle is the result of LoadPanel(). Control ID is defined in the .h file. It's usually in the format of PanelName_ControlName. You can find the Panel name by double-clicking any empty space on the panel. To find a control name, you can double click it.
Regards,

Song Du
Systems Software
National Instruments R&D
0 Kudos
Message 4 of 13
(4,613 Views)
But the .h file is part of the project for the operator interface and not the project that generates the dll for the operator interface to call. How can I pass this information to the project that generates the dll?
0 Kudos
Message 5 of 13
(4,573 Views)
Steve,
 
Could you clarify on what you mean by "the project that generates the dll"? What dll are you referring to? Also, could you explain in general what this checkbox is suppose to do? Mainly, who needs to access the value? Your actual sequence or the TestStand engine.
 
Song D


Message Edited by Song D on 12-17-2007 12:28 PM
Regards,

Song Du
Systems Software
National Instruments R&D
0 Kudos
Message 6 of 13
(4,566 Views)
There are two cvi projects. One for the Teststand Operator interface and another for the dll that the operator interface calls. Is there a way to pass the panel information between the two?
0 Kudos
Message 7 of 13
(4,555 Views)
Hi Steve,
 
when all your stuff is running, and you klick into the Taskmanager you will see two Processes one is your Operator interface and the other is Teststand itsself (TSAutoMrg.exe) That means you have to to do Interprocess Communication.
 
There are many ways to do that.
 
I show you two ways:
 
1.) There a  UIMessage in Teststand itself  to send Data to the Operator interface. So Refer to Teststand Help
 
2.) Use shared named Variables from your operating system.
     (I have used this to place  panels(CVI) from StepDLLs  into the Operatorinface(C++/MFC) as Child Window)
 
Greetings from the lake of Constance, Germany
 
juergen
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 8 of 13
(4,525 Views)
Do you have any examples for either method? If I could pass a simple string back and forth I might be able to do what I need to. I don't know if this is the best way. Ideally, I would like to be able to pass the string back and forth in a manner that the dll can be generated from either CVI or .net. Thanks.
0 Kudos
Message 9 of 13
(4,511 Views)

Hi Steve,

Here are some codesnippets how to do share named Memory in C++ using SDK (Copied from serval files not tested !)

1.) create Memory, in my case placed in Operator interface
Note: NOT synronized and NO ErrorManagement and "Pointer-Freeing" 

    HANDLE m_hFileMapping;      // memory mapped file
    LPVOID m_pViewOfFile;       // view of file, contains text in edit box
    DWORD dwMemoryFileSize = 64;// number of characters in memory-mapped file
    LPCTSTR sMemoryFileName = _T("MY_NAMED_VARIABLE"); // memory-mapped file name  Hint: Best is to use a UUID here !!!
 

// Create file mapping which can contain dwMemoryFileSize characters
    m_hFileMapping = CreateFileMapping(
        INVALID_HANDLE_VALUE,           // system paging file
        NULL,                           // security attributes
        PAGE_READWRITE,                 // protection
        0,                              // high-order DWORD of size
        dwMemoryFileSize*sizeof(TCHAR), // low-order DWORD of size
        sMemoryFileName);               // name

     m_pViewOfFile = MapViewOfFile(
            m_hFileMapping,             // handle to file-mapping object
            FILE_MAP_ALL_ACCESS,        // desired access
            0,
            0,
            0);                         // map all file

    char lpcstrName[11];
    strcpy(lpcstrName,"Hallo Welt");
    memcpy(m_pViewOfFile, lpcstrName ,11); // write Data to memory-mapped file

2. Consuming the Named Memory , my in your Step DLL

    HANDLE m_hFileMapping;      // memory mapped file
    LPVOID m_pViewOfFile;       // view of file, contains text in edit box
    DWORD dwMemoryFileSize = 64;// number of characters in memory-mapped file
    LPCTSTR sMemoryFileName = _T("MY_NAMED_VARIABLE"); // memory-mapped file name  Hint: Best is to use a UUID here !!!

 m_hFileMapping = OpenFileMapping(FILE_MAP_ALL_ACCESS,
  FALSE,                            
  sMemoryFileName);            
 
   m_pViewOfFile = MapViewOfFile(m_hFileMapping, // Handle to mapping object.
   FILE_MAP_ALL_ACCESS,                  // Read/write permission.
   0,                                    // Max. object size.
   0,                                    // Size of hFile.
   0);                                   // Map entire file. 
 
   // Consuming the Memory
   char lpcstrName[11];
   memcpy(lpcstrName,m_pViewOfFile, 11);

Hope this help greetings

Juergen




Message Edited by j_dodek on 12-21-2007 01:20 AM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 10 of 13
(4,500 Views)