How to use C++ code in C#.net

Aug 23, 2011 at 8:15pm
Hi all,

I found an article in MSDN which describe how to do some certain thing, http://msdn.microsoft.com/en-us/library/ms919833.aspx but it is in c++. I want to translate or re-use it in c#.net, is there a way to use the function in the document above?

Thanks,

Sam.
Aug 23, 2011 at 10:17pm
Yes, C++ and C# are very similar in syntax and you should be able to easily convert your code from C# to C++.

One thing to note is that not all C# functions have equivalent C++ functions especially since you are using the .NET framework.

If your C#.NET application is a CLI application, then the conversion should be relatively easy. If it is a web app, then things are real complicated.

Aug 23, 2011 at 11:02pm
It sems that function you link to -- RequestPowerNotifications -- is not so easy to deal with from C# as it is Message Queue based. But luckily someone has written a couple of articles explaining how to do it!

Windows Mobile Interprocess Communication with Message Queues in .NET
http://www.codeproject.com/KB/windows/WiMoQueue.aspx

Windows Mobile Power Management
http://www.codeproject.com/KB/windows/WiMoPower1.aspx

Note this is not something I have particularly looked into. But article does get a high core.

Orig. spotted on MSDN, in thread "RequestPowerNotifications"
http://social.msdn.microsoft.com/Forums/en/netfxcompact/thread/27b77f8b-4366-4799-a694-ecfd4c1b7a52

Andy
Last edited on Aug 23, 2011 at 11:04pm
Topic archived. No new replies allowed.