高崇軒
高崇軒

Reputation: 117

How to use hWnd in C#

I've been trying to figure out how to use a dll, which can be directly used in C#.

Here's the function

Open( BSTR bstrDevice, BSTR bstrLogFile, DWORD hWnd, UINT uMsgType, UINT uMsg);

where hWnd is

hWnd
The windows handle of a window that will receive messages. No messages are sent if set to zero, and any calls that normally would generate messages are synchronous.

It can be totally ignored, but I certainly want to know how to use it in C#.

Any component, item or tool can be input to the function? What would happened if function returns anything? How do I get return values?

Upvotes: 0

Views: 1546

Answers (1)

Morix Dev
Morix Dev

Reputation: 2744

hWnd is the handle of the form that will receive windows messages related to the execution of your DLL function (Open). I do not know the details of this function, so I cannot tell you which kind of messages are going to be received by the form...

For passing a valid form handle to the function, you can simply pass myForm.Handle to the DLL, where myForm is the name of the form you want to send messages to.

Upvotes: 2

Related Questions