How To develop a Tool for PPC - Windows Mobile Development and Hacking General

Hello,
in our company are a lot of Windows Mobile Devices in use. These should like our Client PC's listed in OCS Inventory.So, i'll try to develop a OCS Agent Client.
Functions needed:
-read out hardware Specs
-read out installed Software
-read out User Name
-send this Information over Port 80 to a Server
-nice to have: run as Service and auto send this information to the Server
Tools I've got:
-Visual Studio 2008
Skills I've got:
-writing c++ console apps
What I need:
-a Tip which programming-language I shoul use
-Some links where i can find the the functions in this language which I need
What I've done:
-search in xda-developers.com
-search in MSDN(but I don't know which language i should use)
-wrote small (stupid) apps like an calculator for ppc in visual basic as little test
-I tried to do the same in visual c++ -> without any good product, i don't know how to make a gui for the functions.
I hope you can help me, espacially in the language thing.
Thanks,
Flo

some good reads about many of your questions
http://forum.xda-developers.com/showthread.php?t=245426&highlight=develop
http://forum.xda-developers.com/showthread.php?t=225177&highlight=develop
http://forum.xda-developers.com/showthread.php?t=349808&highlight=coding
http://forum.xda-developers.com/showthread.php?t=269142&highlight=coding
http://forum.xda-developers.com/showthread.php?t=226603&highlight=coding

Thanks a lot!
I think I'll try to use Visual Basic.
One Question further: where I can find the Commands I need to read out the Information out of the Device.

Hi,
VB was good for the first steps, but after reading in msdn i decided to use Visual c#(a can use c++ although but i think c# is better for this!?) instead.
So, registry Values i can read out. But all the other stuff....I don't know how to get this out. "You should use the API functions" i read every where, but that helps no step. I don't know which API and i don't know how to speak with it.
I hope you can give me some Tips or links.
Thanks

thanks for your help so far *:-/
IMEI,Owner,Hardware(bluetooth,Phone,Wifi,Camera) is detected....
My Problem now is: CPU Speed
I didn't found a registry entry with the Speed in it, so i need another function. Some ideas?
Im using C#...

One more Question:
Where the "Settings->System->Deviceinformation->Hardware"-Window gets its Information from?
Hope someone will answer.
Thanks.

Related

Questions concerning programming with WM 5

Hello!
Does anyone of you know which dll's I have to use to get the following information:
- the net the sim card is booked in
- states of my GSM unit
- states of my telephone unit
Can anyone help me getting these information or tell me where I might find them?
Thank you very much in advance.
Monty
On Wm5, state and notification broker. No dlls required.
Please move your question to the development forum, for better responses :wink:
V
Sounds nice. But there's a problem: we do not only use WM 5 Pocket PCs. Many of our devices use Windows CE instead.
Do you know which P/Invoke I have to use?
If you're definitely not using WM5, but WinCE, then it's a hell of a lot more trouble. You need to use TAPI generally, this will give you answers to each of those queries.
I don't use Managed Code, so check out www.opennetcf.org/
If you're using Compact Framework, there may well be managed libraries to get access to this stuff easily.
Native Code ≡ Pain
V
I checked the library on opennetcf.org but it doesn't seem to be very useful. Is there any way to find out the functions compiled in the API dll's? I'm sure Microsoft offers a way to get the wanted information. But I cannot find it

WM5 applications

How to write a WM5 application?
I installed all necessary things, but i cannot find reference on develop those things in MS...
Any simple tutorial i can learn from web?
Have you installed the sdk? Many example apps + code on SMS.
V
what is SMS?
Sorry I misread. You said MS - you mean Microsoft?
Same applies. Search this forum - you're not the first person to ask this question and several people have given thoughts.
Get the sdk and read and read!
V
i have searched the forum but get nothing.
i installed all necessary software, sdk.
the only thing i want to know is the function library...
pls help.
Define 'all necessary software' please.
What IDE you are using (VS 2005, eVC)?
The search function on this site is lousy, so I recommend you search through google with the site:www.xda-developers directive.
The (very) short version of it is:
For VS 2005 - create a smart device project
For eVC - Create any project with Pocket PC / Pocket PC 2003 SDK
All necessary libraries will be added automatically by the wizard.
there really is no simple answer to your question
only more questions
do you wanna do it in .net ?
if so do you wanna do it in c# or vb (dog forbid! ) or c++
do you wanna do it in microMFC ?
do you wanna do it in pure win32
developing for pocketpc's are 99% the same as developing for a normal pc

Coders new to WM5 "help" (advice)

Hi,
I have a fair background in various coding languages, and there are a couple of programs I want to try and build.
However, while I can usually pick up and understand a language quite easily the problem I usually find is a lack of knowledge of the objects available to make life easier and the functions which are available.
So far, I've sat around and got a setup which I think should allow me to write and compile WM5 applications and today plugins, but I have suddenly found I am missing that "thing" that made writing in other languages easier - effectively a "Cheat Sheet".
What I would appreciate from the other coders with experience in writing software for WM5 is a list of what windows or books you have open for reference when coding. Is it just MSDN, is there a specific page that you have bookmarked or do you just google for it every time?
Any further advice (like good compilers I might have missed) will also be greatly appreciated.
Thanks in advance.
I'd like to hear from others too about this..
So far, My buddies for development help have been:
1. Search in MSDN
2. Search in Google
3. Ask on xda-developers
4. Search in MSDN forums and usenet groups for pocket pc developers
5. A book (that i dont refer to too often) whose name goes smthing like "Programming for Microsoft Windows CE .net" by Douglas Boling (Its not for .net development, it covers native development mostly. Windows CE .Net refers to a version of CE)
6. I also have another book that i have not even opened till now. It is solely for .net development (which is not my forte). Its by Wrox Publishers. If I remember the name correctly, it goes smthing like "Professional Microsoft Smartphone Programming"
There is an exellent documentation on .NET & Native Code on MSDN.
Then there are samples as well, again on MSDN.
For a today plugin, there is a very good sample by levenum which u can easily find in this section of the forum.
For me its always been google & this forum, no boooooks !!!
or
www.codeguru.com
in most cases programming for pocketpc's is like programming for pc's
Thanks for the replies guys. I see what you mean, MSDN is rather good. I was beginning to think it was just WM6, but I eventually found the section on WM5 (which I am planning on coding for given my phone is WM5). Their Wiki also had some good info on it too. Don't know whether these will be my coding buddies yet though....
shantzg001 said:
I'd like to hear from others too about this..
Click to expand...
Click to collapse
I'm glad someone else is interested. TBH I am surprised there is not a sticky at the top of the forum with this information in or a link to the Wiki for further details, but I could only find details of Development Tools on the wiki.
shaileshashar said:
For a today plugin, there is a very good sample by levenum which u can easily find in this section of the forum.
Click to expand...
Click to collapse
Thanks for this pointer. I found two (here and here) which look promising. Don't know if there are any I missed....
Just a small tip when searching in MSDN... add ce in the search pharse. For e.g., "ce WM_TIMER" will give you the CE related sessions at the top.
I like www.pocketpcdn.com - articles and code examples for Pocket PC and Smartphones arranged by categories.
Also www.codeproject.com has been helpfull at times.

advice for beginner developer :)

