FireNet 64 Posting Whiz in Training

Woo,
As far as I know graphics.h use BGI.You can use it with Turbo C++ like Asif_NSU or use Borland C++.

In Borland C++ right-click on the cpp source window and choose Target Expert.You should a beautiful window with options everywhere.Just look to the lower right and you should see Windows 32 and below the Console.Just choose Dos (Standard) instead of Windows.Then the path in the initgraph should be "bc5/bgi" or copy evga.bgi from there to your current folder.
[Compiler I have tried BGI on:Turbo C++,Borland C++ 5.02(Commercial,not the free one)].
Visiual Studio Net would understand BGI like Greek or something.

The most common error would be:
Code:
error directive BGI not supported under Windows

FireNet 64 Posting Whiz in Training

Do you want a bot which plays the Vampires game?

FireNet 64 Posting Whiz in Training

If you want to try your hand at 2D game, you can use http://love2d.org/ . It's basically a lua game engine, which allows you to write games using lua scripts.

If you are fimiliar with C++ SFML ( http://www.sfml-dev.org/ ) provide a very good framework for games. It not a game engine, but has a lot of the basics required to write your own game, mainly resource loading (image, audio), video (opengl), input etc.

FireNet 64 Posting Whiz in Training

Try http://gamedev.net 'Help Wanted' forum

FireNet 64 Posting Whiz in Training

There's no tool that can convert a complex 2d image in to a 3d model, simply because there is not enough data present in a flat image. Artists can use 3d modeling software and sample images to make models manually.

Simple images, like a 2d logo can easily be made into 3d using simple effects in photo editing software like Photoshop.

If it's an image is a complex one like a person, then it will have to be done manually.

FireNet 64 Posting Whiz in Training

This is funny .....
Dint you read the faq .. no homework solutions.

FireNet 64 Posting Whiz in Training

You use simple vectors. You can rotate vectors with minimal calculations.

So when the ball hits the paddle, based on the distance from the center, rotate the directional vector of the ball by a certain amount of degrees.

http://chortle.ccsu.edu/VectorLessons/vectorIndex.html

The above link contains a pretty good coverage of vector math. Vectors are very simple to use and make thing very easy once you get the hang of them.

Try them out. :), come back if your run into trouble or if you figure it out post your discoveries here ;)

Maidomax commented: Yep, that's about it! +2
FireNet 64 Posting Whiz in Training

Yea, I can see how it works. Thank you.

FireNet 64 Posting Whiz in Training

Hi,

I am looking for a way to use minimal javascript to open a popup window when the user clicks on an input field and allow them to choose one string inside the pop up window (like click on a radio button) and get the input box in the parent window filled with the value of the string.


I know it's kinda standard, but I dont know much about using javascript ... so I dont know exactly what to search for ....

I've seen hotmail allows you to populate your recipient input box using a popup ... I am looking to do something similar ...

FireNet 64 Posting Whiz in Training

Start really simple. Learn the basics/intermediate stuff in C++ ... should know classes, file i/o, a working knowledge of STL and a bit of Win32 programming and you are good to go.

When I started I knew C++ and no game programming, but I was able to do a full game in about 2 weeks, with code cobbled from various sources to get a screen to draw on.

If you can find a way to draw on the screen you are half way there as a beginner.

I would suggest GLUT to get you started. GLUT simplifies the init for OpenGL ... so you can get opengl started without any win32 api coding.


http://www.lighthouse3d.com/opengl/glut/index.php?1

Oh and hang out a bit at sites like gamedev.net and devmaster.net

FireNet 64 Posting Whiz in Training

:)

Displaying the image is real easy if it is not encrypted ...

You can use glut + corona to easily display images.
http://www.daniweb.com/forums/thread63827.html#5

Also if you are having problems with leftover bytes at the end of the file smaller than your buffer, use the following bit of code to find the file size

// obtaining file size
#include <iostream>
#include <fstream>
using namespace std;

int main () {
  long begin,end;
  ifstream myfile ("example.txt");
  begin = myfile.tellg();
  myfile.seekg (0, ios::end);
  end = myfile.tellg();
  myfile.close();
  cout << "size is: " << (end-begin) << " bytes.\n";
  return 0;
}

