Multipanel and/or Multiple GUI DLL

Hello,
I am in the process of writing an application that will use some CVI GUI DLL's   The thought is each DLL is associated with an instrument and will have an instrument specific user interface that can be accessed through an exported function (RUNUI).   The inital problem I ran into was that each RUNUI function would call RunUserInterface() and each DLL had a callback with a QuitUserInterface() which resulted in strange behavoir ( the calling application was also written in CVI)  After searching the forums i realized that I should be running each DLL's user interfaces in seperate threads each with it's own RunUserInterface() and QuitUserInterface() so i had modified my code according to what I thought would be the correct solution:
Each DLL has the following three functions along with some exported functions like init read and close and other associted callbacks for the GUI:
int __stdcall Photo1980A_RunUI (void)
     int threadFunctionId1 = 0;
    CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, ThreadFunctionPhoto, NULL,  &threadFunctionId1);
    CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, threadFunctionId1, OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
    CmtReleaseThreadPoolFunctionID (DEFAULT_THREAD_POOL_HANDLE, threadFunctionId1);
        return 1;  
static int CVICALLBACK ThreadFunctionPhoto (void *functionData)
    int DLLpanel;
    if ((DLLpanel = LoadPanelEx (0, "1980APhotomGUI.uir", PANEL1980A, __CVIUserHInst)) < 0) return 0;
    SetPanelPos (DLLpanel, 200, 200);
    DisplayPanel (DLLpanel);
    SetSleepPolicy (VAL_SLEEP_MORE);
    RunUserInterface ();
     /* Free resources for the UI and return success */
    DiscardPanel (DLLpanel);
    return 1;
int CVICALLBACK quitCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    switch (event)
        case EVENT_COMMIT:
            HidePanel (panel);
            QuitUserInterface (0);
            break;
    return 0;