I have Visual c# and Visual basic development environment and I want to try my chance in developing small tools for WM6.
I am looking for advice on how to begin developing.
What is required to develop WM6 software ? How can I write a "hello world" code in basic steps ?
Thanks...
also, which version of Visual Basic or Visual C# would you recommend for this ?
Visual Studio 2005 will do the trick.
After that, get the SDK for your intended platform. WM2003,WM5 or WM6. And create a new project, select VB and look for your target device environment. Create a form based application, double click the form, and in the formload sub add this code:
Msgbox("Hello World")
This will pop up a message box saying hello world. I wasn't incredibly detailed, since I'm assuming you've done some software development on different environments before, correct?
thanks.
you really did explain enough to begin. I believe I can handle it.
just one question:
where can I get the WM6 SDK ?
http://www.google.dk/search?hl=da&q=WM6+SDK&btnG=Søg&meta=lr=lang_da|lang_en
finally I have the environment set up.
first basic tries (hello world, simple calculations etc.) were successful.
Then I went to "How Do I" pages of Microsoft and tried some advanced teaching examples.
I have a little problem with WM6:
I couldn't get the following value to a greater value than 0 no matter what I 've done:
Microsoft.WindowsMobile.Status.SystemState.ConnectionsNetworkCount
or
Microsoft.WindowsMobile.Status.SystemState.ConnectionsCount
I have activesync and wlan connected; I even connected to gprs but this value is always 0.
any idea ?
is it different on some devices ?
I still couldn't figure out where the problem is.
I think I am using a wrong system property but which one is the correct one ?

