LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any possible to set the CVI program/panel alway on top like the task manager?

Hi all,
 
Is there any possible to set the CVI program/panel alway on top like the task manager?
 
We cannot find out such function in CVI 6.0, SDK and we try to use the following but not work property,
 
hWnd = CreateWindow( "GenericAppClass",
      "Generic Application",
      WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
      0,
      0,
      CW_USEDEFAULT,
      CW_USEDEFAULT,
      NULL,
      NULL,
      NULL,
      NULL
   );
    ShowWindow( hWnd, SW_SHOWDEFAULT );
0 Kudos
Message 1 of 5
(4,680 Views)
Every CVI panel can be set to lay always on top via one of its attributes.
 
In the UIR editor go to the panel attributes, then press Other attributes... button and in the pOther attributes panel choose the "Floating style" you want for your window. The default option is to never float, but you can set a panel to float above all other panel when your app is the active one or even always.
The same can be obtained programmatically via SetPanelAttribute (panelHandle, ATTR_FLOATING, ...) choosing the appropriate value for the attribute.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(4,673 Views)
Hi Roberto,
 
Thanks your reply and I tried your method (floating panel always) in my PC but it still cannot work, when I actived other program (e.g pdf), the program cannot bring the windows on foreground (or on top) like the task manager.
 
Now I try to use the SDK method,
1) First I declared, 
HWND hWnd,ActiveHWnd;
2) After display the displaypanel, I get the HWND of the current run window,
 DisplayPanel (mainHandle);
 hWnd = GetForegroundWindow();
3) Run the timer control,
 
ActiveHWnd = GetForegroundWindow();
     
     if (ActiveHWnd != hWnd)
     {
      SetActiveWindow(hWnd);
      i = SetForegroundWindow(hWnd);
      BringWindowToTop(hWnd);
      ShowWindow(hWnd,SW_SHOWNORMAL);
     }
 
 
However, when I run this method in my old PC, it can work. However when run in my new PC (Intel Duo Centrino),
The SetForegroundWindow cannot bring foreground,  (If the window was not brought to the foreground, the return value is zero.).
 
Question:
1) Any method can bring the CVI program foreground and not active it?
2) why the SetForegroundWindow can work with some PC, but not for other, is it the setting reason of my new PC?
 
0 Kudos
Message 3 of 5
(4,627 Views)
Hi Mike,

Changing the floating panel attribute Roberto mentioned should work. You mentioned you were using CVI 6.0, are you running this on both PCs and what Windows versions are you running for both? I get the expected behavior on my machine (XP Pro SP2 & CVI 6). It acts just like the task manager window.  A quick search on the MSDN Website produced notes for different versions.  This may explain the behavior difference on your PCs.

Have a great day,

Ecleamus Ricks, Jr
National Instruments
Applications Engineer
0 Kudos
Message 4 of 5
(4,597 Views)

Hi Mike,

Is there any possibility that you have incorrectly set this panel attribute to "Float when app is active"? This could explain the behaviour you are observing.

Setting the panel attribute to "float always" has worked correctly on the machines I used this solution on. At present I am working on a Inpel PIV machine with Win XP-Pro SP2 and the window floats over Windows Explorer, Internet Explorer, Firefox, Acrobat Reader 7... the same works correctly on a Win 2000 machine (SP4). This tests were made with a CVI7 application but I repeated them with a small test CVI6 application  and it works as well.

It is possible that the version problems mentioned from Ecleamus can explain your actual situation.

UnfortunatelyI have never tried to do the same with SDK functions so I cannot help you with them.

Roberto



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(4,583 Views)