C# vs. C++ questions - Windows Mobile Development and Hacking General

Hi all,
I am developing applications in C# using Visual Studio 2003.
While my need to create some specific applications, it seems some applications seems virtually impossible to develop using C#.
For instance, I cannot create a SIP (soft-input panel) using C#, and I haven't found a way to develop a today plugin using C#. These applications seems only to be developed using C++.
I know C# is a managed code, as opposed to C++ which isn't by default.
Are the differences between C# and C++ applications -- managed vs. unmanaged code -- the reason I cannot develop a today plugin or SIP, or is there a way I can use C# to achieve this?
I'm using C# since it somewhat resembles the Java language I'm familiar with, and learning C++ would take a while.
Any thoughts and help would be much appreciated!
With kind regards

the syntax is not all that different between java c# and c++ even even ansi c
suppose some difference is what platform you would be programming to
maybe .net which i asume most c# programmers use cant make todayplugins
not sure
you can program .net from c++ aswell if you like or you could program win stk directly or miniMFC
a language is just syntax and speed difference in some cases
how much learning is needed is all about the platform you are developing to

Rudegar said:
the syntax is not all that different between java c# and c++ even even ansi c
suppose some difference is what platform you would be programming to
maybe .net which i asume most c# programmers use cant make todayplugins
not sure
you can program .net from c++ aswell if you like or you could program win stk directly or miniMFC
a language is just syntax and speed difference in some cases
how much learning is needed is all about the platform you are developing to
Click to expand...
Click to collapse
Well, applications created with C# must use the .NET Compact Framework if I understand correctly, and since C# (or .NET) applications require the use of a Common Language Runtime, I can image some applications simply cannot be developed.
BTW, the platform I'm targeting to is my much beloved MDA-II
What I'd like to know is, is it possible to create a Today Plugin or a SIP using C#? Or should I switch to C++?

yes i know you mean xda2 but i ment platform as in .net or mfc or pure win stk
not sure if it's possible to make today stuff and other shell stuff from .net
but what i'm trying to say is that you can make .net from c++ aswell and there the difference between c# and c++ are not all that great
if you have to do pure win stk it's a whole other ball game as in how much they are the same
you could ask zendrui the maker of phonezenprofile he's programming in the pure stk and he prob knows if you can assess those today and shell stuff from anywhere else

Ok, thanks for the tip, I will ask him

Sorry but I never looked on the c# as all the applications developped with .net for PocketPC are slower and as I well know c++
So I don't know if it is possible to create a today plugin or access SIP with c# sorry ...
But if you know a little c++ you can get many examples how to create easily a today plugin and for sure access SIP is really really easy with c++ but I suppose that it should be easy to with c# ...

Link to SIP in C#
This might help you out. I just googled for "pocketpc sip c#".
http://www.c-sharpcorner.com/Code/2002/May/SIPOnPocketPC.asp
D.

Hmm that article just gives you information about showing the SIP from your C# app.
I have a feeling, it's going to be easiest to write a SIP in C++, mainly because you're implementing COM interfaces, but also because it's so fiddly and the only examples I've ever seen are in C++.
Best one I've seen is here (also covers today screen items):
http://www.woodslane.com.au/net/titles/samp0735614431.html

.NET CF
A more general question. I have just started looking at using C# (I too am a Java developer) and Visual Studio .NET 2003 to develop apps for the Pocket PC. Help & samples in VS.NET are rather sketchy, and info on MSDN websites is very scattered. What are some good resources to get started? Any books recommended? Any good web resources?

What about MFC?? Can we include MFC on a today plugin DLL?
Because at least CString would sure come handy!! :?

Hello everybody!
I recently went through a learning experience writing a today plug-in and found out there's nothing to it. Basically it’s a dll that needs to export 2 (1 if no options) functions and create a simple window.
You can certainly use MFC, and MSDN has an article on how to create a today plug-in using .NET: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/TodayScrn.asp
As for sip, that is more complicated, sorry I can't help you there.

