[Q] Running 3.5 .net exe/dll unlocked mango wp7 - Windows Phone 7 Q&A, Help & Troubleshooting

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.

Related

how to reboot from a WM user interface?

Hello the community
I would like to know how to perform a soft reset (reboot) from a WM user interface. Of course there is a lot of external programs and utilities providing such the functionality also, but I guess there should be a mechanism built in WM.
I am sure there should be a DLL responsible for that, so probably there is also a way to execute this DLL?! Something like Windows’ rundll.exe?
My device is HTC p3600/Trinity with WM5, but I think it doesn’t make sense.
Your advice would be much appreciated,
Br, Alexey
dll mean dynamic linked libary
which pretty much mean it's a lib full of functions that
other apps call you cant normaly just call it's functions from
the GUI
yes, I know what DLL actually mean
And that’s why I made a guess about a possible way to run DLL similar to rundll.exe
I would prefer using something like reboot.exe, but if such a program isn’t provided along with standard WM, I don’t mind using workarounds like running DLL, if possible.
Anyway, my question was not about real nature of DLL but the way how to perform a reboot using standard functions of WM.
Check out the SDK documentation, MS might have made a direct api to achieve this through a direct rundll type action, but the easiest way is just to code a tiny app and launch it, eg
http://www.pocketpcdn.com/qa/softreset.html
VJEschaton will reset in a variety of fashions.
V
Thanks
Is there a way to compile such a tiny application without installing any huge C++ IDE? Something like command line compiler downloadable thru a simple ZIP file?
shkaff said:
Thanks
Is there a way to compile such a tiny application without installing any huge C++ IDE? Something like command line compiler downloadable thru a simple ZIP file?
Click to expand...
Click to collapse
The C# compiler is free and can produce WM executables. The only problem is that you must instruct it to use the .NET Compact Framework libraries instead of the normal ones. I readied a guide when the last OS was WM2003. I don't know if it is still working, but actually I have no reason to think it won't. Just choose the right subset of files.
Here is the link:
http://www.jargoncode.it/tips/netcfcompile-eng.htm
If you want a C++ compiler... I don't know.

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.

.NET question

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......

Advice on a new hobbyist phone?

