LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A dll I am using is requesting a window to post to. Is this possible in LabView?

I searched the forums for how to do this, but didn't find anything. Please assist. Thanks.
0 Kudos
Message 1 of 8
(2,856 Views)
You will need to provide more information. What does it need? A window refnum? Is it based on the Windows API, so all it needs is the 32-bit refnum? Something else? If it's just the refnum you can get that using the Windows API. The lvwutil libraries contain functions for getting window refnums.
0 Kudos
Message 2 of 8
(2,854 Views)

The dll function is

 

 

3.1.1 BtOpenAPI This is a declaration for starting to use this API. Piror to using all functions, it is necessary to call this function once.

Syntax:

BOOL BtOpenAPI(HWND hWndApl, PCHAR pszAplName, PLONG plStatus);

Parameters:

HWND hWndApl Specifies the main window handle of an application that uses this DLL. PCHAR pszAplName Specifies the name of an application.

This parameter is used for identifying the owner of a COM port created by CreateCOMM(), etc.

PLONG plStatus A pointer that returns the status of the processing result. Error information is returned by a negative value (The return value is FALSE.), and warning information (The return value is TRUE.) is returned by a positive value.

Return Value:

TRUE is returned when processing was successful. FALSE is returned when it failed.

 

It is a win32 based API. The API wants to post data from a callback to a message window 'hWndApl' .

 

 

0 Kudos
Message 3 of 8
(2,842 Views)

You can try to use the window handle of the LabVIEW application.
Use the function __cdecl DWORD GetLVAppWindHandle(HWND *hwnd)
to get it. Configure a "Call Library Function" node as following:

 

Library Name or Path: LabVIEW

Function Name: GetLVAppWindHandle

Calling Conventions: C

Parameter: return type

Type: Numeric

Data Type: Signed 32-bit Integer

Parameter: hwnd

Type: Numeric

Data Type: Signed 32-bit Integer

Pass: Pointer to Value

 

Message Edited by candidus on 06-29-2009 11:03 AM
0 Kudos
Message 4 of 8
(2,828 Views)

gordonfin wrote:

It is a win32 based API. The API wants to post data from a callback to a message window 'hWndApl' .


I don't quite understand what you mean by this. Are you saying that the DLL will be posting messages? What callback?

0 Kudos
Message 5 of 8
(2,813 Views)

The DLL expects a windows handle and will post WIN32 application messages to the window.  Additionally, another DLL API function is called to pre-allocate memory that is passed in this  DLL APIl.   There is no direct function callback, just via the windows messaging.   Is there a way to intercept user defined windows messages in Labview?  Upon receipt of the message(in WIN32 world), the pre-allocated memory is decoded, and then needs to be deallocated using another DLL API.  So

- Can LV intercept user defined windows messages

- What is the best way to get a LV pointer for use by the Memory Allocation API in this DLL

 

 

0 Kudos
Message 6 of 8
(2,806 Views)

If you have to handle custom win32 messages then you probably need some further code written in C:

I think you have to create a hidden window and start a message loop in a new thread.

You could create a DLL with an exported function that does it for you. 

0 Kudos
Message 7 of 8
(2,783 Views)
You can try to use the Windows Message Queue Library to respond to custom messages. Can't really say that it will work, though.
0 Kudos
Message 8 of 8
(2,769 Views)