Hi Vijay555, you keep releasing amazing and useful utilities for WM5 / Universal, I have read many of your posts and note that you consider yourself almost a novice in programming C. What I would like is a list of the applications, tools and reference material which you work with when making your utilities. I too would love to write some small bits and pieces for the Universal and too save me the research and help me avoid any pitfalls you have come across, perhaps you can give us all an outline as to your particular setup?
Keep up the good work Vijay, we do all appreciate it!
Regards
gooroo: many thanks for your kind words.
Let me first say that I am an absolute amateur in programming on the Pocket PC. As I've said many times, there are many incredible guys (and gals!) on this site and it's a pleasure to know you all, but none of my little releases are anything compared to the stuff they bring into the world. Anything I say below is certainly full of errors, so take it all with a “pinch of salt”!
Second: I'm working very late in the office these days, but during the little free time I have, I am working on redesigning my website, hopefully to also launch a blog and ultimately a new forum (I don't host my current forum, and it goes down from time to time). The blog will carry an RSS feed to show when new releases are available, but also address the problems and lessons learnt that I encounter when programming.
But, to start you off, first some info about my “experience” or lack of!
My background is not as a programmer. I have played with computers for years, and am “self taught” in VB. Whatever anyone says about VB not being a real language, I say that it's still the best way to do quick and effective GUI based PC work. And with VB .net, it's as powerful as any other language. The kind of stuff I was doing with VB was about as far as VB could go, and I’d say it’s still a very competent language and a good one to learn from. I still program in VB daily, and built my own webbrowser in it, and I don’t use any other browser!
So, VB learnt to a reasonable degree. And I've written many little (and not so little) programs on the PC. However, after upgrading from a p900 to a Magician late last year, there were many small things that I saw weren't quite "right" with WM2003. I was quite pleased with the OS, but a few things that were clearly missing for it to be entirely satisfying. However, I was very pleased that it was a pretty “open” system, in that it was basically a system I could learn to program for. That’s the biggest difference between our phones and non-“smart” phones. Remember, it’s us that make smartphones smart!
So, I thought about using eVB, embedded Visual Basic, for the phone. But first there’s no guarantee it’s going to be supported in the future, and it relies on a “run time” to work. For anyone that doesn’t program, a run time is basically an interpreter that takes eVB code and turns it into code the phone understands, providing facilities in a kind of “library” of functions the eVB code can call upon. Although useful, this interpretation takes time, and so can be slower than non-interpreted code.
At this time I also had the pleasure of meeting a wonderful guy who works for Microsoft, David Goon. Although at the time he was showing off how amazing .net is, I asked him about the best way to start programming Today plugins (which was what I wanted to program at the time), and he said that C++ was still the most effective way. Although Today plugins can be written in .net, .net still relies on a kind of run time (called the Compact Framework) , and this can again slow things down.
Some background about .net: this is not one language, but basically an incredible idea for “unifying” languages. With .net, you can program in any language supported by it, including C++, VB, and many others (I understand there are about 20 languages or so!). These are all effectively “front ends” to a huge library of functions – the computer again “interprets” your chosen .net language into code it can understand. But what this means is that all .net languages have the same “power” since they all ultimately rely on the same “root” library.
Now, anyone learning to program should have a look at a few online tutorials and try to get the feeling for a language they like. All have strengths and weaknesses. As far as I’m concerned, I had no choice, I had to learn C++ for my Today Plugins. C++ is, as the name suggests, an extension of the C programming language (the name is a kind of joke only programmers could get away with. ++ in C means “increment”, increase by one – so C++ is C with a bit more!). But C and thus C++ are old languages! But it’s effective and powerful. It has been said that the vast majority of the Windows operating system has been programmed in C++.
So, why isn’t everyone programming in C++? Well, it’s not always the best way to do things, “new” languages are still being developed, and C++ has itself been expanded by Microsoft into a language called C# (C sharp). I can’t tell you about any languages other than my own experiences with C++ and VB. Maybe someone else can provide some details? But going from VB to C++, one of the biggest things to learn is about memory management.
VB allows programmers to be very lazy with memory. If you need some memory, you just ask for it in a rough way. In C++, at every stage, you must tell the system: “I need some memory. It needs to be this kind of memory. I’m going to use it for this long. It’s going to contain this kind of data”. That takes a lot of learning – you need to form a lot of new habits, and it’s easy to forget them, which can lead to crashes, or “memory leaks”, where you forget to “give back” the memory you asked for, so over time the system memory just “disappears”.
Because C++ is very strict about memory, it also helps it to be very precise, very fast and effective. C++ is faster than .net normally. But, one major reason why .net was developed was because of the memory problems. In C++, if you say “I need 10 bits of memory”, and then you try to put 15 bits into that space for some reason, what happens? It overflows. That overflow might not be noticed… but it might be overflowing into another important bit of information: like when you spill coffee on your white table cloth, you’ll notice it! This kind of overflow can cause major crashes, and it’s a favourite way for hackers to crash your operating system or server, put viruses onto your system, or run pirated games on your xbox. It’s an exceptionally useful technique to learn for that kind of hacking, but ask me about that another time…
So, “buffer overflows”, as they are known, are bad. And C++ makes it very easy for a programmer to allow them to happen if he’s not careful. And that causes crashes etc. Who’s to blame? Normally the programmer! But .net and some other languages are designed to catch this kind of stuff. They are designed to prevent these kinds of accidents to make it much harder to cause problems outside of your own programming. This makes the operating system more stable. So .net is good, at a cost of some speed. On your PC, that’s not important, your PC is fast. But your PDA is never fast enough, is it?
The kind of stuff I’m programming is called “Win32”. As the name suggest, Win32 is part of Windows – it relies on the Windows API – Application Program Interface. This is a set of functions the operating system provides to “do stuff” with the operating system. This can be things as simple as putting “…” on the end of a bit of text, or as complicated as logging onto a network and sharing files. You could technically skip Win32 and program these things yourself, but it would be very tedious, and not always compatible between one system and the next one. Software that uses the Windows API should work on any other system using the same APIs.
Note: The operating system on our phones is currently called Windows Mobile (it’s been renamed a few times!) which is basically a version of Windows CE, an operating system used in various types of “embedded devices”, like set top boxes, cars, shop tills and so on.
I’m using Win32 and C++ to do pretty much everything I do on the Pocket PC. There are “extensions” that work on top of Win32 to make things “easier”, eg MFC, the “Microsoft Foundation Class” Library, but my advice is learn Win32 before learning these extensions. It’s always best to know how something works under the skin before dressing it up. So, whatever language you’re learning, I suggest you become familiar with the way Win32 works, if you’re doing operating system type work. It’s incredibly boring, but a skill you’ll keep for as long as you program on Windows. The PDAs have a “subset” of the full Windows API, but much of what you learn will work on a PC and a PDA. The best ways to start learning Windows API is, in my opinion, to browse the MSDN – the Microsoft Developer's Network. This is an enormous collection of information on pretty much everything Microsoft does. I couldn’t code without it.
The second best way to learn Windows API, but also extremely useful, and essential, is to download and review the Pocket PC SDKs (Software Development Kit). These contain information necessary to learn about how to program for that particular device. You can choose which SDK you download – one for Pocket PC 2003, or Windows Mobile 5. I suggest that if you’re learning C++, you should start with the PPC2003 SDK and then move to WM5. You might as well learn to program for both, but if you only learn about WM5, it might not always be compatible with PPC2003. But PPC2003 is almost always compatible with WM5 (since the newer system has expanded the “old” one). And there are still a lot of WM2003 users out there! SDKs on MSDN.
Another good reason to learn C++ is because the programming “environment” you need is basically free! Microsoft makes eVC – embedded Visual C++, available for free from here. Again, whatever you’re programming, free is always a good price, so you might as well download it and start playing! It’s a 200mb+ download, but it contains lots of information for you to start learning.
To properly develop for WM5, and if you’re going to develop in other languages, then you’ll need to get hold of Visual Studio 2005. It’s a very nice environment to program in, particular if you’re using .net. The C++ environment is a much more basic, it doesn’t have a lot of the incredibly useful things built into the .net programming environment, but it works! And if you program in C++, you get used to pain And of course, VS2005 also allows you to code for the PC in the same environment.
Ok. So, at this point you’ve chosen a language, chosen a programming environment, and are ready to start learning to program. My advice now is to stop! Don’t touch the computer - go to a book shop and buy a book, a paper book, not an ebook, on your chosen language, and start reading it. I find holding the tangible book in your hands a much more reassuring way to learn and absorb since you can see how much you’ve got through and how much is left, and it’s very quick to jump from one section to the next. Most programming books come with an electronic version as well, so it’s even better (tip: most ebooks can be converted into a version you can also read on your PDA, so they’re great for long train journeys! Contact me if you need help with this).
For C++, I’m still extremely new, so I started off with “C++ for Dummies” by S. Davis. I’m sure other people would recommend other books, but I’m a Dummy, so it was very useful to me. In some places it’s a bit too brief, in others it’s too detailed. But you’ll learn at least the basics and a bit more, and be ready to move further. It’s a very good place to start! Amazon Link
Next, I suggest looking at the SDKs. They come with many example programs to demonstrate various ideas, and they’re an invaluable resource. At this point, you should also get hold of a PocketPC/Windows Mobile specific book to learn how the operating system works. “Programming Windows CE.NET” by D. Boling is probably the best way to start; he’s extremely readable and this book is excellent. (He writes a lot of the PPC stuff on MSDN!) One thing to note: it’s all non .net C++, despite the name, except for a few pages at the very end. If you want a .net reference book, get a .net book, not this one! But this book is never-the-less essential for anyone learning to program for Windows CE. Amazon Link.
I also recommend “Windows CE 3.0 Application Programming” by N Gratten and M Brain. Not as big as “Programming Windows CE.NET” but more detailed in some areas, less so in others. Amazon Link. If anyone has this book on paper, please contact me.
Ok, at this point, like me, you’ve spent a long time reading and reading and reading. Now start some coding! Learn to program “hello world”, and from there, the sky’s the limit. The website PocketPCDN will be extremely helpful to you. XDA Devs is an astonishingly useful tool for programmers and for learning good and bad habits for coding. I recommend you read every post written by the geniuses on this board. You should already know who they are :wink:
Modaco is also a very good place to search Newsgroups etc.
When you start really getting into this Windows CE programming, you may want to download the Platform Builder trial from Microsoft. Platform builder is basically the tool used by our phones’ manufactures to prepare the ROM and systems we use. You could do the same if you wanted to, but would have to write the drivers etc for the hardware. But it contains an enormous amount of code for the internal workings of Windows CE.
I’m absolutely no expert. I have no experience beyond what I’ve mentioned here. However, programming is extremely time consuming and takes a perverse dedication to a goal. It’s very rewarding when people say your code is helpful to them, because only you can really appreciate how much work goes into it! It’s helpful to be able to survive without sleep, to dream about coding and have the kind of mind that can take problems apart, and hates to give up on a challenge. I recommend that everyone should have some basic idea about coding – for guys, since we can’t create life, creating code is about as close as we get to Eve’s Burden!
I hope this information is helpful! Please comment with corrections, questions and your own helpful advice.
V
PS – if anyone wonders why I’m so egotistical about calling all my programs VJBlahBlah, it’s because I write a lot of Macros to expand Microsoft Word. But for some incredibly silly reason, the Macro dialog in Word has been non-resizable for at least the last 12 years. And when you have a lot of long filenames, it becomes almost impossible to find them. So all of my macros will always be in approximately the same place on the list..
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
A very useful insight into programming vijay555
Vijay, fantastic! This was exactly the reply I was hoping for, hopefully this will inspire others to really get to know there PPC's I know it has for me! I do come from a programming background, the remark of dreaming about coding made me smile, I know exactly what you mean. I have gone to bed in the past thinking about how best to write a piece of code, only to wake up with an amazing, simple and elegant soloution. The links were the icing on the cake btw, thanks again!
Regards
i used to learn vb and c++. I have problems with understanding the use of different syntax and other indepth functions. VJ you are right, it's easy to forget.
thanks for this intro. It enlighten me again to go back to learn about it.
VJ - NEED title bar On/Off for BT, Wifi, Phone!!!
VJ, oh God of that which allows few keypresses...
OK, now that the sucking up is over... ...
I would love to have separate On/Off toggles for BT, Wifi & Phone, w/o having to go to the Wireless Manager screen. I would hook these toggles up to hardware keys in an ideal world.
Any chance you can take on this challenge? It seems that your utilities would allow this kind of functionality (or have you already done this?)...
Thank you!
3Space:
You can make requests for (easy) programs for me to write on my forum. The GPRS app has already been asked for, and I got about half way through and then got distracted by VJBigPhone a while back. Have to finish that.
There is a bluetooth toggle available somewhere. If you can't find it on here, check out www.pdaphonehome.com, it's definately on there. However, I will develop all three at some stage, and when I do, I'll post on here in the usual manner
V
ok, thanks VJ! I didn't think to look for individual applets for each of these, but better than nothing! Looking forward to the VJ version tho!
Guys, does anyone have a copy of the CD that came with
“Windows CE 3.0 Application Programming” by N Gratten and M Brain? My second hand copy came without.
What a name, M Brain. So fake! "A. Genius" "N. Arcissist"...
V
Hi Vijay, hope this helps buddy, least I could do
http://www.nickgrattan.net/Books/WinCE3main.htm
Regards, Simon
Doh, I'm so stupid!
Thanks a gazillion Gooroo. Now to get the "other" app
V
The eMbedded Visual Basic is available from MSDownloads, with the CD Key for free if thats what you are after, eMbedded Visual Tools 2002 is the one I downloaded.
Regards
Cheers Simon. I'm ok for VB, I'm all C++ for now...
Thanks though!
V
And the M stands for Marshall. That really is funny! One of my favourite joke names is R Sole...
Only just seen this one vijay. I like your long post about programming. Really good, inspirational stuff.
Hi Melty.
inspirational stuff
Click to expand...
Click to collapse
Our chat some time back was inspirational, kept me programming!
I like your info on my Frappr page How's the gambling going? You still working for a living? Get your a$$ to the gym...
V
Hi Vijay, Our chat was inspirational to me too. It's always good to find a kindred spirit (or fellow lunatic)!
The gambling is not going so well at the moment. Well, more watching than doing at present, so no money lost. Once it's ready then I will definitely be giving up the day job and spending more time on the fun things in life, like programming and reading books and other geeky **** which I think is fun :shock:
And of course, apologies for not replying until now, but I was at the gym :lol:
question for registry access
hi @all,
i have the following problem: i write an application that should read some value from the registry from my wm5 device.
as IDE i use the eVC++4.
here come the code:
char lszValue[100];
LONG lRet, lEnumRet;
HKEY hKey;
DWORD dwLength=100;
int i=0;
lRet = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\ADOBE", 0L, KEY_READ , &hKey); // in this Line i get the following ERROR
/*
error C2664: 'RegOpenKeyExW' : cannot convert parameter 2 from 'char [15]' to 'const unsigned short *'
*/
if(lRet == ERROR_SUCCESS)
{
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
while(lEnumRet == ERROR_SUCCESS)
{
i++;
printf ("%s\n",lszValue);
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
}
}
RegCloseKey(hKey);
has anybody an idear why this code not compile?
thx for help
bye
I'm just rushing off for lunch, but at a quick glance, why aren't you using Unicode strings, eg TEXT("SOFTWARE\\ADOBE")?
V
@vijay555
that parameter 2 not correct is i'm see too. but why?
I have barely developed anything since the BASIC days on the C64 and Amiga, and now feel inspired to create some financial applications for the Australian market - such as superannuation projections.
How hard is it to develop? A few standard calculations like you would see on a spreadsheet would work, with some graphing.
Most financial applications I have found are pretty basic and don't account for inflation in rising wages and fees, etc.
I believe I could attract at least a dollar for a well developed application for superannuation alone.
I have installed the Android 2.2 SDK and have no idea where to start. I presume this is some sort of emulated Android device I can test my applications on.
Are there any tutorials on how to get started? What's the development language?
All I need to do is create a simple text interface to input a few parameters to run some complex financial calculations on the back end.
A really sophisticated application would pull live interest rates or other data and enter that in.
Start with this:
developer.android. com/resources/tutorials/ hello-world.html
(take away the spaces, I cant post links yet )
These are all great tutorials that will walk you through the basic processes and applications/layouts. The only issue you will have is when/if you decide to go through the "Tabs View" tutorial, there are a lot of errors in the code, and I have no idea why no one have changed it, but you can PM me for the correct version.
If you want some basics on Java, just do a google search, there are a lot of great tutorials out there for beginning Java. I recommend doing this first, just so you have a good understanding of Java(which is the development language), it will *REALLY* help out. You can incorporate other languages, but for the time being, stick with Java.
Yes, the SDK comes with an emulator so that you can test your programs without having to install them on a real device. In addition to what Jimmy said (and I can't stres highly enough that you should start with the Android Developer's website and tutorials), you can go to Stack Overflow which is a programming Q&A website. People there are generally very helpful, as long as you've shown you've actually put some effort into solving your problem before you posted your question.
Fair enough... So it's basically about learning to programme for Java? How hard would it be, realistically, for someone with no application development experience?
You need a basic grasp of objected oriented design & programming, along with an understanding of the Java language. When it comes to gui aspects & all communication with other apps/data on the device, you have Android, rather than the usual Java class libraries such as awt or swing.
How hard? It's doable, imo, but will depend on aptitude. Start with Java & then add in Android when you feel like more material to get your head around.
So basically getting started requires me to learn application development like on any other platform, in OO and Java. I may as well do a course or something then. Would a few weeks doing some sort of intro course help?
I'm sure an appropriate course could be very helpful. Though I'd steer clear of those short courses claiming to turn anyone into a valuable skilled programmer in only xx weeks, if only because the tutor will probably know less than you on the subject. Better one which makes credible claims regarding its introductory nature. A couple of degree level intro modules on OO or Java should be of help.
Hey, <insert request that you ignore the fact that I have no clue what I'm doing/am a noob here> I was wondering if it's possible to create a watch face background that changes based on the card being previewed, similarly to the "simple" watch face that came as a watch face for the moto 360. If it is possible, are there any guides, resources, etc. that you guys could point me towards, or if someone has recreated that face or a similar one and the code is available that would be fantastic.
Thank you all very much!
Note: while I really appreciate any and all help, I'm relatively inexperienced with programming, and entirely new to programming for android, so explanations will likely confuse me; developer resources or tutorials, or even better, sample code, would probably be a lot more helpful, so I can jump in and start changing things, or dig through the syntax and stuff as some sort of context for the code I'm looking at (I'm more experienced with graphic design and have just started to get into programming outside of basic stuff with C#, VB.net, and python).
BioToxic737 said:
Hey, <insert request that you ignore the fact that I have no clue what I'm doing/am a noob here> I was wondering if it's possible to create a watch face background that changes based on the card being previewed, similarly to the "simple" watch face that came as a watch face for the moto 360. If it is possible, are there any guides, resources, etc. that you guys could point me towards, or if someone has recreated that face or a similar one and the code is available that would be fantastic.
Thank you all very much!
Note: while I really appreciate any and all help, I'm relatively inexperienced with programming, and entirely new to programming for android, so explanations will likely confuse me; developer resources or tutorials, or even better, sample code, would probably be a lot more helpful, so I can jump in and start changing things, or dig through the syntax and stuff as some sort of context for the code I'm looking at (I'm more experienced with graphic design and have just started to get into programming outside of basic stuff with C#, VB.net, and python).
Click to expand...
Click to collapse
Hey BioToxic! Nice to meet you.
I am porting a friends Watch Face to Android. I can tell you that it is entirely possible, you can pretty much modify and manipulate the background to anything of like. I've been working in the Watch Face environment for a few weeks now and have a good solid understanding of how it works (previous knowledge helped, of course)
There is a lot of Java coding involved, if you are not familiar with that or familiar with how Android works it might be tough, you'll be writing code and not understand how it works.
A good starting point would be looking at the classes available in the WatchFace API.
[developer.android.com/reference/android/support/wearable/watchface/package-summary.html
Another good starting point would be getting your feet wet with the emulator, or better yet an actual device. Play around with the sample modules available.