Hello XDA-dev community
For the past couple of months i've been thinking about getting a Pocket PC for a new phone instead of a Symbian Nokia [ah my old 6630, may she rest in pieces...]. Anywho, I think i've decided on the HTC Touch Pro / Raphael. At ~AU$600 it's the highest I was trying not to pay (i'm not rich), however it seems to be a pretty powerful and full featured device.
I do have a few questions I hope some of the kind experts/veterans here might be able to answer for me though
1) I written a few things in Java and PHP and other even-more-basic languages, but am interested in learning a new language with hopes to create software for both Windows PC and Windows Mobile. What choices do we as end-users have here? .NET is an obvious one [I own a copy of Visual Studio 2008 Pro], but are there any other languages of note?
2) From the Raphael specs on the Wiki here, it lists it as an ARMv6 architecture-based processor. This comes from the ARM11 family, which is the successor (I think) to the XScale family (ARMv5TE). Are these ARMv6 processors backwards compatible with 'XScale accelerated' binary builds of software? I.E., a PPC application has two versions for download/purchase - a 'Generic ARM Release' and an 'XScale optimized release' - would the Raphael ARMv6-based device be compatible with these XScale-optimized binaries? Or do ARM do things differently and ARMv6 is not backwards compatible?
3) Has anybody ever heard any rumors or made any talks about porting Android to the Raphael? Just curious. I'd prefer a Windows Mobile device (not a Linux user) but I can see all this OpenSource stuff does have a future... EDIT: Nevermind, I found the page at http://wiki.xda-developers.com/index.php?pagename=RaphaelLinux
4) How does the device perform with 3D-heavy applications? Does it make use of any sort of acceleration (I assume no, not like the iPhone for example).
OK thats all... thanks a lot for your replies, if there's anything else you think is worth mentioning to a soon-to-be-first-time owner of a Windows Mobile device, please do say so Cheers.
In reply to 2) VS 2005 Pro onwards targets code at ARMv4I, basically generic ARM processors also capable of running the Thumb (16 bit) instruction set. Thumb represents a limited set of ARM 32 bit instructions coded as 16 bit instructions. It allows much smaller code sections, but with megabytes of memory available these days who cares? If you code in .NET none of this matters anyway, as the code is created as IL byte code, the .NET runtime sorts it out.
If you code in Embedded Visual C++ 3 or 4 the target chipset is ARMv4. When you use the IDE to create the code on a WinMo 5/6 machine it complains that the target machine cannot run the code. It's lying, what it really means is it does not recognize the processor class. As it is ARM 32bit code only it will work.
It is not worth targetting the code for a specific, (read non generic), ARM chipset. You are just making a rod for your own back when it won't work on something else.
Thanks for the reply stephj. There will indeed be a bit of research for me to do as to which language and/or IDE I decide to choose to train myself in then it seems. Specifically though...
stephj said:
It is not worth targetting the code for a specific, (read non generic), ARM chipset. You are just making a rod for your own back when it won't work on something else.
Click to expand...
Click to collapse
...what I was referring to is - I've seen some freeware PPC software, mainly emulators, that have two versions - a 'generic ARM' one and an 'XScale Compatible' alternative version. On the ARMv6 based phones, assuming the software was released back when XScale was the newest ARM family, would both work on the Raphael? If so, which would be faster?
Obviously though, for a developer, creating the most compatible/generic code to work on the widest range of devices is the main focus - later possibly implementing optimiziations or hacks that are specific to a certain platform - but I'm just wondering if these already built, older 'specifically optimized' builds are compatible with the succeeded chipsets.
P.S. Do you know where I could find some resources on choosing between Visual C++ or .NET? I.e. pros and cons of each?
Thanks a lot!
jonusc said:
Hello XDA-dev community
...
1) I written a few things in Java and PHP and other even-more-basic languages, but am interested in learning a new language with hopes to create software for both Windows PC and Windows Mobile. What choices do we as end-users have here? .NET is an obvious one [I own a copy of Visual Studio 2008 Pro], but are there any other languages of note?
...
Click to expand...
Click to collapse
Since you have VS2008Pro, C++/win32 if you want fast and lightweight applications
"P.S. Do you know where I could find some resources on choosing between Visual C++ or .NET? I.e. pros and cons of each?"
.net pros
easy to get something running fast even if one is a n00b
got a lot of components meaning less time to develop
can be programmed with c# and c++ and even eeeeewww basic
.net con
slow as in sloooooowww
require one to install the framework if the app
require a newer version then what ones phone came with and the framework is pretty big
and people don't seem to have success with installing it on sd cards
compact framework is also limited in features vs. .net on pc so apps don't just port always
limited in features unless one do unmanaged code
c++ pro
fast
require no extre stuff
small in size and again fast
have access to every feature in the phone
c++ con
one have to do everything and that mean msg loop
and a lot of leg work just to get a dialog with a button
steaper learning curve
more risks of mem leaking
harder to debug as stacktrace is not just there
like on .net
Very nice, thanks for the replies guys
So from what I can gather, a basic .NET application would be ideal for RAD (quick and dirty), particularly GUI-centric applications, but tend to be bulky; whereas C(++) is a more native / low-level language and is thus faster, but very hardcore as most functions need to be done from scratch.
I should have assumed it's pretty much the same as a Windows PC
What about C++ versus C#? And does VS2008 have a decent API/IDE set for mobile development i.e. does it have many libraries for C(++/#) already included or are more easily available?
Thanks again for the answers guys... it's obvious i'm keen to learn about it, but i'm a little worried that someone like me going from stuff like PHP and VB to C might be biting off more than I could chew....? Ah well if .NET is gonna cause problems down the line, then I guess I have no choice
Don't bother with the C++ version of .NET, the casts that you have to make, to get it to work makes the code very hard to read, and besides it only compiles to the IL level anyway, it's just not worth the effort.
So, under .NET use C#, or VB if you prefer, there is not much difference between them, but in my opinion, C# is a bit more elegant.
Under C++ you have the choices of WIN32, ATL (Active Template Library), or MFC (Microsoft Foundation Classes), programming models.
WIN32 is the simplist but the hardest to code, the other two add progressively more objects to make things easier, but you need to distribute the run time libraries with them. A simple WIN32 app can be distributed as a single .EXE if the DLLs it already uses are part of the CE/PPC operating system.
PS When it comes to running code compiled for a specific ARM class on your device, just give it a go. If the CPU hits an instruction it can't run, it will throw an exception and stop anyway.
stephj said:
Don't bother with the C++ version of .NET, the casts that you have to make, to get it to work makes the code very hard to read, and besides it only compiles to the IL level anyway, it's just not worth the effort.
Click to expand...
Click to collapse
Fair enough. So C++ in VS2008 is a bad idea
stephj said:
So, under .NET use C#, or VB if you prefer, there is not much difference between them, but in my opinion, C# is a bit more elegant.
Click to expand...
Click to collapse
I thought VB was dead? Wasn't VB6 the last one they made? Or is VB just what they call generic/common .NET Framework apps? Anyway, yeah i've read good things about C#, especially compared to .NET in general. EDIT: Oh, .NET is not the program language but VB is *facepalm* I get it, nevermind
stephj said:
Under C++ you have the choices of WIN32, ATL (Active Template Library), or MFC (Microsoft Foundation Classes), programming models.
WIN32 is the simplist but the hardest to code, the other two add progressively more objects to make things easier, but you need to distribute the run time libraries with them. A simple WIN32 app can be distributed as a single .EXE if the DLLs it already uses are part of the CE/PPC operating system.
Click to expand...
Click to collapse
Ah, same as a Windows PC. That makes sense.
Thanks for the answers I think I might take a look at C sharp.
C++ in VS2008 is fine, use the smart device WIN32 ,ATL, or MFC models take your pick.
Sorry my mistake, the C++ .NET version is not available for smart devices. Its the three models above only.
After additional research, I don't really want to be tied down with the proprietary C# system. So is VS2008 a decent IDE for WIN32 C++ development on Windows Mobile? Or are there better alternatives?
VS 2005/2008 Pro takes some beating. After you have installed about 3 CD's worth of MSDN libraries all the help is on tap. The IDE also looks at MSDN online if you have an internet connection to see if there are any forums on the same topic you are inquiring about.
The code is generated as ARMv4I and can be tested/debugged on the images provided by the WinMo 5 or 6 SDK. The emulators are that good you only put it on your phone when you have tested it to death on the emulator.
EVC 3 and 4 use a previous method where the emulators run a x86 version of the code. I still use EVC 4 for code that has to run on anything, Windows Mobile 2003 for example.
It's all pretty proprietory, when it comes down to it, but I guess we're stuck with it.

Categories

Resources