> 2. In this C DLL function, the code creates an invisible window with
> CreateWindow() using for the message loop the function pointer passed.
> 3. C DLL saves the window handle in a DLL global variable for future uses
> 4. C DLL function sends a PostMessage( saved_handle, WM_custom, xx, yy) but this
> message is never received from VB.NET function (the message is visible with
> Spy++)

Signature
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
Dmitriy,
thanks again for your attention,
> It is not clear why should the VB .NET callback receive the message in the
> first place? Is this VB .NET function actually a window procedure? If yes, I
> would advice to pay maximum attention on HOW do you pass the function
> pointer to the C DLL. Ensure you specify the right calling convention
> (WINAPI that is), and that all parameters will be marshalled properly.
Yes, it is a window procedure for the window created into the C DLL.
OK, i'll re-check all the parameters .... but i think if the address was wrong,
i should have a crash !!
> Then, it's not clear what is meant under "the message is never received". If
> you would post some standard message, would it be received by the VB .NET
> procedure? Does it gets called at all?
The VB.NET window procedure receives all the standard messages fired
(internally) from the CreateWindow() call.
When i explicitly want to post a message (custom or not) to the invisible window
from my DLL code,
i think the message will be sent to its window procedure but the .NET window
procedure is not fired !
> I am just trying to focus on the root of the problem, so please be patient
> to tons of my questions :-)
Oh, don't worry !!! I understand that is not a clear architecture but
i'm migrating from an existent situation (VB6+C DLL), this
situation was created from previous programmer and I'm trying
to leave untouched the just-tested DLL. Maybe in the future I'll
have time to re-write also the DLL.....
Thanks a lot !
--
Stefano M
email: *@*
(remove *)
Dmitriy Lapshin [C# / .NET MVP] - 20 Nov 2003 12:58 GMT
> The VB.NET window procedure receives all the standard messages fired
> (internally) from the CreateWindow() call.
> When i explicitly want to post a message (custom or not) to the invisible window
> from my DLL code,
> i think the message will be sent to its window procedure but the .NET window
> procedure is not fired !
A-ha, now it's much more clear. So my suggestions are:
1. Check the custom message is registered (I believe there's an API function
to do that). Not sure the receiving party should also register the custom
message though.
2. The PostMessage function has some difficulties with marshalling custom
messages. Not sure what they meant in MSDN but here's the quote:
=== Cut ===
The system only does marshalling for system messages (those in the range 0
to WM_USER). To send other messages (those above WM_USER) to another
process, you must do custom marshalling.
=== Cut ===
I'd also suggest asking the more detailed question in the
dotnet.framework.interop newsgroup as it seems to be not related to the VB
.NET lanugage itself.

Signature
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
> Dmitriy,
> thanks again for your attention,
[quoted text clipped - 34 lines]
> email: *@*
> (remove *)