I tried the c# today pluggin that microsoft made to try and show their language is usefull. It needed two seperate projects, one in vis studio 2003 and one in evc. i got it to work but it was way too complicated. As levenum said, its not that hard in c++. The responsiveness of their example was very slow compared to native ones. The up side was that it created a today item that lets you display data like pie. I did not experiment other than to modify the background colour to see if it worked.
I think the compact framework is a bit too compact. The features don't help enough with device specific programming, but its good for a lot of other stuff like gui's.

Is there any other way to creat today plugin application instead of using C++ and .net host. Is .net 2.0 support it?

Is there any other way to creat today plugin application instead of using C++ and .net host. Is .net 2.0 support it?

I think this topic is pretty much dead, but the answer is that C# does not support exported DLL functions. Since Today plugins and new SIPs require libraries with exported functions, it's not possible to write either entirely in C#. You have to at least have the C library to export the functions, and that's why the MS article goes about it that way.

This class will show/hide the sip in C#:
Code:
public class Sip
{
[System.Runtime.InteropServices.DllImport("coredll.dll")]
private static extern int SipShowIM(SIPStatus i);
private enum SIPStatus
{
SIPF_OFF = 0,
SIPF_ON
};
/// <summary>
/// Show the SIP.
/// </summary>
public static void Show()
{
SipShowIM(SIPStatus.SIPF_ON);
}
/// <summary>
/// Hide the SIP.
/// </summary>
public static void Hide()
{
SipShowIM(SIPStatus.SIPF_OFF);
}
}

Related

DLL Projects

Hi all,
Generaly, I am Symbian programmer but i will have a look at Pocket PC side... so I am not bloody beginner :wink:
Jep.. I wrote/clicked a C# application with .Net 2003 (very comfortably!!). I saw fast that I have to use C++ to reach interesting APIs.
I know its possible to call (C++) DLL from C# so I can let the frontend in easy C# and can use C++ to get more functionality.
Other than for C#, I couldn't find a "Smart Device" template for C++ in .Net 2003! Someone can tell me, which kind of template I have to use for programming a PocketPC C++ DLL? Is it in .Net 2005?
Thanks a lot!
BR eidelen
Hi,
I thin VS.NET 2003 can only produce managed and x86 native code, so writing for the arm platform was not build in. Your solution would be to use Embedded Visual C++4 which is available free from Microsoft, or to answer your second question I *think* VS.NET 2005 does include the ability to write unmanaged code for smart devices.
Paul
Hi Paul,
Thank for your fast answer! I found it in ".Net 2005" and first DLL-prototypes running!
Now I have some other problems concerning callbacks from native unmanaged DLLs, but I will create a new topic about it.
Thanks a lot!
BR Adrian

Free IDE SharpDevlop for Mobiles

Hello,
is there a free IDE for .net Programming on WM 2003 PhoneEdition using C#?
I have Visual Studio 2003 Express Edition...and the SDK is downloading...
eVC 4.00 is running but i thing .net is better...and more convinient
It woud be nice a link list with items i need for this.
Perhaps use the SharpDevelop IDE for Creation this Apps?
Thx
SharpDevelop is not really working with .NET CF. There is a workaround but it is a mess, you can't use GUI for making forms and such, do a search on their site and wiki. While .NET might be convenient, I suggest you to learn C++ and use EVC++4 and possibly MFC; native apps is the way to go under PPC, especially since .NET apps tends to be slow (and you can't do some stuff in .NET either).
Evc++ I cant get the SRC Files for this example CTapiConnec
Hello,
hmm yes i can use evc++, i have tested it and it works fine.
Creating a Standard Dialog based app no "beginning" Problems...
BUT
I want to use the tapi do make a call. Ok MS has a CallIt sample on Homepage and some post in this Forum...
I cant get the SRC Files for this example CTapiConnection
defined in TAPIUTILS.H
And reimplement this again is mutch work...i tried it but many compiler errors after 20 Fixes i give it up.
Where can i download it? Or only for MSDN Subscribers?
And the issue about looking what is included in .h Files

