Click here to Skip to main content
Click here to Skip to main content

Bubbles for Pocket PC

By , 13 Sep 2000
 

Bubbles about dialog

Introduction

Bubbles is a board game designed for use on the Pocket PC. The game starts with a board full of colored balls (called bubbles). Adjacent bubbles with the same color can be removed from the board. The more bubbles you remove in a turn, the more points you score. When you clear the entire board you get bonus points.

Bubbles was my first try to create a Windows CE program for the Pocket PC. It first used MFC, but I switched to ATL pretty early during the project. The game demonstrates how ATL can be used to create Windows CE programs with a small memory footprint.

Infrared support is one of the most appealing features of Windows CE, so I wanted to enable IrDA support as well. High scores can be transferred between CE devices (or Windows 2000) using IrSockets. It's relatively easy to use and the project contains some wrapper classes to enable IrDA sockets (nonblocking to avoid lockups).

During the development of this game I noticed that the CE environment isn't as mature as the desktop Win32 environment. STL and WTL are both missing. ATL for Pocket PC isn't as stable as its Win32 counterpart. The emulator locks up when you play several wave files after each other.

Bubbles game window

The most annoying bug is in the ATL handling of WM_INITDIALOG. Due to a very trivial error in this piece of code you are forced to override this method (otherwise SHInitDialog won't be called). If you want to call SHInitDialog yourself, then you need to override the method and pretend that you never did (otherwise ATL will call it again with it's own set of arguments). Very annoying and it took me a while, before I figured out that this was wrong.

Most Pocket PC applications allow only one single instance. If the application is started again it reactivates the first instance of the application. Despite 95% of the Pocket PC programs need this functionality there is no support in the API (or ATL) to accomplish it in an easy way. You need to register your own window class and when the application starts, you need to look for that window class. If it exists, then you need to bring the window to the foreground to activate the application again. Unfortunately, this doesn't work good when your main window wasn't the active window when you deactivated the application (i.e. a dialog was on screen). In that case the main window is activated and this causes some problems. The OK button of the dialog isn't visible. The dialog's OnActivate isn't called, so the SIP (soft input panel) isn't disabled, etc...

Despite these problems this game can serve as a good starting point for your own games. Game logic is separated from UI and highscore, options and about screens can be easily reused. I started writing a Tetris clone using this template and I hope it can be useful for you as well.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ramon de Klein
Web Developer
Netherlands Netherlands
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionhow to display a raw bitstream video?membersandeepp30 Mar '04 - 1:35 
Hi,
i am new to pocket pc application development. i want to know how to accesss the video buffer and display a raw video bitstream on pocket pc emulator.

 
sands
QuestionWhat should I do?memberIxCraZee27 Aug '03 - 2:36 
I am newbie in Pocket PC application.I have all SDK (2003).I use eVC++4.0 and do not know how to start.Can anyone tell me what should I do?
Generalstreaming video on Pocket Pc 2002memberVittoriosi9 May '03 - 23:32 
I realized an application that enable to watch a file.YUV video on Pocket Pc 2002.
On the Emulator is OK, but How may I run it on the real device?
GeneralRe: streaming video on Pocket Pc 2002memberPaul van der Walt14 Aug '03 - 3:46 
Ask in the mobile forum[^] Smile | :)
 
Paul Wink | ;)
 

Garfield.Bark();
---Configuration: garfield - Win32 Deworm---
C:\garfield.cpp(9) : error C2039: 'Bark' : is not a member of 'CCat'


GeneralXeXosussXeXo13 Oct '02 - 9:33 
"""" Which would be the best chance? PocketGL, PocketFrog, GADIDraw or another one? Could you please tell me what you think is the best? """""
 
Dear Friend,
 
I am from Spain and I have seen your article about pocket frog on this web page http://www.sundialsoft.freeserve.co.uk/pocket_frog_Ch1.htm, but I have some questions I hope you can solve...
 
I have done a dog robot which is able to move itself guided through a program on my PC which has many orders it can recognize (such as walk, rise left leg, rise right left, stop, etc). But now I want to do the same with a Pocket PC (iPAQ)...
 
I have understanded you can control a graphic movement with the iPAQ buttons, but I would want to know if I can control them with the pen iPAQ, i mean, if I slide the pen among the screen, making a movement, can i control it?
 