My Main application has two buttons (one for each of the two DLL's) and pressing a button calls associated RUNUI function.
So the application works fine as long as I don't try and have two DLL GUI's up at the same time. (open one and as long as it gets closed before calling the other no problems, all the callbacks work etc.)
As soon as I try and call the second RUNUI function from the main application it partially displays the panel and then goes off in the weeds and I have to abort everything. It seems to hang in the DisplayPanel() function (ie never get's to the RunUserInterface() when i'm single stepping).   So my question is if I'm approaching this the wrong way?
Other info CVI2010 Windows7 64bit
Another item is that I have seen the Multipanel example but when I try and run it I get similar behavor (ie when I select the Schedule Function button the panel pops but everything seems to lockup and I dont' see the start button ever fully display)
Any help would be much appreciated.
Regards,

Thanks for the response.  I didn't include my code for the process attach and dettach but it looks very similar (right out of the example).
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason,
                       LPVOID lpvReserved)
    if (fdwReason == DLL_PROCESS_ATTACH)
         /* Place any initialization which needs to be done when the DLL */
        /* is loaded here. */
        if (InitCVIRTE (hinstDLL, 0, 0) == 0)
            return 0;
    else if (fdwReason == DLL_PROCESS_DETACH)
        /* Place any clean-up which needs to be done when the DLL */
        /* is unloaded here. */
        if (!CVIRTEHasBeenDetached ())
            CloseCVIRTE (); 
    /* Return 0 to abort if initialization fails */
    return 1;
How does your DLL handle GUI callbacks and process events if you aren't running the RunUserInterface?  If you call this from something other than a CVI application does it still work?
Regards,

Similar Messages

  • Support of multiple GUI clients

    Hi,
    Currently, we have an application which partially supports multiple
    GUI clients. When a GUI first launches, it will pop up a dialog box
    to select "Read" or "Read/Write" access mode. Once "Read/Write"
    is selected, others can only select "Read" mode until "Read/Write" mode is released. There is a timer to automatically release the mode, if "Read/Write" is holding up for too long.
    Now., we have to fully support multiple clients. The "Read" and "Read/
    Write" modes have to be removed. That means, mutliple clients can
    send update requests at the same time. Does anyone have ideas how
    to support multiple clients? Is there any "models" out there where
    I can based on to support it?
    Thanks,
    Pin

    Mark, we came out with 8.1.7.4.0 precisely for the reasons you have stated. There is no longer a Windows NT Oracle Service For MTS per database. The logic to enlist Oracle connections in MTS transactions, and the logic to subsequently commit/abort these transactions is fully contained within the middle-tier dlls i.e. ORAMTS.DLL. This removes the single point-of-failure in pre 8.1.7.4.0 versions, and also makes the solution more scalable.

  • Get "Creation Script" of the existing table ( in SQL database) using C# and without using SMO dlls

    Hi All,
    I need to get the "Creation Script" of the existing table using c# and without using SMO dlls (is it possible? I don't know).
    I.e. In SQL Management Studio -> right click on any table -> Script table as -> Create To  - > open in the new query editor window. This will give you the schema of the table with the constraints of the table.
    For E.g. In Northwind database, for the table "Categories", I would like to get it as show below
    USE [Northwind]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Categories](
        [CategoryID] [int] IDENTITY(1,1) NOT NULL,
        [CategoryName] [nvarchar](15) NOT NULL,
        [Description] [ntext] NULL,
        [Picture] [image] NULL,
     CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED
        [CategoryID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    I would like to get the same schema using c#. Please help.
    Thanks & Regards,
    Kalai.

    SMO is the easiest way to get this. This is what Management Studio uses. If you can't use SMO, get a Profiler trace of the queries that SMO executes when generating the script and execute the same using ADO.NET.
    Regards,
    Farooq Mahmud
    Support Escalation Engineer 
    •  Microsoft Health Solutions Group

  • Open and print multiple files from the Finder all at once.

    I'm trying to research how to do this. In OS9 you used to be able to hi-lite multiple files (Word files for example) and just hit Command+P. This would automatically open all of the files AND print them.
    I can't seem to do this in my OS X. Or can I? I can hi-lite and go to File/Print, but the computer is only opening but not printing.
    Any suggestions??
    iMac   Mac OS X (10.4.8)  

    I don't know how to both "open and print" multiple files in one step. The ⌘O combination of course will open multiple items. The items remain selected so switching back to the "Finder" and dragging multiple icons onto the icon for "/Applications" > "Utilities" > "Printer Setup Utility.app" seems to cause them all to be printed to the default printer.
    Alternatively, a user's "~/Library/Printers" folder contains printer icons -- I'm not sure what they are exactly, but they represent the printers set up for that account. They function pretty much like the pre-OS X "Desktop Printer" icons so dragging and dropping multiple files onto them should cause them to be printed. It may even be possible to create aliases to them on the "Desktop" to recreate "Desktop Printer" functionality. But again, this won't open the files into their applications.

  • How do I import or move multiple selected photos to an existing album in iPhoto 9.6? In previous versions I could select and drag multiple photos into an album. Now I can only move one photo at a time. Help!

    How do I import or move multiple selected photos to an existing album in iPhoto 9.6? In previous versions I could select and drag multiple photos into an album. Now I can only move one photo at a time. Help!

    Try this general troubleshooting procedure:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home/Library/ Preferences folder.
    2 - delete the contents the following folder: User/Library/Containers/com.apple.iPhoto
    3 - reboot, launch iPhoto and try again.
    NOTE: For Mavericks and Yosemite,  go to your Home folder and use the View ➙ Show View Options menu to bring the this window:
    where you can check the Show Library Folder checkbox.

  • I need to back up and sync multiple iPhones to a single iMac.  Each iPhone has a separate Apple ID and the data from each iPhone needs to be backed up separately from the others.  How can I do this without getting all of the contacts, etc. mixed? Tnx

    I need to back up and sync multiple iPhones to a single iMac.  Each iPhone has a separate Apple ID and the data from each iPhone needs to be backed up separately from the others.  How can I do this without getting all of the contacts, etc. mixed? Tnx

    This might help: http://support.apple.com/kb/HT1495.

  • Windows XP and authorizing multiple users on same computer

    What is the best way to share songs and authorize multiple users (unique XP users on the same computer)?
    Are all users on XP considered to be on unique authorized computerers?
    Thank you.

    Authorization is done on a per-OS basis; all users on one OS installation are considered to be on the same computer.
    (25930)

  • How to find and replace multiple cells at a time

    I am doing repetitive work re find text in numbers but then replace following cells with text. How can I find and replace multiple cells at a time?
    i.e. doing my own budget spreadsheet and coding all transactions with description and code

    Did you try the "Find/Replace" dialog box?:
    Then click the "Replace All" button in the bottom left.

  • Would like to be able to select and move multiple folders in one operation.

    Unless I'm missing something really simple here, there doesn't seem to be any easy way of selecting and moving multiple folders at once.
    Here's a little example of a simple task I want to do. I presently have a multitude of folders each seperated by the day the photo was taken on. So in my case for a given year I might have maybe 50 folders or so. It's getting a little cluttered, so all I want to be able to do is to take all the folders for one given year and place them in a folder with that year's date. This should be a simple 30 second task, simply select the folders I want moved by either <CTRL> or <SHIFT> clicking them, and then dragging and dropping them into the new folder.
    Right now, the only way I've figured how to do this this is to drag and drop each folder one by one, never mind that this is a slow process in itself, but to add to the slowness, whenever I try to drag and drop more than one folder consecutively, I get a message saying ... "Can not move a folder while another move operation is in progress...blah blah". Not that I want this to be the fix, but haven't they heard of queuing?
    I've seen people on the net suggest that for this type of task, you should simply move the folders in Windows first and then locate them in Lightroom. Again, unless I'm missing something very simple here, there doesn't seem to be a way to locate multiple missing folders at once. If I have to manually locate each missing folder one by one, then I'd rather just do the drag and drop thing as this would actually be faster.
    I've also tried moving the folders from within Windows first and then using the "Synchronize folder" option, yeah sure this works, but I lose any changes that I've done in Develop module. Not what I'm looking for.

    Daniel is right. It´s really strange that I can´t move several folders in one move! When I need more space on my laptop I move a group of folders (one folder for every photosession) to an archive. Therefore I really would like to move them in one click, not "baby-sitting" the move of each folder.

  • After I updated my iPhone 5 to iOS7 I can no longer see the individual chapters when playing my audio books.  Also I can't edit and copy multiple text messages.

    After I updated my iPhone 5 to iOS7 I can no longer see the individual chapters when playing my audio books.  Also I can no longer edit a and copy multiple text messages like before. Is there a way to do these things I am missing?

    Not only can i not see the individual chaptes -- apparently like you and everyone else suffering through the "improved" iOS7 -- when my audiobook repeats a "file" within  chapter, which it sometimes does, I cannot get "inside" the chapter and move forward to where I'm supposed to be.
    Whatever happened to "if it ain broke.......???

  • I can no longer (since upgrading to the latest firefox) open up multiple tabs of the same page (something I need to be able to do when emailing and referencing multiple emails while writing one email). The only option it gives me is to 'switch to tab'.

    Question
    I can no longer (since upgrading to the latest firefox) open up multiple tabs of the same page (something I need to be able to do when emailing and referencing multiple emails while writing one email). The only option it gives me is to 'switch to tab'.

    I'll try to make this clear. I USED to be able to left click on a hyper link and the hyper link would open in a NEW tab. Now for some unknown reason the hyper link by default opens in the same tab (window). I have to right click the hyper link in order for it to open in a NEW tab. (Yes, my 'tools'> 'options'> 'tabs' are set to "open new windows in a new tab." (Please no answers telling me to get rid of the Ask toolbar because I don't have one.) Thank you.

  • How to mirror between the production server and the multiple local servers.

    I am currently looking for the best way to correspond between our production server and the multiple local servers. Because the production server is the only server that holds the latest updating applications, and our local servers are located for each developer’s local machines where the all modifications and creations are done. So when the developer locally makes changes for assets or files, he creates a patch archive first, then accesses to the production side Administration console screen and imports them from Application Management screen.
    We tried to find a way to see the imported date before (so we know which one has been imported as new.), but there is no show in the Administration console Application Management screen. There is Creation date but it’s set as we initially imported the full archive files, but not patch files. Since between applications have some types of the dependencies (like fragments or image files), what is the best way to keep mirroring between the production server and local servers? Or we should simply not use patch file for updating server?
    Thanks,

    Check out this utility : http://blogs.adobe.com/livecycle/2013/03/adobe-livecycle-configuration-migration-utility.h tml
    Thanks,
    Wasil

  • I purchased photoshop elements and i am having all the problems in the world installing it.... first the link in the emails were errors and secondly i have downloaded and installed multiple times and it says my serial number from the email i received is i

    I purchased photoshop elements and i am having all the problems in the world installing it.... first the link in the emails were errors and secondly i have downloaded and installed multiple times and it says my serial number from the email i received is incorrect.... please help

    Ok, since this forum is for Photoshop Standard and Photoshop Extended, we don't know much about Photoshop Elements. There is a Photoshop Elements forum and I'll link it for you since they best know how to field your questions.
    Photoshop Elements
    Good luck on it! 
    Gene

  • Firefox 10. On Windows 7. Adobe PDF will not download or show up in the download list. I tried same files with IE. Download worked fine. Have uninstalled and reinstalled multiple times

    Firefox 10. On Windows 7. Adobe PDF will not download or show up in the download list. I tried same files with IE. Download worked fine. Have uninstalled and reinstalled multiple times

    Perform the suggestions mentioned in the following articles:
    * [[Unable to download or save files]]
    * [https://support.mozilla.com/en-US/kb/Template:clearCookiesCache/ Clear Cookies & Cache]
    Check and tell if its working.
    Not related to your problem but some of your Firefox Plugins are out-dated
    * Update All your Firefox Plugins -> https://www.mozilla.org/en-US/plugincheck/
    * '''When Downloading Plugins Update setup files, Remove Checkmark from Downloading other Optional Softwares with your Plugins (e.g. Toolbars, McAfee, Google Chrome, etc.)'''

  • How do you monitor a background thread and update the GUI

    Hello,
    I have a thread which makes its output available on PipedInputStreams. I should like to have other threads monitor the input streams and update a JTextArea embedded in a JScrollPane using the append() method.
    According to the Swing tutorial, the JTextArea must be updated on the Event Dispatch Thread. When I use SwingUtilities.invokeLater () to run my monitor threads, the component is not redrawn until the thread exits, so you don't see the progression. If I add a paint () method, the output is choppy and the scrollbar doesn't appear until the thread exits.
    Ironically, if I create and start new threads instead of using invokeLater(), I get the desired result.
    What is the correct architecture to accomplish my goal without violating Swing rules?
    Thanks,
    Brad
    Code follows:
    import java.lang.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;
    public class SystemCommand implements Runnable
         private String[] command;
         private PipedOutputStream pipeout;
         private PipedOutputStream pipeerr;
         public SystemCommand ( String[] cmd )
              command = cmd;
              pipeout = null;
              pipeerr = null;
         public void run ()
              exec ();
         public void exec ()
              // --- Local class to redirect the process input stream to a piped output stream
              class OutputMonitor implements Runnable
                   InputStream is;
                   PipedOutputStream pout;
                   public OutputMonitor ( InputStream i, PipedOutputStream p )
                        is = i;
                        pout = p;
                   public void run ()
                        try
                             int inputChar;
                             for ( ;; )
                                  inputChar = is.read();
                                  if ( inputChar == -1 ) { break; }
                                  if ( pout == null )
                                       System.out.write ( inputChar );
                                  else
                                       pout.write ( inputChar );
                             if ( pout != null )
                                  pout.flush ();
                                  pout.close ();
                             else
                                  System.out.flush();
                        catch ( Exception e ) { e.printStackTrace (); }     
              try
                   Runtime r = Runtime.getRuntime ();
                   Process p = r.exec ( command );
                   OutputMonitor out = new OutputMonitor ( p.getInputStream (), pipeout );
                   OutputMonitor err = new OutputMonitor ( p.getErrorStream (), pipeerr );
                   Thread t1 = new Thread ( out );
                   Thread t2 = new Thread ( err );
                   t1.start ();
                   t2.start ();
                   //p.waitFor ();
              catch ( Exception e ) { e.printStackTrace (); }
         public PipedInputStream getInputStream () throws IOException
              pipeout = new PipedOutputStream ();
              return new PipedInputStream ( pipeout );
         public PipedInputStream getErrorStream () throws IOException
              pipeerr = new PipedOutputStream ();
              return new PipedInputStream ( pipeerr );
         public void execInThread ()
              Thread t = new Thread ( this );
              t.start ();
         public static JPanel getContentPane ( JTextArea ta )
              JPanel p = new JPanel ( new BorderLayout () );
              JPanel bottom = new JPanel ( new FlowLayout () );
              JButton button = new JButton ( "Exit" );
              button.addActionListener ( new ActionListener ( )
                                       public void actionPerformed ( ActionEvent e )
                                            System.exit ( 0 );
              bottom.add ( button );
              p.add ( new JScrollPane ( ta ), BorderLayout.CENTER );
              p.add ( bottom, BorderLayout.SOUTH );
              p.setPreferredSize ( new Dimension ( 640,480 ) );
              return p;
         public static void main ( String[] argv )
              // --- Local class to run on the event dispatch thread to update the Swing GUI
              class GuiUpdate implements Runnable
                   private PipedInputStream pin;
                   private PipedInputStream perr;
                   private JTextArea outputArea;
                   GuiUpdate ( JTextArea textArea, PipedInputStream in )
                        pin = in;
                        outputArea = textArea;
                   public void run ()
                        try
                             // --- Reads whole file before displaying...takes too long
                             //outputArea.read ( new InputStreamReader ( pin ), null );
                             BufferedReader r = new BufferedReader ( new InputStreamReader ( pin ) );
                             String line;
                             for ( ;; )
                                  line = r.readLine ();
                                  if ( line == null ) { break; }
                                  outputArea.append ( line + "\n" );
                                  // outputArea.paint ( outputArea.getGraphics());
                        catch ( Exception e ) { e.printStackTrace (); }
              // --- Create and realize the GUI
              JFrame f = new JFrame ( "Output Capture" );
              f.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
              JTextArea textOutput = new JTextArea ();
              f.getContentPane().add ( getContentPane ( textOutput ) );
              f.pack();
              f.show ();
              // --- Start the command and capture the output in the scrollable text area
              try
                   // --- Create the command and setup the pipes
                   SystemCommand s = new SystemCommand ( argv );
                   PipedInputStream stdout_pipe = s.getInputStream ();
                   PipedInputStream stderr_pipe = s.getErrorStream ();
                   // --- Launch
                   s.execInThread ( );
                   //s.exec ();
                   // --- Watch the results
                   SwingUtilities.invokeLater ( new GuiUpdate ( textOutput, stdout_pipe ) );
                   SwingUtilities.invokeLater ( new GuiUpdate ( textOutput, stderr_pipe ) );
                   //Thread t1 = new Thread ( new GuiUpdate ( textOutput, stdout_pipe ) );
                   //Thread t2 = new Thread ( new GuiUpdate ( textOutput, stderr_pipe ) );
                   //t1.start ();
                   //t2.start ();
              catch ( Exception e ) { e.printStackTrace (); }
              

    Thanks for pointing out the SwingWorker class. I didn't use it directly, but the documentation gave me some ideas that helped.
    Instead of using invokeLater on the long-running pipe-reader object, I run it on a normal thread and let it consume the output from the background thread that is running the system command. Inside the reader thread I create a tiny Runnable object for each line that is read from the pipe, and queue that object with invokeLater (), then yield() the reader thread.
    Seems like a lot of runnable objects, but it works ok.

Maybe you are looking for

  • Are 'Select' and 'Refresh' supposed to be sticky in VM Manager GUI?

    VM Manager 2.2 - very nice GUI - pretty intuitive and easy to find your way around. Congrats to the team that added this. I did notice a couple of things: The 'Select' radiobutton choices and 'Refresh in:' dropdown choices are not sticky in the VM Ma

  • Changing process from primitive to composite bug?

    When I change a process type from primitive to composite I am not abe to change it back to primative again. Is that a bug?

  • Phone and sim cartificate not

    No any cartificate on my nokia 2700 classic please help me my Email add. [email protected] Moderator's Note: E-mail address was removed. Please don't publish your personal contact information on a public forum.

  • Get waveform from TDS2012

    Hello,       the attachment is an example whose function is to acquire the waveform from an oscilloscope  from a reference book. Now I'm wondering whether the waveform displayed in the waveform graph is just the waveform the oscilloscope acquires. My

  • Tecra R840 do not shutdown after waking from sleep (USB, BT is not working)

    Hello, I've a problem with my R840 running win7pro + SSD. After waking it from sleep: - no USB activity (but there is power in the ports since I can see the leds on in the external HDD or mouse) - my Bluetooth mouse stops working - my internet connec