Click here to Skip to main content
15,886,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Is there a ListCtrl like this? Pin
Hans Dietrich5-Feb-11 10:13
mentorHans Dietrich5-Feb-11 10:13 
AnswerRe: Is there a ListCtrl like this? Pin
Rolf Kristensen5-Feb-11 10:43
Rolf Kristensen5-Feb-11 10:43 
QuestionChoosing libraries for video project Pin
Member 37348905-Feb-11 4:33
Member 37348905-Feb-11 4:33 
AnswerRe: Choosing libraries for video project Pin
Code-o-mat5-Feb-11 6:19
Code-o-mat5-Feb-11 6:19 
QuestionHow to display jpg image in the CView Pin
yu-jian4-Feb-11 22:30
yu-jian4-Feb-11 22:30 
AnswerRe: How to display jpg image in the CView Pin
Code-o-mat4-Feb-11 23:03
Code-o-mat4-Feb-11 23:03 
AnswerRe: How to display jpg image in the CView Pin
Niklas L6-Feb-11 11:49
Niklas L6-Feb-11 11:49 
Questionc++ classes :( [SOLVED] Pin
csrss4-Feb-11 22:23
csrss4-Feb-11 22:23 
Here is what i am trying to do: create kind of a "supervisor class". Lets say, we got a class named "Parent", and, a class named "Child". Before initializing a "Child", we need to init "Parent" first. Parent has a boolean variable, which is going to be set to TRUE while initializing Parent class. Parent also has a function and a structure, which (function) should collect integers (into a structure), passed from Child class and then do some manipulations on these ints. So first, we initialize Parent, which sets boolean var to true. Next we initialize Child, which checks if Parent's boolean var is true. If it is, Child calls Parent's "collect" function and passes some random ints to it.. So my first approach was a creation of nested classes (here is some offtopic example):

class xxx
{
protected:
	int x;
	int y;
private:
public:
	int ddd;
	class ccc
	{
	protected:
	private:
	public:
		int sad()
		{
			printf("%d\r\n", ddd);
		}
		ccc(){}
		~ccc(){}
	};
	xxx()
	{
		ddd = 0;
		x = 10;
		y = 11;
	}
	~xxx()
	{
		x = 0;
		y = 0;
	}
};


In ccc::sad i cannot access var ddd from class xxx. Okay, so i have made it static. Now compiler is not pleased at all:

error LNK2001: unresolved external symbol "public: static int xxx::ddd" (?ddd@xxx@@2HA)

Alright, trying something different (this example is pretty much close to that, what i am about to achieve) :

namespace Some
{
	class q //parent, should collect information from a child
	{
	public:
		typedef struct _H
		{
			int l[];
		}
		H;
		H *h;
		int e;
		BOOL g;
		int inc_e(int i) // <- here we are collecting ints from a child
		{
			e++;
			h->l[e] = i;
			printf("i = %d\r\n", i);
			return 1;
		}
		int o()
		{ 
			printf("%d\r\n", e); return e; 
		}
		q(){ e = 0; g = TRUE; }
		~q(){ e = 0; g = FALSE; }
	};

	class w : q // child, should pass info to a parent
	{
	public:
		int i;
		int inc()
		{ 
                    if(g)
                    {
			i++;
			inc_e(i); // <- goes to parent class
                    } 
	            return 0; 
		}
		int some()
		{
			printf("%d\r\n", e); return 0;
		}
		w(){ i = 0; }
		~w(){}
	};
}


But that is all wrong again and i dont know again Unsure | :~
How to create such relation between two classes, so one can watch over another? I have tried some other ways, some simple things, like:
declare a variable in 1 class, then inherit another class from 1 class, then increment that val in child class. For example we got
int a = 1; in Parent class.
Incrementing this same "a" in a child, which inherits from parent (a++) class and then print out - fine, it increments in child class.
But it stays the same in Parent class (a = 1).
Thanks
011011010110000101100011011010000110100101101110
0110010101110011

AnswerRe: c++ classes :( Pin
Andrew Brock4-Feb-11 23:28
Andrew Brock4-Feb-11 23:28 
GeneralRe: c++ classes :( Pin
csrss5-Feb-11 0:28
csrss5-Feb-11 0:28 
AnswerRe: c++ classes :( [SOLVED] [modified] Pin
Stefan_Lang7-Feb-11 2:49
Stefan_Lang7-Feb-11 2:49 
QuestionHow can text formatting tool in EditBox? Pin
Le@rner4-Feb-11 19:37
Le@rner4-Feb-11 19:37 
AnswerRe: How can text formatting tool in EditBox? Pin
Andrew Brock4-Feb-11 20:04
Andrew Brock4-Feb-11 20:04 
Questionprogram whit c language Stepper Motor Control through Parallel Port. help Pin
saleheh4-Feb-11 19:10
saleheh4-Feb-11 19:10 
AnswerRe: program whit c language Stepper Motor Control through Parallel Port. help Pin
Andrew Brock4-Feb-11 19:56
Andrew Brock4-Feb-11 19:56 
GeneralRe: program whit c language Stepper Motor Control through Parallel Port. help Pin
saleheh4-Feb-11 21:15
saleheh4-Feb-11 21:15 
Questionc++ split fnction help Pin
ehsan161804-Feb-11 19:02
ehsan161804-Feb-11 19:02 
AnswerRe: c++ split fnction help REPOST Pin
Richard MacCutchan4-Feb-11 23:38
mveRichard MacCutchan4-Feb-11 23:38 
QuestionHow to add items to CListCtrl faster? Pin
includeh104-Feb-11 10:53
includeh104-Feb-11 10:53 
AnswerRe: How to add items to CListCtrl faster? Pin
Hans Dietrich4-Feb-11 11:24
mentorHans Dietrich4-Feb-11 11:24 
GeneralRe: How to add items to CListCtrl faster? Pin
Chris Meech4-Feb-11 12:16
Chris Meech4-Feb-11 12:16 
GeneralRe: How to add items to CListCtrl faster? Pin
includeh104-Feb-11 13:57
includeh104-Feb-11 13:57 
GeneralRe: How to add items to CListCtrl faster? Pin
Hans Dietrich4-Feb-11 14:25
mentorHans Dietrich4-Feb-11 14:25 
AnswerRe: How to add items to CListCtrl faster? Pin
User 74293384-Feb-11 11:56
professionalUser 74293384-Feb-11 11:56 
AnswerRe: How to add items to CListCtrl faster? Pin
Andrew Brock4-Feb-11 15:09
Andrew Brock4-Feb-11 15:09 

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.