And the other question is... is it possible to include the graphics "game" I will done for the iPAQ in to another application?? I mean, to include it as a window of the application that will be installed on the iPAQ to controll the mechanical dog, which will have the other part (recognize orders, what I have explained yet).
 
Hoping you could help me in anything you thing could be useful and waiting your soon reply,
 
Best regards,
 
Sergio Alcantara Segura
sergio_wap@terra.es
 

 
"""" Which would be the best chance? PocketGL, PocketFrog, GADIDraw or another one? Could you please tell me what you think is the best? """""
QuestioniPAQ & OPENGL???sussXeXo11 Oct '02 - 3:21 
Dear friends,
My name is Sergio and I would like to use OPENGL with a Compaq iPAQ
(PocketPC 2002). Is there anyone who could guide me through this or
give me any kind of example?
Please, I need your help! I'm junior in these themes and I get lost
easily!
 
I hope any day could help you.
Waiting you soon reply, thanks a lot!
Best regards,
Sergio
 

 


AnswerRe: iPAQ & OPENGL???memberrex_chen20 Mar '03 - 22:54 
Oh, you should use "Pocket GL", but it's not free.~
http://www.pocketgear.com/software_detail.asp?id=1858
Cool | :cool:
GeneralQ]Just sending data to devicememberAnonymous29 May '02 - 20:33 
Now i'm developing a IrDA sample program to send a data to the remote receiver one-sidely.
how can i do this??
I saw the sample about communication with two devices using socket.
if you know how to do this, lets me know..
GeneralDebug Version - Not workingmemberAnonymous3 May '02 - 6:13 
I checked the bubble application between 2 IrDA-enabled Laptops with both sides being Windows 2000. The application worked well; that was Unicode release setting.
But the same application with Unicode Debug fails saying "unable to connect the IrDA device". ??
 
What could be the problem?
 
thank you for listening and answering,
 
Deepa
 
Deepa
Questionhow to create setup in eVC++ ApplicationmemberAnonymous25 Feb '02 - 22:33 
How to create Setup in eVC++ Application....
 

AnswerRe: how to create setup in eVC++ Applicationmemberemcon8 Mar '02 - 3:06 
We are also have the same problem,if u get the solution please forward to us.
GeneralRe: how to create setup in eVC++ ApplicationmemberSaurabh Soni11 May '02 - 0:17 
I also want to fine the solution for this.As in eVB there is option available as Install wizard.
Will it use makefile like thing in case of eVC or some other tools or utility will be required.
GeneralRe: how to create setup in eVC++ Applicationmemberrex_chen20 Mar '03 - 22:48 
EzSetup is free for eVC++ setup Tool:
http://www.softspb.com/products/ezsetup/index.html
Cool | :cool:
GeneralRe: how to create setup in eVC++ Applicationmemberkewal shah10 Dec '03 - 23:51 
hi buddy,
well i m engaged in an application for pocketpc which deals with the security options such as the locking of operations etc.
right now i m doin the most basic of them, i've a dialog box which appears but covers the whole of the client area as a result , the 'ok' & 'cancel' button are not entirely visible. can any body guide me how to fit the dialog size in the client area.
lemme know....;)

GeneralI can not print using IrDA portmemberXavi3 Feb '02 - 23:25 
I am making a little program to print a text on a Extech Printer by IrDa.
 
I can get irdaDeviceID and irdaDeviceName but when i will to establish a connection it fail. I am using socket. Somebody can help me?.
 
