06-29-2009 08:11 AM
06-29-2009 08:14 AM
06-29-2009 09:04 AM
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' .
06-29-2009 11:01 AM - edited 06-29-2009 11:03 AM
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
06-29-2009 02:13 PM
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?
06-29-2009 03:23 PM
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
06-30-2009 06:19 AM
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.
06-30-2009 09:43 AM