.NET question - General Questions and Answers

Hi all!
Probably this is going to be a stupid question, because I just started coding in C# half a year ago, thinking that C# was just like JAVA, you can use it in every platform.
Today I managed to write my first "Hello World" application to Windows Mobile.
First I coded the application and compiled it to x86 (normally with Visual Studio) and tried to run it on WM. It didn't run.
Why? Isn't it the concept of .NET that it can run on every architecture?
After that I managed to figure it out that it has to be a smart device project...
Can someone give me a heads up (or a detailed link where I can RTFM?
Thx!

pda's use .net compactframework which is a subset of normal .net
read more here
http://www.google.dk/search?hl=da&q=net+compact+framework+vs.+net&btnG=Søg&meta=lr=lang_da|lang_en

Beware the manifest....
From Visual Studio 2005 onwards the IDE embeds a manifest in either the .EXE itself or as a separate file. This contains a list of exactly what the app needs to be present in order to run. The loader on the target machine reads it and makes sure that all this stuff exists on the target, before it will allow it to run. VS2003 was not quite so smart, there is no manifest. If the .NET objects used were present in both .NET 1.0/1.1 and the compact framework .NET 1.1 (i.e CF was the lowest common denominator) then the loader would load it and try and run it. Subject to there being no errors in the just-in-time compile of the .NET CLR and no run time errors of the code, it will work. It is possible to run the same .EXE on a PC and pocket PC, but there are a lot of ifs and buts.
Sometimes less is more......

Related

Developing Applications for XDA II

Does anybody know with what IDE (Integrated Development Environment) it is possible to generate Applications?
eMbedded Visual C++ (based on Microsoft Visual Studio IDE)
http://www.microsoft.com/windowsmobile/resources/downloads/developer/default.mspx
With Visual Studio.NET 2003 you can develop applications that use the .NET Compact Framework.
Further to the last response - these Compact Framework applications can be written in VB.Net (which is very similar to VB, though more verbose) *or* C# - there's no difference in the speed they run, which (for PC applications at least) is a hell of a lot faster than VB6 code.
The VS2k3 environment even contains a device emulator, or can run code *on the device* and allow you to set breakpoints & go to the line an error occurred on. There's also a Windows Mobile 2003 SDK available from Microsoft which adds a Windows Mobile 2003 emulator.

How to learn programming for WM2003 ?

I would like to learn to program for PPC.
I am familiar with x86 assembly , and several RISC assembly langauages, while I understand it won't help me here, I also do know VB.
What language do you suggest I should learn, and what tools/compilator should I use ?
I would like to program an todat-plugin , among other things,
thnx
Visual Studio .NET is rather easy to use..
Your VB skills may come in handy..
There is allso the opportunity to use pure VB, but it isn't really any good..
The integration between development environment, emulator and device is awesome in VS.NET..
I personally use VS.NET 2003, with only VB.NET installed. Works for me..
The downside is that the applications require the .NET framework, and eat a little more memory than well written apps in other languages..
For absolute power and control; C++ as allways..
[Norwegian]
Ps. Fyll ut profilen bedre..?
[/Norwegian]
with .net 2003
you can do vb.net
c# .net
c++ .net
with embedded visual studio c++ you can do
win32 applications
you can do mfc applications
heard there also in an embedded visual studio vb
which let you do vb without being .net
visual studio 2005 .net will merge embedded visual studio and smart device .net (the .net you can do with 2003 visual studio)
[Norwegian]
Ps. Fyll ut profilen bedre..?
[/Norwegian][/quote]
what would you like to know ?
www.madhacker.org
Anyway, I was really looking for something lighter that the heavily overpriced and over-sised MS Visial Studio - but it seems that there are no better options
well there is a free c# compiler both a compiler which run on the pocketpc and one that is just a free windows c# compiler for windows but .net should be able to work on pocketpc's not matter what
and i also have a gcc compiler for pocketpc as in it run on the pocketpc
just about every compiler you can find which can compile arm code you can use to make programs for pda's using pocketpc2002 and 2003(SE)
AlCapone said:
www.madhacker.org
Click to expand...
Click to collapse
:shock:
You are one crazy dude!

Programming

I previously posted on the wrong section, sorry, so I'm transferring it here.
Anyway, I want to know what programs I can use to make programs for HTC Raphael. Can I use Microsoft Visual Studio? Borland? I currently know how to use c and c++, do I need to use c# instead? And are the commands the same with the one on for the PC and for the PPC? So yeah any programs for programming on the desktop or on the PPC?
Thanks in advance!
yeah visual studio will do it
it support
1
.net compact framework for c# which is a subset of normal .net with some of the more fancy controls missing is normal .net programs from pc dont use anything missing in the compact framework they can run directly on the pocketpc unless the rest is not programmed to adjust (c#)
2
it support microMFC which is a pocketpc version of the old microsoft foundation classes
which was ms's object lib before .net (c/c++)
3
it support pure win32 api which again is a subset of the normal windows win32 api (c/c++)
performance wise 1 is lowest 3 is fastes
support in turms of having control without programming too many unmanaged hooks 3 is best 1 is worst
speed to get a project up and displaying something and having some functionality 1 is fastest 3 is worst
dont know about borland anymore guess they support compact framework
So if I make a program in c or c++, I can actually run it already on my PPC? If so, why does the .exe files on my PPC disallows me to run them on my desktop? Do I need to like convert the .exe file I made on my desktop to make it run on the PPC? If yes, is there any program out there to convert it to make it available for my PPC?
you have to run it using an emulator on your pc such as the one that comes with vs
userman777 said:
So if I make a program in c or c++, I can actually run it already on my PPC? If so, why does the .exe files on my PPC disallows me to run them on my desktop? Do I need to like convert the .exe file I made on my desktop to make it run on the PPC? If yes, is there any program out there to convert it to make it available for my PPC?
Click to expand...
Click to collapse
if you have Visual Studio 2005 Pro, you can create a new "SmartDevice" project. This will take care of setting up almost everything you need. You can also later create a SmartDevice Cab project to create an cab for your program.
It is quite straightforward...try a simple hello world program to get used to it.

Creating a WM Application - Where to start ?

I hope this is the right place to put this, if not, mods, feel free to remove and/or delete it. I've dabbled a bit with C before, but that's about the extent of my programming experience. I'd like to create a program that will parse the information from a website and display it... I don't imagine something like that would be hard to do, but I have no idea what tools I would even need to start writing a PPC application.
Kitco (a website that gives live quotes of precious metals) recently came out with an application for the iphone that neatly formats all this information:
http://www.kitco.com/images/banners/KitcoiPhone/iphone.html
I'd like to basically create a PPC version of this application.
Is this something that an individual with next to no experience could hope to achieve ? I'd have to create a GUI, initialize the internet, connect and retrieve a webpage and remove the relevent information before displaying it.
Any help would be greatly appreciated. I've always wanted to become more familiar with these sorts of things and figured this project would be a great way of learning it.
Thanks!
ThreadMoved
Next to no experience? I dont think so. You have to have a little under your belt first and the only way to achieve that is to start readin right here!
I'm also interested in the expert answers to this question.
My very non-expert understanding is as follows:
VS 2005 (microsoft visual studio) can create executables for WM devices using a SDK (low level) or .Net CF (medium level) interface. You want to use .Net CF (compact framework) because it is supposed to make things easier. I think you have to use C++ to use the SDK but you can use C++, C#, or Visual Basic and write to .NET CF.
VS 2005 is an IDE (integrated development environment). It contains features to edit, compile, and even test your program using simulator/debugger. I think there are some non-microsoft IDE's that can also generate Windows Mobile code -- there is a market for cross-platform environments (e.g. programmers write code using a special library instead of the windows SDK or .NET function and the same source code can be compiled to run on Blackberry, iPhone, S60, Windows Mobile, etc...)
Instead of writing to the phone hardware (or .NET abstraction) directly, you can write your application using Java. You would use some Java compatible IDE (like Eclipse, Jbuilder, or NetBeans) to create Java applets that you download to your phone. You'd have to install a Java VM (virtual machine) on your phone to run these applets. I think the downloadable games for phones are Java applets.
Disclaimer: I haven't worn my "programming cap" since 2001 and hopefully things have gotten simpler. In my previous life I designed operating systems for mainframe computers.

[Q] Running 3.5 .net exe/dll unlocked mango wp7

Is it possible to run a .net exe on unlocked Mango (HTC HD7)? Or is it possible to launch a silverlight application from a native exe?
I can load/run my own native exe and dlls in /windows and they all work fine, but I can't get any 3.5 .net C# exes to run. When I call CreateProcess on the .net exe, the method returns TRUE and GetLastError is 0, but my logic in the .net Main() isn't fired (simple messagebox and write to file). I've also tried loading .NET dll but no luck there either.
Since the phone has .NET CF 3.7 I thought that 3.5 would work...but maybe not?
Thanks for any pointers.
Unless you specifically compiled for 3.7 compact, why would you assume it to work? 3.7 compact and 3.5 (full) are not going to be compatible with one another! You may be able to recompile your .NET programs against the version that the phone has, but I've never tried and have no idea how you would do that. You could try using the .NET environment for WinMo phones (same as you use the native environment for WinMo when writing native code for WP7), I guess - no guarantee it will work, though!
Out of random curiosity, are you checking the process exit code? It's very easy to do this, and it might tell you more. CreateProcess succeeding just means that the PE file is structurally correct and you have the permissions to execute it, nothing more - the program could fail or crash instantly and GetLastError would still be 0 for the program that called CreateProcess.
Launching a Silverlight WP7 app from native code is possible, though I'm not sure what the exact procedure is. You could try either launching it by GUID (try using ShellExec with the "app://" URI scheme, see the HKEY_CLASSES_ROOT registry hive for examples of using this scheme) or you could try launching it directly, by calling CreateProcess on TaskHost.exe and passing it the correct parameters (I don't know what the correct parameters are, but you could write a simple Silverlight/Native app that gets its own full command line, and then extrapolate from there to the command used to launch other SL apps).
Unless you specifically compiled for 3.7 compact, why would you assume it to work?
Click to expand...
Click to collapse
My fault, I should have specified, my 3.5 .net apps are CF apps. I would assume 3.5 CF would work on 3.7 CF.
Thanks for the other pointers.
Hmm... that does make it more likely to work, but even then I wouldn't count on it. Silverlight (for WP7 or otherwise) and XNA are not, even together, a full Compact Framework or super-set of it. Silverlight is available for OS X, and XNA for Xbox 360, but neither can run normal Compact Framework apps.
If you have information that indicates 3.7 *should* be a super-set of 3.5, then I agree that it ought to work. However, I'd be a bit surprised if that were the case.
Additionally, you may have noticed that the phone's DLLs are very different from those used on the PC and somewhat diferent from those on WinMo. It's possible this also extends to the .NET assemblies, and that while the classes you need may be preset, they might be in different assemblies.
Those are my best guesses as to the problem. I'd suggest trying to get the stdout/stderr streams from one of those apps, or at least get the process exit code, and see if you can figure out what is different or missing.

Categories

Resources