http://www.cplusplus.com/doc/tutorial/files.html

Divide the file size by your buffer size, run the loop with the number you get (the quotient) and read the remaining data using the remainder as the read size.

^^


Also, it possible to display encrypted data, just that it would look like a bunch of random pixels .... The standard format is RGB, so you can create a single color out of 3 bytes of data, 0-255, standard char. Read up an OpenGL tutorial on creating a texture ......

FireNet 64 Posting Whiz in Training

Use binary mode to open files which deal with encrypted text.

That should solve the problem with the EOF char :)

P.S Refer to my reply to your mail.

If you get it working post the working program here :D

FireNet 64 Posting Whiz in Training

You can render it as text.

The following link shows how to render text in glut:
http://www.lighthouse3d.com/opengl/glut/index.php?bmpfont

You can use sprintf to convert numbers into strings:
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf.html

Should be all you need to start displaying any text you want ^^

FireNet 64 Posting Whiz in Training

use regular expressions

Look here:
http://ca3.php.net/preg-match-all

FireNet 64 Posting Whiz in Training

Try searching around for a 3D engine

http://irrlicht.sourceforge.net/

FireNet 64 Posting Whiz in Training

Try making simple 2d games first.

However if you do want to make a counter-strike style game it is possible (when you've had enough experiance ofcourse) with the tons of 3d engines available now (for free and paid ones). They provide all the ground work like resource loading, rendering, networking, etc leaving only the game play to be done. So it wont take 20 years .... a person could theoretically make a game similar to counter-strike in a day if he knows/has a proper engine , has a few models (ppl and weapons) and has the basic code for an FPS. I am talking about the basic game play of counter strike here not the fancy stuff like realistic weapons and similar stuff.

There are a lot of options these days for game programmers and a lot of the basic work is already done and available as stable libraries for use, so starting from scratch is not always necessary.

FireNet 64 Posting Whiz in Training

If you need multiple comments, use 2 tables. One for the program details, and one for the comments. Use an id tag (preferably the unique key from the program details)

CREATE TABLE tvprograms (
p_id int(11) NOT NULL UNIQUE AUTO INCREMENT,
p_name char(40),
p_desc tinytext,
p_misc tinytext
);

CREATE tvprograms_comment(
pc_id int(11) NOT NULL UNIQUE AUTO INCREMENT,
p_id int(11) NOT NULL,
pc_text text
);

-- SQL QUERY MAY CONTAIN ERRORS

Use simple select queries to list the programs. Then use the p_id value to list single program and the comments for the program.

SELECT * FROM tvprograms ORDER BY p_id DESC LIMIT 5; -- to list last 5 programs

SELECT * FROM tvprograms WHERE p_id=' $X '; --- to select one program

SELECT * FROM tvprograms_comment WHERE p_id=' $X '; -- to select all the comments for a single program.

I hope you get the idea how the 2 tables are being used to do what you need. One stores all the program details and the second stores all the comments, with each comment being tagged with an id number from the program details table.

FireNet 64 Posting Whiz in Training

use the function mysql_escape_string();

It will make sure all the characters are escaped and safe to use in a mysql query

escaping a character is adding a \ in front of a character. Eg: \'


Hope that fixes your problem.

FireNet 64 Posting Whiz in Training

If you have a domain on a web host goto your control panel in your hosting account and look for a button/link/panel titled subdomains. Most control panels would just have you enter the name of the subdomain and click ok to set one up.

FireNet 64 Posting Whiz in Training

O.o

The balance , profile etc can be part of a member table, and the sign up/upgrade areas can be scripts that modify the table when signup/payment is received.

If you are looking to make a pay to click site like bux or adbux then it's probably best you hire some professionals to do it with some SEO and launch a few advertising campaigns to draw visitors and advertisers.


You could try GetAFreelancer to hire someone.


Those kind of sites are fairly complex and require a fair amount of experiance and skill to make. Not to mention; making sure people don't cheat is a really difficult deal.

I believe there are also some premade scripts for ptc sites. May not have all the features, and I don't know how well they work or how much they cost. Try searching on the net.

FireNet 64 Posting Whiz in Training


Anyways, the only reason I'm doing this is because I'm too young to get a job.

Just a warning .... dont buy referrals ^^

Oh and since you are making money
http://www.thesimpledollar.com/

Live wisely son :)

