Hosting Native Windows Control on CE .Net

H

Haris

I have went through the following article by

Peter Foot
Microsoft Embedded MVP
In The Hand Ltd

Title : Hosting a Native Windows Control within a Microsoft® .NET
Compact Framework Forms Control

URL :
http://msdn.microsoft.com/library/d...netcomp/html/HostingANativeWindowsControl.asp

Great article since I have been scouring the Internet on how to port
Windows COM / ActiveX control to be used in CF .Net platform and this
is the only usefull article I have found. The article also show how to
do this using OpenNetCF which save time since I don't have to implement
a lot of thing myself.

However there is one critical part that I cannot understand. Regarding
how window message passing is used to implement/wrap property, method
and event.

For instance, let say I have a native window ATL control with the
following interface source code:

__interface IAtlTest : public IDispatch
{
[id(1), helpstring("method GetVersion")] HRESULT
GetVersion([out,retval] BSTR* version);
[propget, id(2), helpstring("property Author")] HRESULT Author([out,
retval] BSTR* pVal);
[propput, id(2), helpstring("property Author")] HRESULT Author([in]
BSTR newVal);
};


In order to access this method and property I need to create 3 method
that send message using Win32Window.SendMessage(handle, message_id,
wParam, lParam)

My question is

1. What should mesage_id parameter be? Can I find it somewhere in my
atl control source code?
2. If I have an ATL control dll file without source code. Is there a
way to know this message_id without any documentation from the dll
developer?

Your feedback are appreciated.

Best regards,
Haris
 
P

Peter Foot [MVP]

The technique was designed for Win32 controls only and doesn't support
ActiveX. If you are using .NETCF v2.0 you can use this technique to host an
ActiveX control:-
http://blog.opennetcf.org/afeinman/PermaLink,guid,1dfc3c39-d3cc-4faa-b5f6-cb5c9aed61dd.aspx

Under .NETCF v1.0 you could call these methods via a native wrapper dll, if
you do a search for com interop under netcf v1.0 you should find details and
examples.

Peter

--
Peter Foot
Windows Embedded MVP
www.peterfoot.net | www.inthehand.com

I have went through the following article by

Peter Foot
Microsoft Embedded MVP
In The Hand Ltd

Title : Hosting a Native Windows Control within a Microsoft® .NET
Compact Framework Forms Control

URL :
http://msdn.microsoft.com/library/d...netcomp/html/HostingANativeWindowsControl.asp

Great article since I have been scouring the Internet on how to port
Windows COM / ActiveX control to be used in CF .Net platform and this
is the only usefull article I have found. The article also show how to
do this using OpenNetCF which save time since I don't have to implement
a lot of thing myself.

However there is one critical part that I cannot understand. Regarding
how window message passing is used to implement/wrap property, method
and event.

For instance, let say I have a native window ATL control with the
following interface source code:

__interface IAtlTest : public IDispatch
{
[id(1), helpstring("method GetVersion")] HRESULT
GetVersion([out,retval] BSTR* version);
[propget, id(2), helpstring("property Author")] HRESULT Author([out,
retval] BSTR* pVal);
[propput, id(2), helpstring("property Author")] HRESULT Author([in]
BSTR newVal);
};


In order to access this method and property I need to create 3 method
that send message using Win32Window.SendMessage(handle, message_id,
wParam, lParam)

My question is

1. What should mesage_id parameter be? Can I find it somewhere in my
atl control source code?
2. If I have an ATL control dll file without source code. Is there a
way to know this message_id without any documentation from the dll
developer?

Your feedback are appreciated.

Best regards,
Haris
 
H

Haris

Thanks for the reply,

It is my mistake to assume that win32 control is the same as COMM /
ActiveX control.

Another thing that I would like to confirm is the use of Native Windows
Control term. Does this term refer to a control specific to windows CE?
For instance a control that is created using eVC4 and compiled for
windows CE?

Because at the moment what I really want to do is to take Control
compiled to run on desktop (Windows98, Windows XP, Windowss 2000, etc)
and somehow make it work in WindowsCE. This is because I have a COM
control in DLL file in desktop pc that I really have to use in windows
CE.

Appreciate it if you can furher advice me regarding this. I have tried
to do goole search as you advised, but so far I am not making any
breakthrough,

Regards,
haris
 
G

Guest

It means the WIN32 controls, not one compiled by you.

You cannot make a DLL compiled for the desktop work in CE, no matter what
you try. It's build for the wrong OS, it's probably using APIs that don't
exist in CE, and it's probably compiled for the wrong processor
architecture. THe only way to make it work is to get the source and
recompile/port it.

-Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top