LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to close a CVI Application from VC++ Aplication

I am trying to close a CVI application from a VC++ 6.0 application, But I can.

I tried with DestroyWindows(); PostMessage(hwnd, WM_CLOSE, 0,0) and Still I can not doit.

Can somebody help me.

Thanks
0 Kudos
Message 1 of 7
(3,857 Views)
You shuld use RegisterWinMsgCallback in CVI to catch Windows standard
messages.


--
Marco Turra
Soft. Department

HI-TEC S.r.l.
Via Agrigento 9
20148 - MILAN
ITALY

Tel. +39.02.39262464
Fax. +39.02.39260434

Web Site: http://www.hi-tec.it
E-mail : marco.turra@hi-tec.it


"Wilbert" wrote in message
news:50650000000800000043E70000-1079395200000@exchange.ni.com...
> I am trying to close a CVI application from a VC++ 6.0 application,
> But I can.
>
> I tried with DestroyWindows(); PostMessage(hwnd, WM_CLOSE, 0,0) and
> Still I can not doit.
>
> Can somebody help me.
>
> Thanks
0 Kudos
Message 2 of 7
(3,857 Views)
Hi,

you may want to give the main callback a try. CVI can install a callback for external messages that are sent to the application. You need to call InstallMainCallback() to set this callback up and you should get a EVENT_END_TASK when VC++ send the terminate message.

There is more information on this in the following document: How Do I Programmatically Detect If a User Pressed 'Ctrl-Alt-Delete' in LabWindows/CVI?

Let me know if you have any further questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 3 of 7
(3,857 Views)
Do you have a Sample in National Instrument Site ?
0 Kudos
Message 4 of 7
(3,857 Views)
Hi,

I could not find any examples on our website; however I created a small example for you. The main caveat on doing this is the window the name that you use for FindWindow().

If you get a handle of the panel, the panel closes but the application is still active. To close the application and get the EVENT_END_TASK you must get a handle to the CVI application. So you must pass to FindWindow the name of the project.

There are 2 CVI projects here, the project MainCallback demonstrates how to use the main callback and quits the application by posting a close message. The second project just posts the message to close the application.

Please take a look at these projects and let me know if you have any further questions.

Regar
ds,

Juan Carlos
N.I.
0 Kudos
Message 5 of 7
(3,857 Views)
Juan Carlos.

Thanks for your help, Let me check te files and I tell you if its work.
0 Kudos
Message 6 of 7
(3,857 Views)
Any time, I'll keep an eye on this posting.

Good luck with your project.

J.C.
0 Kudos
Message 7 of 7
(3,857 Views)