FireNet 64 Posting Whiz in Training

Or over load the << operator for an ostringstream inheriting class and pipe all the output to into a text box.

eg...

class mfc_text_box : public ostringstream
{
//pseudo -code
operator << (Cstring &x)
{
 write_txt_to_box(x.c_str());
}

}

Then you can use a mfc_text_box_obj just like cout.

FireNet 64 Posting Whiz in Training

:P

O.o
Checked bux ...... 20 ads per day... 1 cent per ad.... payout at $10. That means 50 days of work. and 10-20 mins everyday.

9-11 Hours of work and $10 !!!!!

Use that time to learn something and do some real work.

FireNet 64 Posting Whiz in Training

Thanks,

How about this way...

string MyStr( (const char*)MyCStringObject );

Old style cast.

Read:
http://msdn2.microsoft.com/en-us/library/ms174288(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/awkwbzyc(VS.80).aspx

FireNet 64 Posting Whiz in Training

Web designers use [search]call to action[/search] page elements to send subliminal messages to web visitors about where you want them to click. Read up on it - you can apply similar techniques to Google AdSense by varying color and placement. And always use Google AdSense channels to do A/B testing.

wicked.

On a similar note, you could look into tag clouds ...... and attach ad pop-ups to them. Some ad networks even provide the code to do that automatically. People have a tendency to move their mouse over tag clouds...

http://en.wikipedia.org/wiki/Tag_cloud
http://www.ads-click.com/publisher/webpublisher.html

FireNet 64 Posting Whiz in Training

First ... use code tags to highlight your code...

[*code]
[*/code]

(without the *)

Also dumping the whole file into your post does not really help... where's line 376... one's going count the lines....


P.S Check this post:
http://www.daniweb.com/forums/thread72874.html

nav33n commented: lol.. yeah.. I do that in free time ! I am returning your reputation as a token of gratitude! lol.. +1
FireNet 64 Posting Whiz in Training

Which ONE?

:D

FireNet 64 Posting Whiz in Training

Simple.

Take the text of the article as a string, crop the string to a certain size, append "......" to the string and display it.

<?php

/*################################################################
#                                                                #
# You pass the script a string, a length you want the string     #
# to be and the trailing characters, what the function does,     #
# is takes the string, finds the last word that will fit into    #
# the overall length, and return a string that has been cropped. #
# The function makes sure that a word is not cut in half.        #
#                                                                #
##################################################################
#        Written by David Speake - david@evilwarus.com           #
#      Adapted from Oliver Southgate's ASP interpretation        #
#     http://www.haneng.com/code/VBScript/CropSentence.txt       #
##################################################################
#                                                                #
# Examples:                                                      #
#                                                                #
# $strTemp = "Hello, I am a fish and you are not.";              #
# $strTemp = CropSentence($strTemp, 16, "...");                  #
# //returns "Hello, I am a..."                                   #
#                                                                #
# $strTemp = "Hello, I am a fish and you are not.";              #
# $strTemp = CropSentence($strTemp, 17, "...");                  #
# //returns "Hello, I am a fish..."                              #
#                                                                #
################################################################*/

function CropSentence ($strText, $intLength, $strTrail) 
{
    $wsCount = 0;
    $intTempSize = 0;
    $intTotalLen = 0;
    $intLength = $intLength - strlen($strTrail);
    $strTemp = "";

    if (strlen($strText) > $intLength) {
        $arrTemp = explode(" ", $strText);
        foreach ($arrTemp as $x) {
            if (strlen($strTemp) <= $intLength) $strTemp .= " " . $x;
        }
        $CropSentence = $strTemp . $strTrail;
    } else {
        $CropSentence = $strText;
    }

    return $CropSentence;
}

$strTemp = "Hello, I am a fish and you are not.";
$strTemp = CropSentence($strTemp, 16, "..."); 
print $strTemp;
?>
FireNet 64 Posting Whiz in Training

Oh,

Are you asking how to set custom error pages?


