LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Thread Synchronization

I am creating a thread and calling a function, which is defined in main
process
from where i want to pop up a panel dialog. I want to stop the execution of
the
thread till the pop up dialog panel doesn't return a value or completes
operation.
These are different threads and hence i am unable to use InstallPopup().
Kindly let me know how to make my application modal type.

regards
vivek $
0 Kudos
Message 1 of 3
(2,772 Views)
Hello

If you try and create and load a panel in a thread thats different from the main one, you automatically create 2 seperate message queues for each dialog. So using installpopup will not make the dialog modal wrt the dialog in the main thread.
I would recommend using InstallPopup in the main thread, and using GetUserEvent/callbacks and some global variable to monitor whether the popup was clicked or not. Meanwhile, you can shedule a thread and have it wait in a while loop for the global to change. You can set the thread to sleep ( Use the Sleep() function, remember to include windows.h as the very first header) so it doesnt take too much of the CPU time.

I think this would be the simplest way to get this to work.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(2,772 Views)
Hello Bilal,
Thank you very much for your help.
I have been able to solve my problem using
GetUserEvent()

regards
vivek $
0 Kudos
Message 3 of 3
(2,772 Views)