Getting into WM5/WM6 programming?

I am interested in dabbling a little in programming for my Kaiser. I have programming experience, mainly php / mysql, though I have done some C and lots of scripting in my time. My biggest project so far though was an open source google maps mod to put on your website - thousands of lines of php / js code, mysql backend and AJAX tieing it together, some graphics routines etc, so I am no drooling n00b when it comes to coding.
How easy is it to develop basic stuff in WM?
I have access to MSDN, so I can get Visual Studio (2005 for sure, maybe later versions), so I think I have access to the apps I would need. I just ordered some books to help me along, but was wondering if I would likely face a steep learning curve.
All the stuff I want to do is today screen plugins - was thinking of having a bash at writing my own quick contacts plugin - *very* basic - just a vertically scrolling list of names over a transparent PNG button with maybe photos from the address book - I want it to be able to scroll by vertical gesture within an ultimatelaunch tab - is this likely to be quite easy and quite a good "first app" to program?
I was also looking at writing a lite repacement for phoneweaver as the only feature I use is to turn on BT when it detects power but no activesync (ie auto turn on BlueTooth when I am in the car and the device is cradled) - maybe a hack to force the keyboard backlight on in the same situation.
I have bought:
Microsoft® Visual C#® 2005 Step by Step (Microsoft)
Microsoft® Mobile Development Handbook [Paperback] by A. Wigley; Daniel... (Microsoft)
Comments / suggestions?
I would also be very interested in a thread or good reference on how to start to program app for mobile gadgets. Actually i'm a Delphi coder, and i would like to implement some applications on WM platform, but when i search over internet there's plenty of information, but no usefull information with "real-life" recomendations.
depend on the platform and language one wish to use really
there is c#.net, vb.net c++.net
c++ miniMFC, c++ PureWin32 sdk
oldVB
...
here are some other posts asking pretty much the same thing from the forum
http://forum.xda-developers.com/showthread.php?t=225405&highlight=programming
http://forum.xda-developers.com/showthread.php?t=237932&highlight=programming
http://forum.xda-developers.com/showthread.php?t=241670&highlight=programming
http://forum.xda-developers.com/showthread.php?t=245426&highlight=programming
http://forum.xda-developers.com/showthread.php?t=228043&highlight=programming
http://forum.xda-developers.com/showthread.php?t=317913&highlight=programming
http://forum.xda-developers.com/showthread.php?t=302548&highlight=programming
http://forum.xda-developers.com/showthread.php?t=327164&highlight=programming
http://forum.xda-developers.com/showthread.php?t=305926&highlight=programming
http://forum.xda-developers.com/showthread.php?t=336251&highlight=programming
http://forum.xda-developers.com/showthread.php?t=226412&highlight=programming
codeguru.com got examples of various windows mobile programs too today items and such
about delphi i dont know if anybody got some info i would say borlands site
Thanks rud. I was aware of various other posts, but my question was more of a "How steep is the learning curve?" rather than "How do you do it?".
There was also an element of "How do you do it?" insofar as there seem to be better or worse ways of going about various kinds of app (eg today apps with gesture support) which I am finding a bit of a minefield, but I feel that the new post was valid because I am giving an indication of my experience level and what I am trying to acheive - none of the posts you listed cover the combination of stuff I am trying to do. Reqs like pulling from outlook db and allowing gesture scrolling in a today plugin, I dunno, I may waste ages with C#, for example, only to realise it is a breeze with C++... I also note that a google search for wm programming gesture scroll today screen currently ranks this very thread #5. By tomorrow that'll be a googlewhack then.
Yes, there are various posts about how to get started, but I think maybe a sticky would be in order with a bit of info on the various paths - the vb/c++/c# options are quite bewildering - stuff like
levenum said:
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.
Click to expand...
Click to collapse
is really useful, maybe if it were expanded upon, info such as for this route you need visual studio, etc, etc it would make a really good sticky for the dev section.
evilc said:
I am interested in dabbling a little in programming for my Kaiser. I have programming experience, mainly php / mysql, though I have done some C and lots of scripting in my time. My biggest project so far though was an open source google maps mod to put on your website - thousands of lines of php / js code, mysql backend and AJAX tieing it together, some graphics routines etc, so I am no drooling n00b when it comes to coding.
How easy is it to develop basic stuff in WM?
I have access to MSDN, so I can get Visual Studio (2005 for sure, maybe later versions), so I think I have access to the apps I would need. I just ordered some books to help me along, but was wondering if I would likely face a steep learning curve.
All the stuff I want to do is today screen plugins - was thinking of having a bash at writing my own quick contacts plugin - *very* basic - just a vertically scrolling list of names over a transparent PNG button with maybe photos from the address book - I want it to be able to scroll by vertical gesture within an ultimatelaunch tab - is this likely to be quite easy and quite a good "first app" to program?
I was also looking at writing a lite repacement for phoneweaver as the only feature I use is to turn on BT when it detects power but no activesync (ie auto turn on BlueTooth when I am in the car and the device is cradled) - maybe a hack to force the keyboard backlight on in the same situation.
I have bought:
Microsoft® Visual C#® 2005 Step by Step (Microsoft)
Microsoft® Mobile Development Handbook [Paperback] by A. Wigley; Daniel... (Microsoft)
Comments / suggestions?
Click to expand...
Click to collapse
Hey!
Congrats on getting your hands on with Windows Mobile...
The easiest way is to download Visual Studio 2005(2008 You have it on MSDN) - and create a new application with it.
It's sooo easy if you know your object oriented programming, as long as you want to create ordinary "office" applications... But if you want to do more advanced things(like creating a today-plugin) you need to go over to c++(even though you can download a .net home-plugin-container which acts like a "loader" for your plugin written in c++) - and also, if you want to create good GUIs, I think you are better off with c++... But then again, I think you need a bit more effort in learning c++ then using c#...
Hope this helps...
Still slogging my way thru this...
I got hold of an MSDN disc, first off I installed visual studio 6 - bad move.
Had to uninstall before trying to install VS 2005, now I think it has screwed something up, every time I try and create a "Smart Device Win32" project, I get a "Project creation failed" error. I may have to re-GHOST my OS to get rid of it
So much time just finding out what apps I need and what options to choose to start a project...
I found http://channel9.msdn.com/wiki/default.aspx/MobileDeveloper.HomePage which seems helpful
Thanks for responses!
Evilc, you link of msdn is excellent point, many thanks!
I have also just started programming in C++ ..i dnt have any knowledge of any type of codes..i learned every thing frm MSDN libraries ( i have many many of them caz i have VS 2006 VS 2005 and VS 2008 )..i recommend you to work with C++ because it uses less system resources and is fast..hope this helps..check out my Kitchen coded in C++ ( link in signature )
Yeah, I think C++ is definately more what I am looking for from what I have learned thus far.
Re-Ghosted OS - totally fresh XP SP2, installed Visual Studio 2005, still the same error. GRRR!
Visual C++ --> Smart Device --> Win32 Smart Device Project == "Project Creation Failed"
Other Languages --> Visual C# --> Smart Device --> Windows CE 5.0 --> Device Application == Project created OK.
Some posts I have found on the net say it is an IE7 issue, I may try uninstalling that or flashing back to an OS image with IE6 only, but this is really winding me up and taking a *lot* of my time...
I uninstalled IE7 and the problem went away. Woohoo!!
starting programming windows mobile
hello
1. see my web site.
2. see my book recommendations, especially the 'programming windows ce' by douglas boling. It has an example for many things and a today sample too. Most is based on visual c++ 3.0/4.0. Embedded Visual C 4 can be loaded free of charge at ms.
regards
josef
Nice site, thanks.
The windows mobile 6 sdk actually has a today screen sample, along with samples of most of the things I need to do.
neofix said:
It's sooo easy if you know your object oriented programming, as long as you want to create ordinary "office" applications... But if you want to do more advanced things(like creating a today-plugin) you need to go over to c++(even though you can download a .net home-plugin-container which acts like a "loader" for your plugin written in c++) - and also, if you want to create good GUIs, I think you are better off with c++... But then again, I think you need a bit more effort in learning c++ then using c#...
Hope this helps...
Click to expand...
Click to collapse
Are we using the same language?? Cos this (C++ Win32 for Mobile Devices) is by far and above the most difficult programming language to get into that I have ever tried. Yes, worse than ASM.
Trying to code an app that prints "Hello World" has taken me over 5 hours with no success yet - most languages I have a go at it's 5 minutes.
From http://msdn2.microsoft.com/en-us/library/ms901121.aspx :
Code:
int DrawText(
HDC hDC,
LPCTSTR lpString,
int nCount,
LPRECT lpRect,
UNIT uFormat
);
It gives a brief description of what the parameters are, but absolutely no examples and no explanation of what all the parameters do or how to initialize them, so even browsing an example is no use to me.
u can simply try
MessageBox::Show(" your message ");
ather90 said:
u can simply try
MessageBox::Show(" your message ");
Click to expand...
Click to collapse
Isn't that .NET ?
I thought the consensus was that Native Win32 or whatever it is called was the better way to go?
This is part of the problem. I cannot even work out what to put in a search engine to pull out info on the right "flavour" of C and for the pocketpc. It's *so* bewildering.
Hello evilc.
First I noticed you have some trouble with VS 2005. It probably won't be easy now, but if you ever get to format your machine again don't install it (unless you absolutely need some other features).
For C / C++ programming for WM device I strongly recommend eVC 4 as it is much lighter and responds quicker. (It's a free download as well)
Second, though you can program for WM in C# and VB .NET which are both .NET Object based languages and are probably much closer in form to PHP and Java then C, you can not write system components such as today plugins in those languages.
You need native code so C / C++ is the only way to go.
(Actually, there is a trick to combine C# and C++ DLLs to create a today plugin where C# will do the main stuff, but its pretty complicated)
What you need is to learn basic Win32 programming and using the windows API. They are almost identical for Windows Mobile and Desktop windows versions so any book on Win32 should teach you the basics.
(Personally I started with MS book on MFC and studio 6 but I would not recommend it)
Finally:
I would gladly explain the parameters of DrawText but I am not quite clear on how much familiarity you have with the Win32 mechanics, since the languages you are used to obscure them unlike C which gives you extra power but also makes you work much harder to get anything done.
Do you know how to handle messages, and how windows manages all abjects using handles? Any familiarity with GDI?
If not, it will be pretty difficult to explain.
levenum said:
Hello evilc.
Click to expand...
Click to collapse
Hello! <waves>
First I noticed you have some trouble with VS 2005. It probably won't be easy now, but if you ever get to format your machine again don't install it (unless you absolutely need some other features).
Click to expand...
Click to collapse
I tracked down the problem when I got home and installed on my desktop. When doing it on the laptop, whilst installing SP1 for studio 2005, I had hit "Not Now" to a reboot request and it had said installation failed. When I installed SP1 on my desktop and said "Yes" to the reboot request, the problem went away, so I guess it was fixed in SP1 but the installer is a bit picky.
For C / C++ programming for WM device I strongly recommend eVC 4 as it is much lighter and responds quicker. (It's a free download as well)
Click to expand...
Click to collapse
Wish I had that advice before as I wasted a day messing around with an MSDN CD, trying to work out what to install and what not. So does the eVC 4 download include an IDE? If not, what do you use?
Second, though you can program for WM in C# and VB .NET which are both .NET Object based languages and are probably much closer in form to PHP and Java then C, you can not write system components such as today plugins in those languages.
You need native code so C / C++ is the only way to go.
(Actually, there is a trick to combine C# and C++ DLLs to create a today plugin where C# will do the main stuff, but its pretty complicated)
Click to expand...
Click to collapse
You don't have to tell me twice to avoid the bloatware ****e
What you need is to learn basic Win32 programming and using the windows API. They are almost identical for Windows Mobile and Desktop windows versions so any book on Win32 should teach you the basics.
(Personally I started with MS book on MFC and studio 6 but I would not recommend it)
Finally:
I would gladly explain the parameters of DrawText but I am not quite clear on how much familiarity you have with the Win32 mechanics, since the languages you are used to obscure them unlike C which gives you extra power but also makes you work much harder to get anything done.
Do you know how to handle messages, and how windows manages all abjects using handles? Any familiarity with GDI?
If not, it will be pretty difficult to explain.
Click to expand...
Click to collapse
No GDI Experience. I take it this would be the library of choice for drawing the screen of a today screen app? Stuff like the HTC Home clock or the new Face Contacts - they would likely use Native C++ and GDI? Doesnt strike me as something you would do with a form.
Also, anyone got the skinny on vertically scrolling by click-and-drag inside a today screen app? Just a case of enabling a parameter? Has to be coded manually? Best way to do it smoothly? If you have seen the Conduits Pocket Player 3.x browse list - how it "eases in" and "eases out" at the ends of the list, has inertia so you can "flick" down the list, the alphabetical bar instead of the regular scroll bar - is that all coded manually or is there an api or something that can help?
Thanks for the help!
I just noticed your apps in your sig - checked out LVM time - noticed there was source - wooohoo! I generally pick these things up by example.
All that code just for a (configurable) clock on one line - wow. Great though, a really good example of a today app - minimal enough in functions so it is easier to suss how it all slots together, but full featured enough (implimented example of an options screen - yay!) to show how to do various things.
And Gnu as well! Nice, this will be the basis of my first test project too I think - at least now I have a framework to test out what I want to do and how to go about it without having to work out how to code the basis of the application.
I thank you from the bottom of my heart sir.
I tried to build it in VS2005, but I got a
fatal error C1083: Cannot open include file: 'todaycmn.h': No such file or directory
A quick google search showed todaycmn.h was part of the SDK, I found the file, dropped it into the headers section of the project, but no joy. I will probs just try eVC.
Oh, and having developed a today plugin, maybe you can answer this one:
As far as I can tell so far, debugging isn't very easy with a today app - something to do with the fact that the dll is not releasable? Is this an issue I will come up against? I hope its not a case of "reinstalling" the app each time you want to test... I was thinking maybe along the lines of have it as a normal app for debugging, then make it a today plugin when you want to build to use it?
I dunno, probably trying to run before I can walk, my books shoulda been here today, oh well. Sorry for all the questions...
@evilc:
Are you using standard Win32 or MFC?
You may want to try using MFC since you get the flexibility of native development but with some nice class libraries that make your life easier.
As for click and drag behavior, that is usually implemented by handling the WM_LBUTTONDOWN, WM_LBUTTONUP and WM_MOUSEMOVE.
When you get wm_lbuttondown you set a flag that says the user is dragging. You use wm_mousemove to update the stylus position as long as this flag is set, then you unset it on wm_lbuttonup.
That's the basic idea anyway. Someone made a post about gesture recognition in this forum a few weeks ago with sample code. You should see if you can find that.
Managed Today Screen plugins
See:
http://msdn2.microsoft.com/en-us/library/ms839442.aspx
for some background on the concept.
And:
http://www.christec.co.nz/blog/archives/279
Outlines what I think is a very ingenius technique for managed today screen plugins.
For those of you that want an easy way to make a today screen app in c#. Chris did all the C++ work for you.
Also I forgot to mention that the SDK samples cover all most every application type you can think of. Most of the good ones are Win32 though.
Also, keep in mind that you can use P/Invoke from your C# apps to call native APIs. So don't let people tell you you need to use C++ just because you can access more api's. I will say that you should use C++ for games, or other apps that require high speed or advanced GUI's (it is VERY hard to do interesting gui techniques with C# and interop, trust me).
And finally, I would highly recommend using the most recent version of visual studio you can get (especially if you're using vista), unless your machine can't handle a newer version. I say so because visual studio gets more and more powerful as an editor with each new iteration and I personally can't go back after I get used to the new features they introduce. And the new versions are almost necessary if you're going to do .net development.

Categories

Resources