Solution
This task can be easily accomplished by using two Windows APIs through the
Call Library Function Node. In this case, the
Call Library Function Node will be used to call the functions,
FindWindow and
SetForegroundWindow, from the user32.dll.
- Place the Call Library Function Node (located in the Connectivity toolset) on the block diagram.
- Right-click the node and select Configure.
- A dialog box will appear, which will allow the user to specify the library name or path, function name, calling conventions, parameters, and return value for the node.
- After clicking the OK button, the node automatically resizes to have the correct number of terminals and sets the terminals to the correct data types.
- The following reveals the settings necessary for each of the two Windows APIs, FindWindow and SetForegroundWindow.
FindWindowThe following parameters should be used for this API:
Parameter | Type | Data Type |
hWnd | Numeric | Unsigned 32-bit Integer |
IpszClassName | Numeric | Signed 32-bit Integer |
IpszWindowName | String | C String Pointer |
SetForeground WindowThe following parameters should be used for this API:
Parameter | Type | Data Type |
return type | Numeric | Signed 32-bit Integer |
Handle | Numeric | Signed 32-bit Integer |