Well, .htaccess or by using the control panel. Look in you CP for custom page or custom error pages.

FireNet 64 Posting Whiz in Training

Reporting on what?

FireNet 64 Posting Whiz in Training

If you are sure it has the answer you could always buy it ^^.

Or you could just ask the question about the problem you are having....

FireNet 64 Posting Whiz in Training

You could try factory methods:
http://en.wikipedia.org/wiki/Abstract_factory

For a game you could have an array/vector like
std::vector<bcAbility> hero_ability;

The base ability class

class bcAbility
{
 string AbilityName()
 void Do()
}

Having a factory class would allow addition/removal/modification of any number of abilities. Actual abilities would be derivatives of the base ability class and the factory class would take care of the initialization. This is a rough explanation, but this method's been in use for a while.


Factory Class Info (search)
Why Pluggable Factories Rock My Multiplayer World

http://www.gamedev.net/reference/articles/article2097.asp
http://www.gamedev.net/reference/articles/article1415.asp

FireNet 64 Posting Whiz in Training

C++,Java
Math
GFX - (OGL,DX)
3D - (basics, rendering, lighting)
Physics - (basics, some API)
Shaders - (GLSL,HSL, CG)
Engines - (pick one or 2)
Networking - (some APIs)

Basically you should know a bit about everything.And concentrate on 2 or 3 areas.


Also try making a game yourself. That's the only way to say for sure if you can handle doing games. Do something simple.

Mod-ing ...not so good idea if you have no previous experiance with creating games. It would just frustrate you. Once you know something, modding is a good way to learn advanced stuff and get your head in the current world.

Book:
Introduction to Game Development

Based on the curriculum guidelines of the IGDA, Introduction to Game Development is the first book to survey all aspects of the theory and practice of game development, design, and production. The book, which might be used as a text for introductory courses or as a comprehensive reference for game developers and designers, is divided into seven independent parts: Critical Game Studies, Game Design, Game Programming (Languages and Architecture), Game Programming (Mathematics, Collision Detection, and Physics), Game Programming (Graphics, Animation, Artificial Intelligence, Audio, and Networking), Audio Visual Design and Production, and Game Production and the Business of Games. Twenty-seven of the leading game developers.....

Would make for an interesting read. :-P. Even though I've not read it, it seems to introduce all the …

FireNet 64 Posting Whiz in Training

8800GTS

HAHA.... you dont need to worry about frame rates in the near future. Just make sure v-sync is off in the games and they should run fine.

If you are playing multi player games, dont run p2p software in the background.

Keep your computer clean, dont have a ton of apps in start up.

USE GAMEGAIN RATHER THAT OVERCLOCK AND BLOW AN NEAT CARD ^^


Also this forum is for ppl interested in making games ;)

FireNet 64 Posting Whiz in Training

Most of the resources mentioned here are a bit advanced , used for 3D games, and requires quite a bit of reading to actually use in a game.

Here are a few libraries that should hopefully help in making simple games, with a much lower learning curve.

What do games need?
Graphics -> something draw on the screen, primitives (lines,circles,quads) and textures (pictures)
Sound -> bangs and bams, background music to make the game come alive.
Input -> To let the user actually interact with the game

So here are some simple libs which can help you with the above:

Frame Buffer: http://www.pixeltoaster.com/
Something to draw on. For beginners, it's recommended you use fairly low-level APIs and do things yourself. This should help you get a buffer to draw on and to learn some rendering techniques (and to develop a greater appreciation for the reasons why somethings are the way they are)

Rendering: http://freeglut.sourceforge.net/
Once you've learned to draw, you can let an API do it for you. Freeglut is pretty hand for that and can do wonders to simplify OpenGL initialization and rendering across various platforms.

Image Loader: http://corona.sourceforge.net/
Every game needs it's art. This lib makes loading images in a variety of formats easy. It can be used with any application. It just loads the image from file into a buffer in any mode(eg RGB).

Sound: http://audiere.sourceforge.net/
Open Source …

~s.o.s~ commented: Nice one. +20
FireNet 64 Posting Whiz in Training