Sorry for my English.Cry | :((
GeneralRe: I can not print using IrDA portmemberAnonymous18 Apr '02 - 22:24 
can you print using com1?
if you can do that, i am proposing a tricky shot: all what you need is a wince registry editor and you have to go to
 
HKEY_LOCAL_MACHINE/Drivers/BuiltIn
 
you have to change the value
 
IrDa/Index to 1
 
and the value
 
Serial/Index to 2
 
Using this method you changed the logical significance of the IrDa and Serial ports (Com1: changed to Com2Smile | :)
 
You have to take care to have the same serial communication parameters on both devices: the printer and the IrDa port.
 
I wish you luck!
 

Iosiv Popescu,
 
Iosiv.Popescu@jt-int.com
GeneralSH* not found when compilingmemberJason Douglas18 Dec '01 - 11:42 
I loaded the project in eMbedded Visual C++ 3.0 with the latest SDK, but when I try to build the project (any configuration) I get several error messages about missing SH methods and structures (e.g. SHINITDLGINFO). Anyone else get this? Is there a simple fix for this? I would love to have this game on my PocketPC. Smile | :)
 
Thanks,
Jason
GeneralRe: SH* not found when compilingmemberArunHarnoor21 May '02 - 18:10 
Me too---same problem when I tried some copy and paste stunts( wiht poor knowledge of eVC++) from some files....There was no problem initially but after I made some file transfers to and fro--no changes in the files themselves.

GeneralRe: SH* not found when compilingmemberRizKhan11 Aug '03 - 19:57 
SH* API are Pocket PC API, Change your target machine to Pocket PC and complie.
 
Mohammed Rizwan
GeneralRe: SH* not found when compilingmemberjensen6 Jan '04 - 21:04 
I had this problem too. In project settings in preprocessor definitions I had to add
_WIN32_WCE_AYGSHELL
Then it works fine.Blush | :O
QuestionCan it work on ipaq?memberharlem tsai5 Jun '01 - 15:31 
after i compile the program , which CPU type i should chose for ipaq?
AnswerRe: Can it work on ipaq?memberMatt.W.7 Jun '01 - 19:20 
The iPAQ uses Intels StrongARM processor. Compile for (ARM).
Cool | :cool:
 
Accept that some days you are the pigeon and some days the statue.
AnswerRe: Can it work on ipaq?memberJereymy7 Nov '01 - 11:17 
ARM is the processor type used for iPAQ, at least the 3600-3800 series, as well as the 3100.
 

AnswerRe: It works on iPAQ, but MIPS ?memberchris10931 Dec '02 - 2:38 
It works perfectly if you compile the source code using the latest Pocket PC 2002 SDK (see:
http://msdn.microsoft.com/downloads/sample.asp?url=/msdn-files/027/001/908/msdncompositedoc.xml
). For the processor, select the ARM configuration.Smile | :)
 
However, I tried to compile using the Handheld PC SDK for MIPS processor, and it did not work: there is several error messages about missing SH methods and structures (e.g. SHINITDLGINFO). It seems that the Handheld PC SDK has not been updated. Has anyone solved this problem ?Confused | :confused:
 


 
Friendly yours, Chris
QuestionWhy don't Build setup for MIPS CPU?membermartyr28 May '01 - 15:37 
empty sentense...!
 
Why???
 
