Follow these steps :
- Place two Call Library Function Node VIs on the block diagram and select the DLL user32.dll which is found under C:\Windows\SysWOW64.
- Select the function FindWindowA in the first Call Library Function Node and put these three parameters (the return type is 32-bits integer):
- hWnd (32-bits integer)
- lpszClassName (32-bits integer)
- lpszWindowName (pointer to a string)
- Select the function SendMessageA in the second Call Library Function Node and put these four parameters (the return type is 32-bits integer too) :
- hWnd (32-bits integer)
- uMsg (32-bits integer )
- wParam (32-bits integer )
- lParam (32-bits integer )
- Now you just have to wire a 0 constant to the lpszClassName, and the name of the application you want to close to lpszWindowName of the FindWindowA function.
- Wire the return type of the FindWindowA function to the hWnd input of the SendMessageA function and wire a value of 16 in decimal to the uMsg parameters and a zero constant to the last two parameters wParam and lParam.
- To use the code, type the name of the application you want to close into the Window Name control. For example, to close a Microsoft PowerPoint project, enter Presentation1 - PowerPoint. Check that the name is entered exactly as it appears in the window title to ensure that the application closes correctly.

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.