Let me warn you .... modding is not the way to go if you have no previous experiance with game programming. Sure, you will be able to get some fancy effects to the screen, but mostly you would be just twiddling with settings... and that's not really making a game.

But the choice is yours so:
Content: http://gpwiki.org/index.php/Tools:Content
Programming : http://gpwiki.org/index.php/Tools:Programming

Also checkout the documentation for the SDK that came with the game.


I would recommed you start with some really simple games like pong or tetris. You will learn a lot during the process.

I did my first game with minimal knowledge using DOS graphics in about 2 weeks. It was a snake clone (I never did get around to doing a text game). It's not very hard.. and then you can move to higher level games quickly once you have an understanding of the basics.

Not to say modding is not game development, I've seen a lot of mods that really are good and do significant changes to game play. But I still hold playing with settings and art of a game is not really game development.

Have fun ^.--

FireNet 64 Posting Whiz in Training

http://tvision.sourceforge.net/
http://www.trumphurst.com/toolkit.phtml
http://www.usinglinux.org/devel/rhtvision.html

O.o I would think learning a GUI API would be easier (lots of choices, lots of documentation etc).... and look better. You will be able to accept text input via a GUI too ;)

FireNet 64 Posting Whiz in Training

I agree with Duoas. If you want delays used timed functions like delay() or sleep() or whatever else.


If you are doing a txt game ... the screen can be cleared using clrscr() (conio.h)

If you want a proper screen under DOS, look up Mode13h on the net . You will need a compiler like DJGPP. It's kinda hard to get into that particular mode with std compilers these days .... you have to twiddle with the settings, or use a compiler with protected DOS memory management like DJGPP.

If you are under windows (any), and want to do the rasterization (draw yourself), you should checkout PixelToaster which gives you a frame buffer to play with just like Mode 13 h.

Once you have a frame buffer, you can pretty much do anything ... draw lines, circles , quads etc etc , for any kinda game. ^^

Later you should checkout OpenGL and DirectX.

So... whatcha making?
Tic Tac Toe?

FireNet 64 Posting Whiz in Training

Try this page:
http://www.easysoft.com/developer/languages/php/sql_server_unix_tutorial.html

However I'd recommed you use MySQL rather than MS SQL.

Get XAMPP at portableapps.org if you need to carry it around (in a usb).

FireNet 64 Posting Whiz in Training

Hi,

You should always look on the net for tutorials first. Then there's the php documentation pages.

Also checkout these:
http://curl.haxx.se/docs/
http://www.php.net/curl

However if you do have to get a book checkout the following places:

http://www.blueportal.org/ - Tons of IT books
http://www.ebookshare.net/ - Wide selection of ebooks
http://avaxsphere.com/ - books, scripts, etc

You should find multiple books that cover what you need with those sites. Happy reading ;)

FireNet 64 Posting Whiz in Training

Example:
Navigate: PHP Code Library > PHP > Sub1 > Title V


Any ideas, tutorials no how to do that using php & mysql ? each category should be able to have items and more categories under it. It should use a single table to store all the category titles.

I am looking for tutorials that explain how to do this, though I've an idea.

I am looking for some method that would allow easy deletion of a category (and have it's sub categorys be deleted).

I am not looking to learn how to build an interface for it, but rather optimizing the sql queries

FireNet 64 Posting Whiz in Training

First get a C++ book, preferably one that covers the C++ standard ... not a tutorial book .... more like one which covers the ISO C++, with all the details on various aspects of the language.

C++ Primer might be a good book if you just got you programming skills from a school.
http://www.amazon.com/Primer-3rd-Stanley-B-Lippman/dp/0201824701

That would probably give you some insight into the language and why things are they way they are and what can be expected in the future ....

From there you can look into the many APIs written for C++ and libraries .... these are there for every field you can think of... try a few, get involved in a few open source projects ... or atleast get familiar with a few, look in to cross-os C++ programming.

This should allow you to learn a lot, get exposed to various architectures, ways of coding etc etc and lead you to enlightenment.

;)

FireNet 64 Posting Whiz in Training

Thank you. Seems it's a standard across browsers not to allow scripts from different domains to interact.

Here is a link I found interesting:
http://www.dyn-web.com/dhtml/iframes/