I have PDA of MIPS CPU ...Cry | :((
QuestionHow to load project?memberMatt Philmon17 Jan '01 - 15:12 
I've just begun looking at Windows CE. I will be working on a project for Pocket PC pretty soon. Anyway, I just set up eMbedded Visual Tools 3.0. Was this project build with Tools or Visual Studio 6.0 with the 3.0 SDK? Have you tried using Tools? I get tons of errors when trying to build the project under Tools.
AnswerRe: How to load project?memberMatt Philmon17 Jan '01 - 15:52 
Ahh, Visual Studio (I see that now). Have you tried porting this project to the new eMbedded Visual Tools 3.0?
 

GeneralRe: How to load project?memberJim B.22 Mar '01 - 11:32 
I compiled it using eMbedded Visual Tools 3.0 using the PocketPC emulator, and it worked fine. Just make sure that the for the compiler are set to PocketPC.
AnswerRe: How to load project?memberJae Gyu, Oh9 May '01 - 18:57 
Hey Dudes..
 
I tried build and execute the BUBBLE in eMebeded Visual Tools 3.0..yeah... some project coverting time are needed cuz that's a Visual Studio C++ 6.0..
 
but all are Ok..and Nice..
 
But... It's a Game??
 
just click the buble and disappear??
 
hmm..but..Okay..
 
I will try this game on my pocket pc.
 
heheheh THANKS..
GeneralRe: How to load project?memberSeepark18 May '01 - 10:13 
<<But... It's a Game?? just click the buble and disappear>>
I had the a similar meaning, but as I played I found out that it is a nice game. BTW my Moderate-Hiscore is 3323.
GeneralMultiple Instances...historysussGeldar28 Sep '00 - 4:14 
In WinCE 2.11 you could have as many instances you wanted of an app (and you had to check for running instances yourself if you wanted single instance), it was removed in 3.0.
I dont know they did it for some obscure opimization reason or for some usability reason.
 
Just thought I'd share that bit of trivia
GeneralFix for missing OK buttonsussKim Barnett17 Sep '00 - 23:43 
To fix the missing OK button problem
 
call
 
::SetForegroundWindow((HWND)(((DWORD)hwnd) | 0x01));
 
instead of
 
::SetForegroundWindow(hwnd);
 

I saw this in the MFC code. If anyone knows the reason and details behind it, I'd like to know.
Generalerrorsusssam15 Sep '00 - 14:12 

 
Cannot open include file: 'af_irda.h': No such file or directory
 

where i can find a this file
may be another support program file or miss fils?
please tell me
i don't know
 
hava you nice day^^~

GeneralRe: errorsussRamon de Klein17 Sep '00 - 4:46 
The "AF_IRDA.H" file is used for infrared support within Bubbles for Pocket PC. The Windows CE SDK for Pocket PC included this file and the current Windows 2000 SDK includes this file as well.
 
If you don't want the infrared support (or you don't have the appropriate SDK), just disable the IRDA_SUPPORT flag in StdAfx.h and it won't complain about this file anymore. Of course infrared support has been disabled as well when you disable the flag
QuestionEDD database creation error on smart phone.membermahendra.pardeshi@yahoo.com11 Sep '07 - 22:12 
hi,
I am try to create db on smart phone with 14 fields using following code it gives me error code 87 i.e. invalid parameter.
 
#define NUM_FIELDS 14
 

// setup the database information
 
CEDBASEINFOEX db_info;
 
// clear it out
 
::ZeroMemory(&db_info, sizeof(db_info));
 
// set it up
 
db_info.wVersion = CEDBASEINFOEX_VERSION;
 
// Set the number of active sort orders to 2.
 
db_info.wNumSortOrder = 2;
 
db_info.dwFlags = (CEDB_VALIDNAME | CEDB_VALIDSORTSPEC);
 
wcscpy(db_info.szDbaseName, DESTINATION_DETAIL_DB_NAME);
 
db_info.dwDbaseType = 0x999;
 
db_info.dwNumRecords = NULL;
 
db_info.dwSize = NULL;
 
db_info.ftLastModified.dwHighDateTime = 0;
 
db_info.ftLastModified.dwLowDateTime = 0;
 
// Initialize the array of sort-order descriptions.
 
// create first sort order .
 
db_info.rgSortSpecs[0].wVersion = SORTORDERSPECEX_VERSION;
 
db_info.rgSortSpecs[0].wNumProps = 1;
 
db_info.rgSortSpecs[0].wKeyFlags = 0;
 
db_info.rgSortSpecs[0].wReserved = 0;
 
db_info.rgSortSpecs[0].rgPropID[0] = MAKELONG(CEVT_LPWSTR, 0x0001);
 
db_info.rgSortSpecs[0].rgdwFlags[0] = CEDB_SORT_DESCENDING;
 
// create second sort order .
 
db_info.rgSortSpecs[1].wVersion = SORTORDERSPECEX_VERSION;
 
db_info.rgSortSpecs[1].wNumProps = 1;
 
db_info.rgSortSpecs[1].wKeyFlags = 0;
 
db_info.rgSortSpecs[1].wReserved = 0;
 
db_info.rgSortSpecs[1].rgPropID[0] = MAKELONG(CEVT_I4, 0x0005);
 
db_info.rgSortSpecs[1].rgdwFlags[0] = CEDB_SORT_GENERICORDER;
 
}
 
// setup the properties
 
CEPROPSPEC properties[ NUM_FIELDS];
 
// 1
 
properties[0].wVersion = CEPROPSPEC_VERSION;
 
properties[0].propid = MAKELONG(CEVT_LPWSTR, 0x0001);
 
properties[0].pwszPropName = TEXT("XX");
 
properties[0].cchPropName = 2;
 
// 2
 
properties[1].wVersion = CEPROPSPEC_VERSION;
 
properties[1].propid = MAKELONG(CEVT_LPWSTR, 0x0002);
 
