Click here to Skip to main content
15,881,380 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: syntax error Pin
rupeshkp7285-Apr-10 22:40
rupeshkp7285-Apr-10 22:40 
QuestionRe: syntax error Pin
CPallini5-Apr-10 22:47
mveCPallini5-Apr-10 22:47 
AnswerRe: syntax error Pin
rupeshkp7285-Apr-10 23:07
rupeshkp7285-Apr-10 23:07 
GeneralRe: syntax error Pin
CPallini5-Apr-10 23:20
mveCPallini5-Apr-10 23:20 
GeneralRe: syntax error Pin
rupeshkp7286-Apr-10 0:42
rupeshkp7286-Apr-10 0:42 
GeneralRe: syntax error Pin
CPallini6-Apr-10 0:50
mveCPallini6-Apr-10 0:50 
GeneralRe: syntax error Pin
rupeshkp7286-Apr-10 0:52
rupeshkp7286-Apr-10 0:52 
QuestionMultiple .cpp files Pin
gamefreak22915-Apr-10 21:45
gamefreak22915-Apr-10 21:45 
I'm not sure how using multiple .cpp files to create one .exe works but I'm attempted to using multiples to create just one .exe file. I'm currently using Microsoft Visual Studio 2008 and I've created a project built the project, and ran the file. I've either done something incorrect, or my idea of how this would work is wrong, in which case, my bad.

#include "DarkGDK.h"

void drawBlueBox();
void drawRedBox();
int x=319;

void DarkGDK()
{
	dbSetWindowOff();     // window mode off
	dbMaximiseWindow();     // maximise
	dbSetDisplayMode(1280, 1024, 32);

	while(x=319){
	dbCLS();
	drawBlueBox();
	drawRedBox();
	}
	dbWaitKey();
}

void drawBlueBox()
{
	int red = dbRND(255);
	int green = dbRND(225);
	int blue = dbRND(225);

	DWORD blue1 = dbRGB(red, green, blue);
	DWORD black = dbRGB(0, 255, 0);

	dbInk(blue1, black);
	dbBox(0, 0, 639, 511);
}

void drawRedBox()
{
	int red = dbRND(255);
	int green = dbRND(225);
	int blue = dbRND(225);

	DWORD red1 = dbRGB(red, green, blue);
	DWORD black = dbRGB(0, 255, 0);

	dbInk(red1, black);
	dbBox(640, 512, 1280, 1024);
}

#include "DarkGDK.h"

int y=0;

void main()
{
	int width = dbScreenWidth();
	int height = dbScreenHeight();
	int mouseX = dbMouseX();
	int mouseY = dbMouseY();
	dbPositionMouse(dbScreenWidth()/2, dbScreenHeight()/2);
	DWORD white = dbRGB(255, 255, 255);
	DWORD black = dbRGB(0, 255, 0);

	while(y=0){
	dbInk(white, black);
	dbText(350, 150, "Screen Width: ");
	dbText(460, 150, dbStr(width));
	dbText(120, 350, "Screen Height: ");
	dbText(240, 350, dbStr(height));
	dbText(120, 363, "Mouse Position: (    ,    )");
	dbText(255, 363, dbStr(mouseX));
	dbText(297, 363, dbStr(mouseY));
	dbWait(50);
	}
	
}


The first .cpp file makes a full screen window that makes two randomly color changing boxes, while the second .cpp files tracks your mouses movement as you move it across the screen and displays it. The code on either .cpp files is running properly when compiled alone and into two separate .exe files. If someone could explain exactly how one .exe file made with multiple .cpp files would run I think that would also be helpful.
AnswerRe: Multiple .cpp files Pin
Cedric Moonen5-Apr-10 22:01
Cedric Moonen5-Apr-10 22:01 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:14
gamefreak22915-Apr-10 22:14 
GeneralRe: Multiple .cpp files Pin
Cedric Moonen5-Apr-10 22:29
Cedric Moonen5-Apr-10 22:29 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:31
gamefreak22915-Apr-10 22:31 
GeneralRe: Multiple .cpp files Pin
Cedric Moonen5-Apr-10 22:41
Cedric Moonen5-Apr-10 22:41 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:49
gamefreak22915-Apr-10 22:49 
AnswerRe: Multiple .cpp files Pin
KarstenK5-Apr-10 22:38
mveKarstenK5-Apr-10 22:38 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 22:45
gamefreak22915-Apr-10 22:45 
GeneralRe: Multiple .cpp files Pin
KarstenK5-Apr-10 22:59
mveKarstenK5-Apr-10 22:59 
GeneralRe: Multiple .cpp files Pin
gamefreak22915-Apr-10 23:40
gamefreak22915-Apr-10 23:40 
GeneralRe: Multiple .cpp files Pin
Emilio Garavaglia6-Apr-10 2:20
Emilio Garavaglia6-Apr-10 2:20 
GeneralRe: Multiple .cpp files Pin
gamefreak22916-Apr-10 6:47
gamefreak22916-Apr-10 6:47 
GeneralRe: Multiple .cpp files Pin
Emilio Garavaglia6-Apr-10 20:36
Emilio Garavaglia6-Apr-10 20:36 
QuestionPermutations with repetition Pin
MsmVc5-Apr-10 20:59
MsmVc5-Apr-10 20:59 
AnswerRe: Permutations with repetition Pin
CPallini5-Apr-10 21:49
mveCPallini5-Apr-10 21:49 
GeneralRe: Permutations with repetition [modified] Pin
MsmVc5-Apr-10 21:58
MsmVc5-Apr-10 21:58 
GeneralRe: Permutations with repetition Pin
CPallini5-Apr-10 22:06
mveCPallini5-Apr-10 22:06 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.