Software Development

Can I develop software to WM5 but no .Net frameworks ?
Of course!
In fact it is much better to use native code on WM devices because it is faster and takes up less resources.
If you already know C / C++ go to MS site and download the free eMbedded C++ 4 and the Pocket PC 2003 SDK (don't mind the OS version).
Also if you have VS 2005 download the WM 5 SDK and create a smart device project in C++.
1 cool think about .net though is i had a sudoko or whatever it's called
program for pda and the same exe workd on pc too
but all in all .net is a slow as java though on pocketpc the .net maybe better implemented then the java vm's
levenum said:
Of course!
In fact it is much better to use native code on WM devices because it is faster and takes up less resources.
If you already know C / C++ go to MS site and download the free eMbedded C++ 4 and the Pocket PC 2003 SDK (don't mind the OS version).
Also if you have VS 2005 download the WM 5 SDK and create a smart device project in C++.
Click to expand...
Click to collapse
hi levenum,
i have VS 2005 and WM 5 sdk installed.
well my problem is C++ which i never read seriously but i have a good
working base of C on which i had developed two simple game.
How can i implement the code in VS2005/WM5SDK with minimal
interaction of C++ ?
How can i get working base on VS2005/WM5SDK?
Can u suggest me a tutorial or any free book?
with c vs. c++ it's really much the same ++ is just an expansion with nativ class and other object orientented features
any c program should be able to compile using a c++ compiler
but i doubt you can write CE programs or even windows programs without using any kind of class related code
heck you cant even do that in basic (evil language) or c#
the internet is soo full of free programming stuff it's not even funny
buying paper books is a thing of the past imho unless you want to read while on the toilet and dont have a laptop or pda
http://www.brpreiss.com/books/opus6/
good googling for more
Actually, except for M$ nasty invention called "COM" there is nothing in Windows API that requires C++.
In fact I rarely use classes unless I am building an MFC app to save time.
Also, (can't remember the link for the life of me) but there is some way of accessing class objects in pure C using some struct tricks.
So basically you can leave fine without the ++, but you may need to work a little harder.
You should just create a basic smart device project. VS will generate a "hello world" app for you and you can see how it works. Moving from C to C++ should be very easy.
It's C# that is no longer a real programming language
P.S.: Did you know most of Win CE DLL are actually written with ANSI C?
levenum said:
Actually, except for M$ nasty invention called "COM" there is nothing in Windows API that requires C++.
In fact I rarely use classes unless I am building an MFC app to save time.
Also, (can't remember the link for the life of me) but there is some way of accessing class objects in pure C using some struct tricks.
So basically you can leave fine without the ++, but you may need to work a little harder.
You should just create a basic smart device project. VS will generate a "hello world" app for you and you can see how it works. Moving from C to C++ should be very easy.
It's C# that is no longer a real programming language
P.S.: Did you know most of Win CE DLL are actually written with ANSI C?
Click to expand...
Click to collapse
thanx,
i had already compleated "hello world"
and C++ is really not much away from me
actually i only have a single problem:
How can i get working base on VS2005/WM5SDK?
Click to expand...
Click to collapse
well i think it is more exactly Win CE API knowledge which i require.
How Do I Start Cooking Roms
I Know A Bit Of C++ ,how Do I Start Cooking My Own Roms
tawanda: first off - your question has nothing to do with this thread, if you have an unrelated question you should start a new thread BUT search first to make sure it was not asked and answered a 1000 times!
As for your question - cooking ROMs is not programming - it helps to know a programming language but what you really need to do is familiarize your self with the tools used to pack and unpack as well as dump and flash ROM images.
Note that these tools are different for different devices or at the very least need to be configured differently.
I recommend you start by reading the WiKi.
After some years of absence from the programming world I think now I've time enough to start again. I'm familiar (but a bit rusty) with assembler, C and C++, but I think I have start more or less from the beginning.
I already installed Visual Studio 2005 and the WM05 and WM06 SDK. Now I'm not sure whether I should use C# or C++. The big difference is that C# needs compact framework?
Your question is mainly a matter of personal preference.
Here is my opinion on C++ vs. C#:
C++ advantages:
- Native code is faster than .NET
- Easier access to Win32 APIs
- Ability to write system components like keyboards and today plugins.
C# advantages:
- Saves on coding time
- Allows use of many .NET CF components to quickly accomplish complex tasks.
Please note that I am bias. I hate .NET and want nothing to o with it. Specially on mobile devices that do not have the processing power to spare for the .NET overhead.
I second levenum's recommendations -- I've been programming big Windows for 15 years and have managed to avoid .NET. Of course most of what I do these days is NDIS driver programming, so it's mostly straight C, with C++ for supporting user-mode code.
Avoid MFC -- it adds a bit of overhead which is OK for big Windows, but not for WM. If you're going to use a C++ framework, I highly recommend using ATL/WTL -- it's what MFC wants to be when it grows up.
I'm looking at my visual studio 2005 and wanting to covert my c# application to C++...
I clicked on a new project and i'm looking at the various options in Visual C++ for Smart Devices. There are a few to choose from... how do I know which one I want to choose?
ATL Smart Device Project
MFC Smart Device Application
Win32 Smart Device Project
MFC Smart Device ActiveX Control
MFC Smart Device DLL
Can you guys tell me the difference between those options and which I should use to develop for WM6?
Thanks,
Derek
imho then a good pro of c# vs. c++ is the nice object lib that .net give
mfc is pretty crap in every respect and if you do pure stk
it's more work to make it object orientated
"ATL Smart Device Project
MFC Smart Device Application
Win32 Smart Device Project
MFC Smart Device ActiveX Control
MFC Smart Device DLL"
depend on what you want to do
i mean DLL is not a program but a lib that other programs can access
but then today items are dlls
win32 is pure win32 stk where you pretty much have to do all the prev work to get your application up and running
mfc is microsoft foundation clases it's an somewhat dated object lib from ms which makes making an application faster it pretty much give you a dialog and let you place components such as button on it
ActiveX is an somewhat evil internet programming platform
atl http://en.wikipedia.org/wiki/Active_Template_Library
you can prob find more info about everything you want more info about
from wikipedia too
thanks for the info rudegar!

Do I have to use Visual C++?

Hi there,
I'd like to do some Windows Mobile development but, quite frankly, I do not have the time or energy to learn Visual C++.
I'm good with Perl, PHP and Visual Basic and au fait with Windows Mobile - so the concepts of development on this platform aren't an issue. It's just simply a case of learning C++ does not fill me with any kind of excitement.
I looked at eVB, but its ancient and lacking in many respects. I thought about Visual Basic .NET but there appears to be no documentation around - you can't even buy a book on Windows Mobile development with it.
Any suggestions on something I can use which doesn't have a steep learning curve and allows me to get on writing useful things without spending the next 2 years learning dull stuff?
Thanks.
any of the c languages would be the best as they are native to winmo. you can use vb.net and it will work just fine. i have developed a few simple apps with vb.net and am working on one now i hope to release on here when i am finished. i am in the process of furthering my knowledge of vb.net and also learning asp.net, ado.net and c++ so i am very busy with programming. i would recommend learning one of the c languages if you really want to get in depth with winmo programming but like i said vb.net will work just wont be the best.
ps if you are comfortable with vb.net learning c++ should not be that difficult for you.
When you're using .net it doesn't matter if you use vb.net, visual c++ or any other .net language because eventually you'll end op with MSIL (Microsoft Intermediate Language). All .net languages are equally fast (except vb.net when you use the old visual basic namespace, so don't use it!)
"Visual Basic .NET"
.net compact framework is pretty well documented
come to think of it all msdn's examples are first vb.net
then c#.net and then c++.net and maybe j# or jscript.net
so plenty of documentation in that department
c# is not that hard if you know java it's much of the same
but if what you wanna do is pretty "basic" then mortscripts goes along way

noob question: How to start programming?

Hi all,
Finally I've my HD2 and I must say, I'm very happy with it!
I'm no noob in informatics, I program in VB and VBA and I'm DBA in Oracle and SQL Server. But to be honest, I don't now how to start.
I tried searching the forum here, but couldn't find a thread: how to start programming on a WMO-device.
Thanks already for the info!
Koen
PS for example I would like to program this:
keyboard layout French (AZERTY)
T9 language Dutch
Koen D said:
how to start programming on a WMO-device.
Click to expand...
Click to collapse
You start programming for WM the same way you do it for Win32. Just download mobile SDK from Microsoft and you're good to go. You use the same IDE, Visual Studio, for mobile programming, and coding experience is the same, in addition to the fact that a lot of code using WinAPI will just work. There are differences of course with regard to memory management or power management etc., but those are either documented on msdn or are discussed at length everywhere on the web.
VB and .Net won't be good for your purpose though, you'd need native C++ code for things like rewriting a T9 engine I think.
Hey hey!
You can find many interesting postings and topics here:
http://forum.xda-developers.com/forumdisplay.php?f=522
http://forum.xda-developers.com/forumdisplay.php?f=260
There are much more. Please look for the "stiky" posts. There are often very usefull informations. Sure, the moderators open some stikys "just-for-fun"... ... but many topics are realy interesting.
Some external sites can help you, too:
http://developer.windowsphone.com/Default.aspx (of course)
and
http://www.smartphonedn.com/
you can became a part of the msdn (winmo special) here:
http://msdn.microsoft.com/en-us/windowsmobile/default.aspx
When you became a good dev. You should look for 3rd party stuff like:
http://www.resco.net/developer/default.aspx
For the beginning it should be enough.
regards
You can also program in mobile java, which will make your app portable to more devices.
http://java.sun.com/javame/index.jsp
Do you want to be a ROM chef, or programmer?
Or both ?
To just program for the Windows Mobile OS, you can
grab a (free) version of Microsoft Visual Studio 2010/2008
and download the WIndows Mobile development resource kit
from them.
Then you can blast away in C#, C or .NET
If you just want to cook ROM's then look at the kitchen thread.
Look at that thread anyway
Try Visual Studio, VB.NET and the Windows Mobile SDK there it is s
Hi mates, want to ask which is the best programming language for WM? C, C++, C#, VB.Net or something else. I did use C# a lot and can do little thing with SQL Compact. But, it seems lot of the current applications are not require .Net Framework installed on WM. Are they using C++?
Also, is there anything need to be considered for WM Web Programming (such as JavaScript, CSS support)?
siamchen said:
Hi mates, want to ask which is the best programming language for WM? C, C++, C#, VB.Net or something else. I did use C# a lot and can do little thing with SQL Compact. But, it seems lot of the current applications are not require .Net Framework installed on WM. Are they using C++?
Also, is there anything need to be considered for WM Web Programming (such as JavaScript, CSS support)?
Click to expand...
Click to collapse
yep. most WM apps use C++, but even the C# apps will run as most of the ROMs contain the .NET fw by default
I have a question as well, are there any free-for-freeware frameworks for touch-friendly applications? Is there a Sense SDK?
bayowar said:
I have a question as well, are there any free-for-freeware frameworks for touch-friendly applications? Is there a Sense SDK?
Click to expand...
Click to collapse
Microsoft has an SDK for 6.5's gesture support. I've not got around to using it yet though, so can't comment on it's quality or breadth of support.
Is there something I cant build using C only in this phones?
I mean can I build a complete rom, applications and such using only C?
thats the only lang I know so...
mr_Ray said:
Microsoft has an SDK for 6.5's gesture support. I've not got around to using it yet though, so can't comment on it's quality or breadth of support.
Click to expand...
Click to collapse
I've seen that, what about buttons, sliders, tabs, flickable lists and all this stuff though. I've never developed for a mobile platform and I'd imagine starting from scratch with all UI elements steepens the learning curve quite a bit.
siamchen said:
Hi mates, want to ask which is the best programming language for WM? C, C++, C#, VB.Net or something else. I did use C# a lot and can do little thing with SQL Compact. But, it seems lot of the current applications are not require .Net Framework installed on WM. Are they using C++?
Click to expand...
Click to collapse
There are pros and cons to using managed code (C#/VB), and the same holds true about native code (C++). The former is much easier for high-level tasks, but you get less control and it may get a bit tricky when you need to access WinAPI not included in .Net CF (although there are usually ways to do it via Platform Invoke). .Net applications start slower, which may be an issue for certain tasks. Native code is (should be) faster, but a bit more complex and you don't have things like automatic garbage collection and so on. Sometimes you need a couple of lines of code in C# instead of two dozen in C++. Sometimes not. On the other hand, writing something like a graphics-heavy game in C# would be a strange endeavor. Some things are outright impossible like writing a system service, AFAIK. All in all, the pros and cons are described at length everywhere, and it's up to you to decide.
bayowar said:
I have a question as well, are there any free-for-freeware frameworks for touch-friendly applications? Is there a Sense SDK?
Click to expand...
Click to collapse
In the Development and Hacking section you'll find a C# GUI framework (it's called Manila UI Framework or something like that) made by a fellow XDAer.
bayowar said:
I've seen that, what about buttons, sliders, tabs, flickable lists and all this stuff though. I've never developed for a mobile platform and I'd imagine starting from scratch with all UI elements steepens the learning curve quite a bit.
Click to expand...
Click to collapse
If you want non-standard UI elements it can get tricky. For standard UI it's a no-brainer. There are some third-party libraries available. In addition to the C# framework I mentioned earlier, there's Qt (a cross-platform UI framework used by Opera for all their desktop (Linux, Win and Mac) and mobile (WM and Symbian) and embedded platforms including TV set-top boxes) incarnations, Airplay SDK that's a cross-platform framework for Android, WM and iPhone, some others I can't recall right away. They may or may not be free however.
Thanks for the reply, good to know about Qt. I'm vaguely familiar with that, had now idea it found it's way to Windows Mobile.
The Manila framework is called Manila Interface SDK, at least that's the only match I found.
bayowar said:
I've seen that, what about buttons, sliders, tabs, flickable lists and all this stuff though. I've never developed for a mobile platform and I'd imagine starting from scratch with all UI elements steepens the learning curve quite a bit.
Click to expand...
Click to collapse
Actually it is not the UI but the SDK that has a steep learning curve. Besides the usual loops and if then else.. you need to know exactly which library does what and there is the confusion as there are a couple of them doing similiar things eg Messaging API. At least that is what I encountered when I first started and I agree that C++ has a huge advantage over C# or VB.net as it can interact directly with the hardware api instead going over in a big circle and sometimes, some functions can't even be achieved using vb.net!
Just install vs.net and catch up on OO by diving into vb.net.
You'll be fine coding in either C# or VB.NET, the BCL for Ce is leaner than that for full blown windows but still very usable. After installing vs2008 don't forget to update the default install to wm6.5 sdk.
siamchen said:
Hi mates, want to ask which is the best programming language for WM? C, C++, C#, VB.Net or something else. I did use C# a lot and can do little thing with SQL Compact. But, it seems lot of the current applications are not require .Net Framework installed on WM. Are they using C++?
Also, is there anything need to be considered for WM Web Programming (such as JavaScript, CSS support)?
Click to expand...
Click to collapse
Hi mate,
I reckon c++ so u dont need to redisttibute the framework and your app will run fast, but if u want to write apps with db access net framework is the easy way, I'm in Sydney and I do c++ so PM if u need some help,
cheers,
Hlov
BTW is there some good app for programming in my HD2? taking my work on the go? something like visual studio mobile version?

Categories

Resources