FireNet 64 Posting Whiz in Training

The script came from a tutorial site and I kept the copyright notice (says it can be used as such)

Guess I found out about the security part.

Any ideas on how to modify a page's content after it is loaded into an iframe? or at least get a portion of the page loaded in the iframe?

FireNet 64 Posting Whiz in Training

I am trying to a page load an external website's page within a div, but it's just not working....

Anyone got any ideas?

I do know it's possible:
http://orangoo.com/labs/GreyBox/ -- loads google.com in a popup


Here's my code

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="s1/style.css" type="text/css" rel="stylesheet">
<link href="style.css" type="text/css" rel="stylesheet">


<script type="text/javascript">

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){

	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	{
		document.getElementById(containerid).innerHTML=page_request.responseText;
	}
	else
	{
		document.getElementById(containerid).innerHTML="<center><img src='load.gif' /><br>"+ page_request.statusText +"</center>";
	}
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a …
FireNet 64 Posting Whiz in Training

The main issue here is not which language will execute faster .... it hardly matters for most computers when the games are mid to small, there will be plenty of processing power left over.

Only huge 3D games will require the raw power C/C++ allows, but as there's more complexity and time overheads associated with C/C++ coding.

Java may have it's restrictions but when it comes to cross-platform compatibility, it wins hands down against C++..... and for many developers that is more important factor.

Lower level acess for C/C++ makes it more difficult to make it totally cross-platform, and you will need separate binaries for each.

If you want to do cutting edge stuff C++ is the way to go. All the latest APIs, Engines etc use it and it saves a lot of time in development.

If you want cross-platform compatibility and easy of deployment or do small time stuff.. java ... although it has improved a lot and now you have DX and OGL bindings in java... so you can do cutting edge stuff there, but it would be a bit slower.


So to finish this off C/C++ or Java it does not really matter for most games. If you do comparisons efficiency would almost be at par. It's mostly deciding which lang would be more efficient for you to code in and deploy.

Large 3D games are out of reach for java atm, but there are promising engines …

FireNet 64 Posting Whiz in Training

You could also create an interface using get or post methods using a php script via which your game can get results to preset sql statements.

Your game can call the script to get the data or even change it... but it may not be the best way to do it.

FireNet 64 Posting Whiz in Training

http://www.hostingplex.com/r/12364
Hosting for $3.95, (yearly and bi-yearly plans)
300GB space
3000GB Transfers
Free domain on yearly plan
Unlimited ftp accs, mysql dtbs, subdomians etc


Signup took about 2 mins for me, just basic details and payment. Setup was almost instant.


I got my domain at fxdomains.com, the signup was kinda lengthy (6-8 mins) going through some pages with lots of offers. Domain was ready almost instantly after signup

So I guess you can have a domain and website in less than 15 mins these days.

FireNet 64 Posting Whiz in Training

P.S Once you have a nice little windows and directx init/looping code wrap it all up into a nice set of classes/functions that you can reuse. It's really worth the time and effort ;)

FireNet 64 Posting Whiz in Training

I am not sure if you are using TestCooperativeLevel() correctly ....

http://msdn2.microsoft.com/en-us/library/microsoft.windowsmobile.directx.direct3d.device.testcooperativelevel.aspx

If the device is lost and cannot be restored at the current time, TestCooperativeLevel throws a DeviceLostException. This is the case, for example, when a full-screen device loses focus. If an application detects a lost device, it should pause and periodically call TestCooperativeLevel until no exceptions are thrown. The application can then attempt to reset the device by calling Reset and, if this succeeds, restore the necessary resources and resume normal operation. Note that Present throws a DeviceLostException if the device is either "lost" or "not reset."
A call to TestCooperativeLevel fails if made on a thread other than the one used to create the device being reset.

It throws exceptions.... does not return anything ....

Here's a good game example using DirectX ... used directdraw but it should show you all the basic you need to know how to setup and handle a DX game app:
http://www.codeproject.com/directx/SuperBrickBreaker.asp


And for DirectX 9 tutorials:
http://www.drunkenhyena.com/cgi-bin/dx9.pl

Those are quite compleate in dealing with win32 basics and basic DX init