properties[1].pwszPropName = TEXT("XXXXXXXXXXXX");
 
properties[1].cchPropName = 12;
 
// 3
 
properties[2].wVersion = CEPROPSPEC_VERSION;
 
properties[2].propid = MAKELONG(CEVT_LPWSTR, 0x0003);
 
properties[2].pwszPropName = TEXT("XXXXXXXXXXX");
 
properties[2].cchPropName = 11;
 
// 4
 
properties[3].wVersion = CEPROPSPEC_VERSION;
 
properties[3].propid = MAKELONG(CEVT_LPWSTR, 0x0004);
 
properties[3].pwszPropName = TEXT("XXXXXXXX");
 
properties[3].cchPropName = 8;
 
// 5
 
properties[4].wVersion = CEPROPSPEC_VERSION;
 
properties[4].propid = MAKELONG(CEVT_I4, 0x0005);
 
properties[4].pwszPropName = TEXT("XXXXXXXX");
 
properties[4].cchPropName = 8;
 
// 6
 
properties[5].wVersion = CEPROPSPEC_VERSION;
 
properties[5].propid = MAKELONG(CEVT_BOOL, 0x0006);
 
properties[5].pwszPropName = TEXT("XXXXXXXXXX");
 
properties[5].cchPropName = 10;
 
// 7
 
properties[6].wVersion = CEPROPSPEC_VERSION;
 
properties[6].propid = MAKELONG(CEVT_BLOB, 0x0007);
 
properties[6].pwszPropName = TEXT("XXXXXXXXXXXXXXXX");
 
properties[6].cchPropName = 16;
 
// 8
 
properties[7].wVersion = CEPROPSPEC_VERSION;
 
properties[7].propid = MAKELONG(CEVT_BLOB, 0x0008);
 
properties[7].pwszPropName = TEXT("XXXXXXXXXXXXXX");
 
properties[7].cchPropName = 14;
 
// 9
 
properties[8].wVersion = CEPROPSPEC_VERSION;
 
properties[8].propid = MAKELONG(CEVT_I4, 0x0009);
 
properties[8].pwszPropName = TEXT("XXXXXXXXXXXX");
 
properties[8].cchPropName = 12;
 
// 10
 
properties[9].wVersion = CEPROPSPEC_VERSION;
 
properties[9].propid = MAKELONG(CEVT_LPWSTR, 0x0010);
 
properties[9].pwszPropName = TEXT("XXXXXX");
 
properties[9].cchPropName = 6;
 
// 11
 
properties[10].wVersion = CEPROPSPEC_VERSION;
 
properties[10].propid = MAKELONG(CEVT_LPWSTR, 0x0011);
 
properties[10].pwszPropName = TEXT("XXXXXXXXXXXX");
 
properties[10].cchPropName = 12;
 
// 12
 
properties[11].wVersion = CEPROPSPEC_VERSION;
 
properties[11].propid = MAKELONG(CEVT_I4, 0x0012);
 
properties[11].pwszPropName = TEXT("XXXXXXXXXXXXXXX");
 
properties[11].cchPropName = 15;
 
// 13
 
properties[12].wVersion = CEPROPSPEC_VERSION;
 
properties[12].propid = MAKELONG(CEVT_LPWSTR, 0x0013);
 
properties[12].pwszPropName = TEXT("XXXXXXXX");
 
properties[12].cchPropName = 8;
 
// 14
 
properties[13].wVersion = CEPROPSPEC_VERSION;
 
properties[13].propid = MAKELONG(CEVT_BOOL, 0x0014);
 
properties[13].pwszPropName = TEXT("XXXXXXXXX");
 
properties[13].cchPropName = 9;
 
// create the database
 
m_oidDb = CeCreateDatabaseWithProps( &m_guidVolume, &db_info, NUM_FIELDS, properties );
 
// check if created
 
if ( m_oidDb == NULL ){
 
// error, return error
 
return(false);
 
}
 
This code is wok fine on poct pc but on smart phone it gives me error code 87.
If we create db for 9 fields instead of 14 then it will create db properly for more than 9 field it give me error,
Is their any limitation on smart phone for fields in database, if any one has any idea about this then please reply.
Thanks for reply.
 

 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 14 Sep 2000
Article Copyright 2000 by Ramon de Klein
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid