|
Hi all
I have an application which calls another thread with own window procedure.
Inside that another window I put edit control.
My problem is that I can not type anything inside that Edit Control.
It looks, that it does not have keyboard focus.So, I tryed to work with SetFocus(), but it did not help.
Please answer my question.
Tahnks.
Nena
|
|
|
|
|
What kind of thread does the main thread spawn? In other words, the child thread should be a UI thread if you want to update the edit control.
Kuphryn
|
|
|
|
|
hello
i declared function in one class that i creat ,public, but when i want to use it in an other class it say that's not declared.
|
|
|
|
|
Did you include the declaing header file into the callers?
Do Lipton employees get coffee breaks?
|
|
|
|
|
|
How are you using it in the other class?
Class A
{
public:
void AFunc();
}
Class B
{
void SomeBFunc();
}
void B::SomeBFunc()
{
A aInst;
aInst.AFunc();
AFunc();
}
Unless B is inherited from A.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
// creatfoufou.cpp: implementation of the creatfoufou class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "OpenGl.h"
#include "creatfoufou.h"
#include "foufou.h"
#include
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
creatfoufou::creatfoufou()
{
}
creatfoufou::~creatfoufou()
{
}
void creatfoufou::creatfou(int amount)
{
foufou *newfoufouPtr;
int randomX,randomY,randomZ;
int speed,steer;
for(int index=0;index {
newfoufouPtr = new foufou();
fou_caracter.push_back( newfoufouPtr );
//ici vien l'integration ou le dessin de foufou dans la scene
randomX = ( ( 1 + rand( ) % 900 ) - 450 );
randomY = ( ( 1 + rand( ) % 100 ) - 50 );
randomZ = ( ( 1 + rand( ) % 900 ) - 450 );
setposition(randomX,randomY,randomZ);
//speed =
//steer =
//lui attribue sa vitesse
//lui attribuer son emplacement
//lui attribuer sa direction
}
}
void creatfoufou::setposition(int newX, int newY, int newZ)
{
-->the mistak RePaint(randomX,randomY,randomZ);
}
and here when i declared
// foufou.cpp: implementation of the foufou class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "OpenGl.h"
#include "foufou.h"
#include
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
foufou::foufou()
{
}
foufou::~foufou()
{
}
//Propriétés réflectives de l'objet touché par la lumière
GLfloat Material_Ambiante[]={0.5,0.5, 0.5, 1 };
GLfloat Material_Difuse[]={0.5, 0.5, 0.5, 1};
GLfloat Material_Specular[]={0.5, 0.5, 0.5, 1};
//Propriété de la lumière
GLfloat Light_Ambiante[]={0.2, 0.2, 0.2, 0.1};
GLfloat Light_Difuse[]={0.5, 0.5, 0.5, 1.0 };
GLfloat Light_Specular[]={1.0, 1.0, 1.1, 1.0 };
GLfloat Light_Position[]={10, 12, 10, 1.0 };
GLfloat Light_Direction[]={0.0,-1.0, 0.0, 1.0};
void foufou::Initial()
{
//Définir les propriété de l'objet touché par la lumière ainsi que la lumière
glMaterialfv( GL_FRONT, GL_AMBIENT, Material_Ambiante);
glMaterialfv( GL_FRONT, GL_DIFFUSE, Material_Difuse);
glMaterialfv( GL_FRONT, GL_SPECULAR,Material_Specular);
glMaterialf( GL_FRONT, GL_SHININESS, 20);
glLightfv( GL_LIGHT0, GL_AMBIENT,Light_Ambiante );
glLightfv( GL_LIGHT0, GL_DIFFUSE, Light_Difuse );
glLightfv( GL_LIGHT0, GL_SPECULAR, Light_Specular);
glLightfv( GL_LIGHT0, GL_POSITION, Light_Position );
//Activation de l'éclairage
glEnable( GL_LIGHTING );
//Activation de la première lumière
glEnable( GL_LIGHT0 );
//Activation du test de profondeur
glEnable( GL_DEPTH_TEST );
};
void foufou::RePaint(int xpos,int ypos,int zpos)
{
//Vidage du contenu situé à l'écran
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glClearColor(0.3, 0.3, 0.3, 1.0);
//On réénitialise la matrice modélisation-visualisation
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
//On place la caméra dans la scène
gluPerspective (90, 1, 5, 50);
gluLookAt (2,2, -15, -4,0.0, 1, 0.0, 1.0, 0.0 );
//surface avec rotation de 45°
glPushMatrix();
//rotation de la surface
// glTranslated(0.0, 30.0, 15.0 );
// glRotated( 15, 0.0, 0.0, 0.0 );
////////
//Proprité de réfléction ambiante de la matière
glColorMaterial( GL_FRONT, GL_AMBIENT );
glColor4f(0.5, 0.5, 0.6, 1.0 );
//Proprité de réfléction diffuse de la matière}
glColorMaterial( GL_FRONT, GL_DIFFUSE );
glColor4f( 0.5, 0.2, 0.8, 1.0 );
//Proprité de réfléction speculaire de la matière}
glColorMaterial( GL_FRONT, GL_SPECULAR );
glColor4f( 0.9, 0.8, 1.0, 1.0 );
//Création de la surface 30 x 30}
//glutSolidCube(3);
glTranslated(-xpos, ypos, zpos );
glutSolidSphere(0.9,30,40);
glDisable( GL_LIGHTING );
glPopMatrix();
//glDisable(GL_TEXTURE_2D);
SwapBuffers(wglGetCurrentDC());
};
|
|
|
|
|
aguest wrote:
void creatfoufou::setposition(int newX, int newY, int newZ)
{
-->the mistak RePaint(randomX,randomY,randomZ);
}
aguest wrote:
void foufou::RePaint(int xpos,int ypos,int zpos)
This is exactly what I stated in my previous message. Even though you declared RePaint as a public function in foufou class you can't just use it in createfoufou. You need to call it this way:
class createfoufou
{
public:
createfoufou()
private:
foufou *newfoufouPtr;
};
createfoufou::createfoufou()
{
newfoufouPtr = new foufou;
};
void creatfoufou::setposition(int newX, int newY, int newZ)
{
newfoufouPtr->RePaint(randomX,randomY,randomZ);
}
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
when i must declare
<br />
void B::SomeBFunc(){ A aInst; aInst.AFunc();
in which class or file(.h or .cpp)
|
|
|
|
|
In createfoufou.cpp
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
i make all what u ask me ,and this mistake don't stille but other mistakes appears:
<br />
OpenGlView.obj : error LNK2005: "int PANIC_SPEED" (?PANIC_SPEED@@3HA) already defined in creatfoufou.obj<br />
OpenGlView.obj : error LNK2005: "int MINIMUM_SPEED" (?MINIMUM_SPEED@@3HA) already defined in creatfoufou.obj<br />
OpenGlView.obj : error LNK2005: "int STARTINGSPEED" (?STARTINGSPEED@@3HA) already defined in creatfoufou.obj<br />
OpenGlView.obj : error LNK2005: "class std::vector<class foufou *,class std::allocator<class foufou *> > fou_caracter" (?fou_caracter@@3V?$vector@PAVfoufou@@V?$allocator@PAVfoufou@@@std@@@std@@A) already defined in creatfoufou.obj<br />
OpenGlView.obj : error LNK2005: "int num_fou_caracter" (?num_fou_caracter@@3HA) already defined in creatfoufou.obj<br />
Debug/OpenGl.exe : fatal error LNK1169: one or more multiply defined symbols found<br />
Error executing link.exe.<br />
Creating browse info file...<br />
<br />
OpenGl.exe - 6 error(s), 2 warning(s)<br />
this
<br />
#if !defined(AFX_CREATFOUFOU_H__BE7E5BDB_1815_48E7_AAC4_B30A8F281BA4__INCLUDED_)<br />
#define AFX_CREATFOUFOU_H__BE7E5BDB_1815_48E7_AAC4_B30A8F281BA4__INCLUDED_<br />
<br />
<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
#include "gl/glut.h"<br />
#include "foufou.h"<br />
#include <vector> <br />
<br />
int STARTINGSPEED = 150;<br />
int MINIMUM_SPEED =80;<br />
int PANIC_SPEED =25;<br />
<br />
using namespace std;<br />
vector< foufou * > fou_caracter;<br />
int num_fou_caracter;<br />
<br />
class creatfoufou <br />
{<br />
<br />
<br />
public:<br />
GLfloat randomZ;<br />
GLfloat randomY;<br />
GLfloat randomX;<br />
void setposition(int newX,int newY,int newZ);<br />
void creatfou(int amount);<br />
<br />
creatfoufou();<br />
virtual ~creatfoufou();<br />
private:<br />
foufou *ptrfoufou;<br />
<br />
};<br />
<br />
#endif // !defined(AFX_CREATFOUFOU_H__BE7E5BDB_1815_48E7_AAC4_B30A8F281BA4__INCLUDED_)<br />
|
|
|
|
|
I am not sure but my best guess is that these variables:
int STARTINGSPEED = 150;
int MINIMUM_SPEED =80;
int PANIC_SPEED =25;
using namespace std;
vector< foufou * > fou_caracter;
int num_fou_caracter;
have been declared somewhere else. Maybe in creatfoufou.cpp or foufou.h.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Is there a way to print out a warning when someone goes to use a function? I want it to be printed whenever (and only when) the function is referenced.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
VC7 Specific
#pragma deprecated( function1 [, function2, ...] )
-OR-
__declspec(deprecated) void func1(int)
{
printf("In func2\n");
}
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
__declspec(deprecated) void func1(int)
{
printf("In func2\n");
}
This seems to not work in g++ but thanks for putting me on the right track.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
Anything starting with two underscores is compiler specific.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
<br />
#include "stdafx.h"<br />
#include "OpenGl.h"<br />
#include "creatfoufou.h"<br />
#include "foufou.h"<br />
<br />
#include <math.h><br />
<br />
#ifdef _DEBUG<br />
#undef THIS_FILE<br />
static char THIS_FILE[]=__FILE__;<br />
#define new DEBUG_NEW<br />
#endif<br />
<br />
<br />
creatfoufou::creatfoufou()<br />
{<br />
<br />
}<br />
<br />
creatfoufou::~creatfoufou()<br />
{<br />
<br />
}<br />
<br />
void creatfoufou::creatfou(int amount)<br />
{<br />
foufou *newfoufouPtr;<br />
int randomX,randomY,randomZ;<br />
int speed,steer;<br />
<br />
for(int index=0;index<amount;index++)<br />
{<br />
newfoufouPtr = new foufou();<br />
fou_caracter.push_back( newfoufouPtr );<br />
randomX = ( ( 1 + rand( ) % 900 ) - 450 );<br />
randomY = ( ( 1 + rand( ) % 100 ) - 50 );<br />
randomZ = ( ( 1 + rand( ) % 900 ) - 450 );<br />
<br />
setposition(randomX,randomY,randomZ);<br />
<br />
<br />
<br />
}<br />
}<br />
<br />
void creatfoufou::setposition(int newX, int newY, int newZ)<br />
{<br />
-->the mistak RePaint(randomX,randomY,randomZ);<br />
}<br />
and here when i declared
<br />
#include "stdafx.h"<br />
#include "OpenGl.h"<br />
#include "foufou.h"<br />
#include <gl/glut.h><br />
<br />
#ifdef _DEBUG<br />
#undef THIS_FILE<br />
static char THIS_FILE[]=__FILE__;<br />
#define new DEBUG_NEW<br />
#endif<br />
<br />
<br />
foufou::foufou()<br />
{<br />
<br />
}<br />
<br />
foufou::~foufou()<br />
{<br />
<br />
}<br />
<br />
<br />
<br />
GLfloat Material_Ambiante[]={0.5,0.5, 0.5, 1 };<br />
GLfloat Material_Difuse[]={0.5, 0.5, 0.5, 1};<br />
GLfloat Material_Specular[]={0.5, 0.5, 0.5, 1};<br />
<br />
<br />
<br />
<br />
GLfloat Light_Ambiante[]={0.2, 0.2, 0.2, 0.1};<br />
GLfloat Light_Difuse[]={0.5, 0.5, 0.5, 1.0 };<br />
GLfloat Light_Specular[]={1.0, 1.0, 1.1, 1.0 };<br />
GLfloat Light_Position[]={10, 12, 10, 1.0 };<br />
<br />
<br />
<br />
GLfloat Light_Direction[]={0.0,-1.0, 0.0, 1.0};<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
void foufou::Initial()<br />
{<br />
<br />
glMaterialfv( GL_FRONT, GL_AMBIENT, Material_Ambiante);<br />
glMaterialfv( GL_FRONT, GL_DIFFUSE, Material_Difuse);<br />
glMaterialfv( GL_FRONT, GL_SPECULAR,Material_Specular);<br />
glMaterialf( GL_FRONT, GL_SHININESS, 20);<br />
<br />
glLightfv( GL_LIGHT0, GL_AMBIENT,Light_Ambiante );<br />
glLightfv( GL_LIGHT0, GL_DIFFUSE, Light_Difuse );<br />
glLightfv( GL_LIGHT0, GL_SPECULAR, Light_Specular);<br />
glLightfv( GL_LIGHT0, GL_POSITION, Light_Position );<br />
<br />
<br />
<br />
<br />
glEnable( GL_LIGHTING );<br />
<br />
<br />
glEnable( GL_LIGHT0 );<br />
<br />
<br />
<br />
glEnable( GL_DEPTH_TEST );<br />
<br />
};<br />
<br />
void foufou::RePaint(int xpos,int ypos,int zpos)<br />
{<br />
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br />
<br />
<br />
glMatrixMode (GL_PROJECTION);<br />
glLoadIdentity ();<br />
<br />
<br />
<br />
gluPerspective (90, 1, 5, 50);<br />
gluLookAt (2,2, -15, -4,0.0, 1, 0.0, 1.0, 0.0 );<br />
<br />
<br />
glPushMatrix();<br />
<br />
<br />
<br />
glColorMaterial( GL_FRONT, GL_AMBIENT );<br />
glColor4f(0.5, 0.5, 0.6, 1.0 );<br />
glColorMaterial( GL_FRONT, GL_DIFFUSE );<br />
glColor4f( 0.5, 0.2, 0.8, 1.0 );<br />
glColorMaterial( GL_FRONT, GL_SPECULAR );<br />
glColor4f( 0.9, 0.8, 1.0, 1.0 );<br />
<br />
<br />
<br />
glTranslated(-xpos, ypos, zpos );<br />
glutSolidSphere(0.9,30,40);<br />
glDisable( GL_LIGHTING );<br />
<br />
glPopMatrix();<br />
<br />
<br />
<br />
<br />
<br />
SwapBuffers(wglGetCurrentDC());<br />
<br />
};<br />
|
|
|
|
|
Did this have anything to do with my thread? If so I can't see how.
-Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
Is there anyway to have a class defined within a namespace, and still use a forward declaration? Take the following example:
class myclass;
static void function(myclass *p);
namespace abc
{
class myclass
{
public:
int i;
};
};
using abc::myclass;
Compiling this with VC++ 6.0, I get error "C2874: using-declaration causes a multiple declaration of 'myclass'". Is there anyway around this? Does using namespaces mean you can no longer use forward declarations?
Thanks for your help.
|
|
|
|
|
You have to declare it like this
namespace abc
{
class myclass;
}
|
|
|
|
|
I have this dialog based project with a huge set of menus that I need to duplicate in my SDI. Can I just import them? If so how?????
|
|
|
|
|
with the SDI project open, open the dialog project's .RC file. Copy the menu ID's and paste them into your SDI project's resource window. Simple copy and paste.
|
|
|
|
|
Much obliged pardner!
|
|
|
|
|
I have an application that is sending data through a serial port. That is working fine, but I am now to the point where I need to read from the serial port. I same across a CSerial Class developed by P J Naughter and it works quite well. I have played around with the Read() function and it works as long as you call it when you know something has already hit the port.
The application I am using this in is just a very simple dialog application. How do I setup an event handler that can interupt my program when a byte has hit the serial port? I have looked at some various resources without success. Does anyone have an idea that could help?
Thanks
Kevin Shaffer
Student of Computer Science
University of Kansas
kshaff03@msn.com
|
|
|
|
|
One solution is to implement a non-blocking I/O model to communicate with the port. Microsoft published one solution using OVERLAPPED I/O.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
Kuphryn
|
|
|
|
|