<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Falsche Variablenwerte bei abgeleiteter Klasse]]></title><description><![CDATA[<p>ich hab eine wrapper klasse für windows fenster erstellt, davon eine abgeleitete klasse für eine scrollbar. das problem ist, dass trotz richtiger initialisierung immer irgendwelche falschen werte ausgegeben werden.<br />
die abgeleitete klasse heist ScrollBar und ist von WinWrap abgeleitet. der einzige konstruktor enthält zum beispiel das:</p>
<pre><code>this-&gt;scrollRange=1;
</code></pre>
<p>woanders im programm rufe ich dann erstmal das auf:</p>
<pre><code>WinWrap* scroller=mainWindow.searchChild((HWND)lParam);
	cons&lt;&lt;((ScrollBar*)scroller)-&gt;scrollRange&lt;&lt;&quot;\n&quot;;
</code></pre>
<p>statt 1 auszugeben wird irgendein gewaltiger int wert ausgegeben. wenn ich im konstruktor das direkt nach der zuweisung ausgebe, ist es richtig.<br />
mainWindow ist vom typ WinWrap und searchChild sieht so aus:</p>
<pre><code>WinWrap* WinWrap::searchChild(HWND hWnd)
{
	WinWrap* tmp;
	for(int i=0; i&lt;children.size();i++)
		if((tmp=children.at(i).searchChild(hWnd)))
			return tmp;
		else if(children.at(i).hWnd==hWnd)
			return &amp;children.at(i);
	return NULL;
}
</code></pre>
<p>children ist ein vector für WinWrap objekte.<br />
es wird nicht null zurückgegeben, das hab ich geprüft.<br />
also hab ich vieleicht bei der klassenvererbung irgendwas falsch verstanden oder was zum teufel läuft da wieder nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/310660/falsche-variablenwerte-bei-abgeleiteter-klasse</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 04:54:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/310660.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 Nov 2012 19:25:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:27:51 GMT]]></title><description><![CDATA[<p>ich hab eine wrapper klasse für windows fenster erstellt, davon eine abgeleitete klasse für eine scrollbar. das problem ist, dass trotz richtiger initialisierung immer irgendwelche falschen werte ausgegeben werden.<br />
die abgeleitete klasse heist ScrollBar und ist von WinWrap abgeleitet. der einzige konstruktor enthält zum beispiel das:</p>
<pre><code>this-&gt;scrollRange=1;
</code></pre>
<p>woanders im programm rufe ich dann erstmal das auf:</p>
<pre><code>WinWrap* scroller=mainWindow.searchChild((HWND)lParam);
	cons&lt;&lt;((ScrollBar*)scroller)-&gt;scrollRange&lt;&lt;&quot;\n&quot;;
</code></pre>
<p>statt 1 auszugeben wird irgendein gewaltiger int wert ausgegeben. wenn ich im konstruktor das direkt nach der zuweisung ausgebe, ist es richtig.<br />
mainWindow ist vom typ WinWrap und searchChild sieht so aus:</p>
<pre><code>WinWrap* WinWrap::searchChild(HWND hWnd)
{
	WinWrap* tmp;
	for(int i=0; i&lt;children.size();i++)
		if((tmp=children.at(i).searchChild(hWnd)))
			return tmp;
		else if(children.at(i).hWnd==hWnd)
			return &amp;children.at(i);
	return NULL;
}
</code></pre>
<p>children ist ein vector für WinWrap objekte.<br />
es wird nicht null zurückgegeben, das hab ich geprüft.<br />
also hab ich vieleicht bei der klassenvererbung irgendwas falsch verstanden oder was zum teufel läuft da wieder nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271853</guid><dc:creator><![CDATA[Francis123]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:27:51 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:31:22 GMT]]></title><description><![CDATA[<p>Zeig.Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271857</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:39:41 GMT]]></title><description><![CDATA[<p>rede normal mit mir oder lass es gleich sein. welchen teil der über 1000 zeilen soll ich hier posten damit sich überhaupt irgendwer das anschaut? ich bin sowieso schon fertig mit den nerven wegen dem gottverdammten c++ der immer probleme macht.<br />
hier:</p>
<pre><code>//main.cpp

LRESULT CALLBACK WndProc01(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

WinWrap mainWindow;
HHOOK hHook;

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     PSTR szCmdLine, int iCmdShow)
{	
   mainWindow=WinWrap(
	NULL,
	&quot;myWindowClass&quot;,
	&quot;mainWindow&quot;,
	WS_OVERLAPPEDWINDOW,
	100,100,300,300,
	NULL,
	NULL,
	hInstance
		);
   mainWindow.i_register(WndProc01);
   mainWindow.createWindow();
   mainWindow.showWindow(1);

	mainWindow.msgLoop();

	return 0;
}
</code></pre>
<pre><code>//WinWrap.h inklusive ScrollBar klasse

#ifndef _WINWRAPPER_H_
#define _WINWRAPPER_H_

#include &lt;Windows.h&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &quot;Console.h&quot;

using namespace std;

extern const int BUTTON_WIDTH_01;
extern const int BUTTON_HEIGHT_01;
extern cout cons;
class WinWrap
{

public:	

//*************

  WinWrap* parent;

  DWORD dwExStyle;
  LPCTSTR lpClassName;
  LPCTSTR lpWindowName;
  DWORD dwStyle;

  LPVOID lpParam;

	static const int ALIGN_RIGHT=-1;
	static const int ALIGN_LEFT=-2;
	static const int ALIGN_TOP=-2;
	static const int ALIGN_BOTTOM=-1;
	static const int ALIGN_CENTER=0;

	int align_x;
	int align_y;

//****
	  int x;
	  int y;
	  int nWidth;
	  int nHeight;

	  int shift_x;
	  int shift_y;

	  HINSTANCE hInstance;

	  HWND hWndParent;

      HMENU hMenu;

	  vector&lt;WinWrap&gt; children; 

//***********

	//window handle
	HWND hWnd;	
    MSG msg;	
    WNDCLASSEX wcls;

	//messageloop laufen lassen?
	bool b_msgLoop;		

	//messages annehmen?
	bool b_msgAccept; 

	WinWrap(
  DWORD dwExStyle,
  LPCTSTR lpClassName,
  LPCTSTR lpWindowName,
  DWORD dwStyle,
  int x,
  int y,
  int nWidth,
  int nHeight,
  HWND hWndParent=NULL,
  HMENU hMenu=NULL,
  HINSTANCE hInstance=NULL,
  LPVOID lpParam=NULL,
  BOOL start=FALSE
  );

	WinWrap(){};

	//Button
WinWrap(
		HWND hWndParent,
		LPCSTR lpWindowName,
		HMENU hMenu,
		int x,
		int y,
		int align_x= ALIGN_LEFT, int align_y=ALIGN_TOP, 
		int w=BUTTON_WIDTH_01,
		int h=BUTTON_HEIGHT_01,
		DWORD dwStyle=WS_CHILD | BS_PUSHBUTTON,
		LPCSTR lpClassName=&quot;button&quot;
		);

	//alle variablen initialisieren
	int init(
  DWORD dwExStyle,
  LPCTSTR lpClassName,
  LPCTSTR lpWindowName,
  DWORD dwStyle,
  int x,
  int y,
  int nWidth,
  int nHeight,
  HWND hWndParent=NULL,
  HMENU hMenu=NULL,
  HINSTANCE hInstance=NULL,
  LPVOID lpParam=NULL,
  BOOL start=false
	);

	WinWrap* searchChild(LPTSTR lpWindowName);
	WinWrap* searchChild(HMENU hMenu);
	WinWrap* searchChild(HWND hWnd);

	int start(int iCmdShow=1, WNDPROC proc=NULL);

	int i_register(WNDPROC proc);

	int msgLoop();

	//text, id, x, y, dword style, alignx, aligny, width, height
	int addChild(LPCSTR text, int id, int x, int y,DWORD style= WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, int align_x=ALIGN_LEFT, int align_y=ALIGN_TOP, int width=BUTTON_WIDTH_01, int height=BUTTON_HEIGHT_01); 

	WinWrap* addChild(WinWrap&amp; child);

	int updateChildren();

	int update(const WinWrap* parent);

	int createWindow();

	int showWindow(int iCmdShow){	return ShowWindow(hWnd, iCmdShow);	};

	//**** getters &amp; setters 

	int getWidth(){return nWidth;}
	int getHeight(){return nHeight;}

	int getShiftX()const {return shift_x;}
	int getShiftY()const {return shift_y;}

	int getX()const{return x;};
	int getY()const{return y;};

	void setWidth(int n){nWidth=n;}
	void setHeight(int n){nHeight=n;}

	void setX(int n){x=n;}
	void setY(int n){y=n;}

	void setShiftX(int n) {shift_x=n;}
	void setShiftY(int n){shift_y=n;}

	int getXifChild() const {return parent?getX()+getShiftX():0;}

	int getYifChild() const {return parent?getY()+getShiftY():0;}

	WinWrap* getLastChild() {	  return children.size()&gt;0?&amp;children.at(children.size()-1):NULL;	}
		//Letztes Child aus dem Vector zurückgeben oder NULL wenn leer
};

class ScrollBar:public WinWrap
{

public:
	int scrollRange;
	int scrollPos;
	int scrollStep;

	int max_w;
	int max_h;

	LPCSTR asdf;

	ScrollBar(DWORD orientation, int x, int y, int w, int h, HWND hWndParent, HINSTANCE hInstance );	

	int getScrollRange ()const{return scrollRange;}
	int getScrollPos() const {return scrollPos;}
	int getScrollStep() const {scrollStep;}

	void setScrollRange(int n) {scrollRange=n; if(hWnd){cons&lt;&lt;&quot;setScrollRange:&quot;&lt;&lt;SetScrollRange(hWnd,SB_CTL,0,n,true)&lt;&lt;&quot;|&quot;&lt;&lt;GetLastError()&lt;&lt;&quot;\n&quot;;}}
	void setScrollPos(int n);
	void setScrollStep(int n){this-&gt;scrollStep=n;}

	int update(const WinWrap* parent);

	LRESULT defaultProc(DWORD wParam);

	int createWindow();

	int init(
	  DWORD dwExStyle,
	  LPCTSTR lpClassName,
	  LPCTSTR lpWindowName,
	  DWORD dwStyle,
	  int x,
	  int y,
	  int nWidth,
	  int nHeight,
	  HWND hWndParent=NULL,
	  HMENU hMenu=NULL,
	  HINSTANCE hInstance=NULL,
	  LPVOID lpParam=NULL,
	   BOOL start=false,
	  int scrollRange=5,
	  int scrollStep=1,
	  int scrollPos=1
	);

};

WNDCLASSEX getDefaultWCLS(WNDPROC WndProc, HINSTANCE hInst, LPCSTR lpszAppName);

#endif
</code></pre>
<pre><code>//WinWrap.cpp
#include &lt;Windows.h&gt;
#include &lt;string&gt;
#include &quot;WinWrap.h&quot;
#include &quot;Console.h&quot;
#include &lt;vector&gt;
#include &quot;Global.h&quot;

using namespace std;

extern cout cons;
extern const int BUTTON_WIDTH_01 ;
extern const int BUTTON_HEIGHT_01 ;
extern WinWrap mainWindow;
LRESULT CALLBACK WndProc01(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);		//WndProc.cpp

 WinWrap::WinWrap(
  DWORD dwExStyle,
  LPCTSTR lpClassName,
  LPCTSTR lpWindowName,
  DWORD dwStyle,
  int x,
  int y,
  int nWidth,
  int nHeight,
  HWND hWndParent,
  HMENU hMenu,
  HINSTANCE hInstance,
  LPVOID lpParam,
  BOOL start
  )
	{
		init(dwExStyle, lpClassName, lpWindowName, dwStyle, x,y,nWidth, nHeight, hWndParent, hMenu, hInstance);
		parent=NULL;
		cons&lt;&lt;&quot;Window &quot;&lt;&lt;lpWindowName&lt;&lt;&quot; created\n&quot;;
	}

 WinWrap::WinWrap(
		HWND hWndParent,
		LPCSTR lpWindowName,
		HMENU hMenu,
		int x,
		int y,
		int align_x, int align_y, 
		int nWidth,
		int nHeight,
		DWORD dwStyle,
		LPCSTR lpClassName
		)
 {
	init(NULL, lpClassName, lpWindowName, dwStyle, x,y, nWidth, nHeight, hWndParent, hMenu, NULL,NULL);
 }

 //*************initialisierung*********
 int WinWrap::init(
   DWORD dwExStyle,
  LPCTSTR lpClassName,
  LPCTSTR lpWindowName,
  DWORD dwStyle,
  int x,
  int y,
  int nWidth,
  int nHeight,
  HWND hWndParent,
  HMENU hMenu,
  HINSTANCE hInstance,
  LPVOID lpParam,
  BOOL start)
 {
	 	this-&gt;dwExStyle=dwExStyle;
		this-&gt;lpClassName=lpClassName;
		this-&gt;lpWindowName=lpWindowName;
		this-&gt;dwStyle=dwStyle;
		this-&gt;shift_x=x;		//x wird nur dynamisch vom programm geändert
		this-&gt;shift_y=y;
		this-&gt;nWidth=nWidth;
		this-&gt;nHeight=nHeight;
		this-&gt;hWndParent=hWndParent;
		this-&gt;hMenu=hMenu;
		this-&gt;hInstance=hInstance;
		this-&gt;lpParam=lpParam;

		this-&gt;x=0;
		this-&gt;y=0;

		this-&gt;b_msgAccept=true;
		this-&gt;b_msgLoop=true;

			if(start)
			this-&gt;start();

			return 1;
 }
 //*********************

int WinWrap::i_register(WNDPROC proc)
{
	cons&lt;&lt;&quot;Registrating window &quot;&lt;&lt;lpWindowName&lt;&lt;&quot;\n&quot;;
		this-&gt;wcls=::getDefaultWCLS(proc, this-&gt;hInstance, this-&gt;lpClassName);
	    if(RegisterClassEx(&amp;(this-&gt;wcls)))		//muss vor createwindowex passieren
			return 0;
		else
		return 1;
}

WinWrap* WinWrap::searchChild(LPTSTR lpWindowName)
{
	for(int i=0; i&lt;children.size();i++)
		if(wcscmp((WCHAR*)children.at(i).lpWindowName, (WCHAR*)lpWindowName))
			return &amp;children.at(i);

	return NULL;
}

WinWrap* WinWrap::searchChild(HWND hWnd)
{
	WinWrap* tmp;
	for(int i=0; i&lt;children.size();i++)
		if((tmp=children.at(i).searchChild(hWnd)))
			return tmp;
		else if(children.at(i).hWnd==hWnd)
			return &amp;children.at(i);
	return NULL;
}

WinWrap* WinWrap::searchChild(HMENU hMenu)
{
	for(int i=0; i&lt;children.size(); i++)
		if(children.at(i).hMenu==hMenu)
			return &amp;children.at(i);
	return NULL;
}

int WinWrap::addChild(LPCSTR text,int id,  int x, int y,DWORD style,int align_x, int align_y, int width, int height)
{
	WinWrap Button=WinWrap(NULL, &quot;button&quot;, text, style, x,y,width,height, hWnd, (HMENU)id, hInstance, NULL,0 );
	Button.align_x=align_x;
	Button.align_y=align_y;

	Button.start(1, 0);
	children.push_back(Button);
	updateChildren();

	return 0;
}

WinWrap* WinWrap::addChild(WinWrap&amp; child)
{
	cons&lt;&lt;&quot;addChild(&quot;&lt;&lt;child.lpClassName&lt;&lt;&quot;/&quot;&lt;&lt;child.lpWindowName&lt;&lt;&quot;)\n&quot;;
	child.parent=this;
	child.createWindow();
	child.showWindow(1);
	WinWrap child_2(child);
	children.push_back(child_2);
	cons&lt;&lt;&quot;&amp;child: &quot;&lt;&lt;&amp;child_2&lt;&lt;&quot;\n&quot;;
	return &amp;children.at(children.size()-1);
}

int WinWrap::updateChildren()
{
	cons&lt;&lt;&quot;*********updating children of &quot;&lt;&lt;lpWindowName&lt;&lt;&quot; *********\n&quot;;
	cons&lt;&lt;&quot;this: &quot;&lt;&lt;this&lt;&lt;&quot;\n&quot;;
	cons&lt;&lt;&quot;children: &quot;&lt;&lt;children.size()&lt;&lt;&quot;\n&quot;;
	for(int i=0; i&lt;children.size();i++)
	{		
		children.at(i).update(this);
		children.at(i).updateChildren();
	}
	cons&lt;&lt;&quot;***************************************\n&quot;;
	return 0;
	}

	int WinWrap::update( const WinWrap* p)
	{
		cons&lt;&lt;&quot;------------------updating &quot;&lt;&lt;lpWindowName&lt;&lt;&quot;------------------\n&quot;;
		RECT parent;

		if(!GetClientRect(p-&gt;hWnd, &amp;parent))
		{
			cons&lt;&lt;&quot;HWND:&quot;&lt;&lt;p-&gt;hWnd&lt;&lt;&quot;\n&quot;;
			cons&lt;&lt;&quot;Error:&quot;&lt;&lt;GetLastError()&lt;&lt;&quot;\n&quot;;
			return 9;
		}

	cons&lt;&lt;&quot;ClientArea: &quot;&lt;&lt;parent.left&lt;&lt;&quot;|&quot;&lt;&lt;parent.top&lt;&lt;&quot;/&quot;&lt;&lt;parent.right&lt;&lt;&quot;|&quot;&lt;&lt;parent.bottom&lt;&lt;&quot;::: width/height: &quot;&lt;&lt;getRectWidth(&amp;parent)&lt;&lt;&quot;/&quot;&lt;&lt;getRectHeight(&amp;parent)&lt;&lt;&quot;\n&quot;;

		int x,y;

			if(align_x== ALIGN_RIGHT)
				setX(getRectWidth(&amp;parent)-getWidth()+p-&gt;getXifChild());
			else if(align_x==ALIGN_CENTER)
				setX((getRectWidth(&amp;parent)/2)-(getWidth()/2)+p-&gt;getXifChild());
			else
				setX(p-&gt;getXifChild());

			if(align_y==ALIGN_BOTTOM)
				setY(getRectHeight(&amp;parent)-getHeight()+p-&gt;getYifChild());
			else if(align_y== ALIGN_CENTER)
				setY((getRectHeight(&amp;parent)/2)-(getHeight()/2)+(p-&gt;getYifChild()));
			else
				setY(p-&gt;getYifChild());

			cons&lt;&lt;&quot;Updating finished.\n&quot;;
			cons&lt;&lt;&quot;setWindowPos:&quot;&lt;&lt;
			SetWindowPos(hWnd, 0, getX()+getShiftX(),getY()+getShiftY(), getWidth(), getHeight(), NULL)
			&lt;&lt;&quot;\n&quot;;
			cons&lt;&lt;&quot;x= &quot;&lt;&lt;getX()&lt;&lt;&quot; | y = &quot;&lt;&lt;getY()&lt;&lt;&quot;\n&quot;;
				cons&lt;&lt;&quot;------------------------------------\n&quot;;
			return 1;
	}

	int WinWrap::createWindow()
	{
		if(!(this-&gt;hWnd=CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, shift_y, shift_y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)))
			return 0;
		return 1;
	}

BOOL WinWrap::start(int iCmdShow, WNDPROC proc)
{

if(proc)
	i_register(proc);

if(!(this-&gt;hWnd=CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)))
		return 421;
else
	cons&lt;&lt;&quot;Starting window &quot;&lt;&lt;this-&gt;lpWindowName&lt;&lt;&quot;: &quot;&lt;&lt;GetLastError()&lt;&lt;&quot;\n&quot;;

     ShowWindow(hWnd, iCmdShow);			//http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
	 UpdateWindow(hWnd);

	 return 1;
}

int WinWrap::msgLoop()
{
	while (this-&gt;b_msgLoop &amp;&amp; GetMessage(&amp;msg, NULL, 0, 0) &gt; 0)		//http://msdn.microsoft.com/en-us/library/windows/desktop/ms644936%28v=vs.85%29.aspx
    {
		if(this-&gt;b_msgAccept)
		{
        TranslateMessage(&amp;msg);
        DispatchMessage(&amp;msg);
		}
		else
			Sleep(50);
	}
	return 1;
}

::WNDCLASSEX getDefaultWCLS(WNDPROC WndProc, HINSTANCE hInst, LPCSTR lpszAppName)
{
	WNDCLASSEX wc={0};

	wc.hInstance=hInst;
	wc.cbSize        =  sizeof(WNDCLASSEX);
    wc.style         =  CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   =  WndProc;
    wc.cbClsExtra    =  0;
    wc.cbWndExtra    =  0;
    wc.hCursor       =  LoadCursor(NULL,IDC_ARROW);
    wc.hIcon         =  LoadIcon(NULL, IDI_APPLICATION);
    wc.hbrBackground =  (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszClassName =  lpszAppName;
	//wc.lpszMenuName =	MAKEINTRESOURCE(ID_MENU_01);
	//wc.lpszMenuName	=	lpszAppName;
	wc.hIconSm       =  LoadIcon(NULL, IDI_APPLICATION);

	return wc;
}
</code></pre>
<pre><code>//ScrollBar.cpp
#include &lt;Windows.h&gt;
#include &lt;string&gt;
#include &quot;WinWrap.h&quot;
#include &quot;Console.h&quot;
#include &lt;vector&gt;
#include &quot;Global.h&quot;

extern cout cons;

ScrollBar::ScrollBar(DWORD orientation, int x, int y, int w, int h, HWND hWndParent, HINSTANCE hInstance )
{
	init(NULL, &quot;SCROLLBAR&quot;, &quot;default&quot;, orientation|WS_CHILD|WS_VISIBLE, x,y,w,h,hWndParent, NULL, hInstance, NULL);
	this-&gt;scrollStep=1;
	cons&lt;&lt;&quot;ScrollStep after setting to 1: &quot;&lt;&lt;this-&gt;scrollStep&lt;&lt;&quot;\n&quot;;
	cons&lt;&lt;&quot;Creating Scrollbar\n&quot;;

}

	int ScrollBar::update(const WinWrap* parent)
	{
		WinWrap::update(parent);
	}

	LRESULT ScrollBar::defaultProc(DWORD wParam)
	{
		cons&lt;&lt;&quot;Calling defaultProc. LOWORD(wParam)=&quot;&lt;&lt;LOWORD(wParam)&lt;&lt;&quot;\n&quot;;
			cons&lt;&lt;&quot;ScrollStep: &quot;&lt;&lt;scrollStep&lt;&lt;&quot;\n&quot;;
		switch(LOWORD(wParam))
			{
		     case SB_TOP:
                        setScrollPos(0);
                        break;

                case SB_LINEUP:
                        if (scrollPos &gt; 0)
                          setScrollPos(scrollPos-1);
                        break;

                case SB_THUMBPOSITION:
                        setScrollPos(HIWORD(wParam));
                        break;

                case SB_THUMBTRACK:

                        break;

                case SB_LINEDOWN:
                        if (scrollPos &lt; scrollRange)
                                setScrollPos(scrollPos+1);
                        break;

                case SB_BOTTOM:
                        setScrollPos(scrollRange);
                        break;

				case SB_PAGELEFT:		//klick in scrollbar shaft
						cons&lt;&lt;&quot;scrollStep:&quot;&lt;&lt;scrollStep&lt;&lt;&quot;\n&quot;;
						setScrollPos(getScrollPos()-scrollStep);
						break;

				case SB_PAGERIGHT:
						setScrollPos(getScrollPos()+scrollStep);
						break;

                case SB_ENDSCROLL:
                        break;
		}
		return 0;
	}

	void ScrollBar::setScrollPos(int n)
	{
		cons&lt;&lt;&quot;setting scrollPos to &quot;&lt;&lt;n&lt;&lt;&quot;\n&quot;;
		if(n&lt;0)
			scrollPos=0;
		else if(n&gt;scrollRange)
			scrollPos=scrollRange;
		else
			scrollPos=n;

		cons&lt;&lt;&quot;scrollPos=&quot;&lt;&lt;scrollPos&lt;&lt;&quot;\n&quot;;
		if(hWnd)
			{
			cons&lt;&lt;&quot;scrollRange:&quot;&lt;&lt;getScrollRange()&lt;&lt;&quot;\n&quot;;
			cons&lt;&lt;&quot;return of SetScrollPos:&quot;&lt;&lt;SetScrollPos(hWnd, SB_CTL, getScrollPos(), TRUE)&lt;&lt;&quot;\n&quot;;
			cons&lt;&lt;&quot;error:&quot;&lt;&lt;GetLastError()&lt;&lt;&quot;\n&quot;;
			}
		else
			cons&lt;&lt;&quot;HWND==NULL\n&quot;;
	}

int ScrollBar::init(
  DWORD dwExStyle,
  LPCTSTR lpClassName,
  LPCTSTR lpWindowName,
  DWORD dwStyle,
  int x,
  int y,
  int nWidth,
  int nHeight,
  HWND hWndParent,
  HMENU hMenu,
  HINSTANCE hInstance,
  LPVOID lpParam,
  BOOL start,
  int scrollRange,
  int scrollStep,
  int scrollPos
	)
{
	WinWrap::init(NULL, lpClassName, lpWindowName, dwStyle, x,y, nWidth, nHeight, hWndParent, hMenu,hInstance,NULL,start);
	setScrollRange(scrollRange);
	setScrollStep(scrollStep);
	setScrollPos(scrollPos);

	this-&gt;max_w=-1;
	this-&gt;max_h=-1;

		cons&lt;&lt;&quot;ScrollStep after setting to 1: &quot;&lt;&lt;this-&gt;scrollStep&lt;&lt;&quot;\n&quot;;
	return 1;
}
</code></pre>
<pre><code>WndProc.cpp
#include &lt;Windows.h&gt;
#include &lt;string&gt;
#include &lt;stdio.h&gt;
#include &quot;resource.h&quot;
#include &quot;WinWrap.h&quot;
#include &quot;Global.h&quot;

using namespace std;
extern cout cons;

	typedef BOOL (*UninstallHook)(void);
	extern UninstallHook UninstHook(0);
	extern WinWrap mainWindow;

	HWND hWndBar;

LRESULT CALLBACK WndProc01(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
		HDC hdc;
		PAINTSTRUCT ps;
		RECT rect;

		static const WCHAR* text={L&quot;Dies ist ein \nverdammter test text \num das winapi\n zu testen...äöü&quot;};
		static int cxChar, cyChar;

		HWND hWndScroller;
		SCROLLINFO si;
		int CurPos;
		char strPosition[20];

		hWndScroller=GetDlgItem(hWnd, IDC_SCROLLER);

		switch(msg)
		{

		case WM_INITDIALOG:
			cons&lt;&lt;&quot;WM_INITDIALOG| msg = &quot;&lt;&lt;msg&lt;&lt;&quot; | wParam = &quot;&lt;&lt;(char)wParam&lt;&lt;&quot; | lParam = &quot;&lt;&lt;lParam&lt;&lt;&quot;\n&quot;;
			break;

		case WM_HSCROLL:		//lParam==HWND !!
		case WM_VSCROLL:
			{
				cons&lt;&lt;&quot;WM_HSCROLL oder WM_HSCROLL\n&quot;;
			WinWrap* scroller=mainWindow.searchChild((HWND)lParam);
			if(!scroller)
				break;
			cons&lt;&lt;&quot;????????___&quot;&lt;&lt;((ScrollBar*)scroller)-&gt;asdf&lt;&lt;&quot;\n&quot;;		
			cons&lt;&lt;&quot;????????___&quot;&lt;&lt;((ScrollBar*)scroller)-&gt;scrollRange&lt;&lt;&quot;\n&quot;;		

			((ScrollBar*)scroller)-&gt;defaultProc(wParam);

					  sprintf(strPosition, &quot;%d&quot;, CurPos);
			     SetDlgItemText(hWnd, IDC_LABEL, strPosition);
			return 0;
			}
		case WM_COMMAND:

			cons&lt;&lt;&quot;WM_COMMAND| msg = &quot;&lt;&lt;msg&lt;&lt;&quot; | wParam = &quot;&lt;&lt;(char)wParam&lt;&lt;&quot; | lParam = &quot;&lt;&lt;lParam&lt;&lt;&quot;\n&quot;;
			switch(LOWORD(wParam))
			{

			}

			return 0;
		case WM_KEYDOWN:	
			cons&lt;&lt;&quot;WM_KEYDOWN| msg = &quot;&lt;&lt;msg&lt;&lt;&quot; | wParam = &quot;&lt;&lt;(char)wParam&lt;&lt;&quot; | lParam = &quot;&lt;&lt;lParam&lt;&lt;&quot;\n&quot;;
			DialogBox(mainWindow.hInstance, MAKEINTRESOURCE(IDD_CONTROLS_DLG), NULL,(DLGPROC)WndProc01);
			return 0;

		case WM_MOVE:

			RECT r_move;
			GetWindowRect(hWnd, &amp;r_move);
			mainWindow.setX(LOWORD(lParam));
			mainWindow.setY(HIWORD(lParam));

			return 0;

		case WM_SIZE:
			//cons&lt;&lt;&quot;WM_SIZING| msg = &quot;&lt;&lt;msg&lt;&lt;&quot; | wParam = &quot;&lt;&lt;(char)wParam&lt;&lt;&quot; | lParam = &quot;&lt;&lt;lParam&lt;&lt;&quot;\n&quot;;
			RECT r;
			RECT c;
			GetClientRect(hWnd,&amp;c);
			GetWindowRect(hWnd, &amp;r);
			mainWindow.nWidth=r.right-r.left;
			mainWindow.nHeight=r.bottom-r.top;
			mainWindow.updateChildren();

			//SetWindowPos(hWndBar, NULL, 0,0, getRectWidth(&amp;c), 20,NULL);

			return 0;

		case WM_CREATE:
			{
			cons&lt;&lt;&quot;WM_CREATE | msg = &quot;&lt;&lt;msg&lt;&lt;&quot; | wParam = &quot;&lt;&lt;(char)wParam&lt;&lt;&quot; | lParam = &quot;&lt;&lt;lParam&lt;&lt;&quot;\n&quot;;

			//****SCROLLBAR EXPERIMENTING**
			//****

			TEXTMETRIC tm;
			hdc=GetDC(hWnd);

			GetTextMetrics(hdc, &amp;tm);
			cxChar=tm.tmAveCharWidth;
			cyChar=tm.tmHeight;

			ReleaseDC(hWnd, hdc);
//*************************ADDING ELEMENTS*****************

	   SetScrollRange(hWndBar,SB_CTL, 0, 100, false); 

			//*********
				ScrollBar scrollBar(SBS_HORZ, 0, 0, 200,20, hWnd, mainWindow.hInstance);
				if(!mainWindow.addChild(scrollBar))
					cons&lt;&lt;&quot;addind scrollbar failed\n&quot;;
				scrollBar.setScrollRange(100);

				WinWrap* tmpWin;

				WinWrap window_template=WinWrap(
				NULL,
				&quot;button&quot;,
				&quot;myControl&quot;,
				dwGroupBoxStyle,			
				MARGIN_DEFAULT,		//x
				-MARGIN_DEFAULT,		//y
				2*BUTTON_WIDTH_01+3*MARGIN_DEFAULT  ,		//width 
				2*BUTTON_HEIGHT_01,		//height
				hWnd,		//parent
				(HMENU)0);
				window_template.align_x=WinWrap::ALIGN_LEFT;
				window_template.align_y=WinWrap::ALIGN_BOTTOM;

				tmpWin=mainWindow.addChild(window_template);

				window_template.setY(MARGIN_DEFAULT_02);
				window_template.setWidth(BUTTON_WIDTH_01);
				window_template.setHeight(BUTTON_HEIGHT_01);
				window_template.dwStyle=dwButtonStyle;
				window_template.lpWindowName=&quot;Add&quot;;
				window_template.hMenu=(HMENU)ID_BUTTON_ADD;
				window_template.align_x=WinWrap::ALIGN_CENTER;
				window_template.align_y=WinWrap::ALIGN_CENTER;
				window_template.setShiftX(window_template.getWidth()/2+MARGIN_DEFAULT/2);
				window_template.setShiftY(4);

				tmpWin-&gt;addChild(window_template);

				window_template.lpWindowName=&quot;Edit&quot;;
				window_template.hMenu=(HMENU)ID_BUTTON_EDIT;	
				window_template.setShiftX(-window_template.getWidth()/2-MARGIN_DEFAULT/2);

				tmpWin-&gt;addChild(window_template);

//**************************/ADDING ELEMENTS*****************

			return 0;
			}

		case WM_PAINT:

			hdc=BeginPaint(hWnd, &amp;ps);
			GetClientRect(hWnd, &amp;rect);

			//TextOut(hdc, 0,0, (LPCSTR)text, wcslen(text)*2);
			//DrawText(hdc, TEXT(&quot;text&quot;), -1, &amp;rect, DT_SINGLELINE );
			EndPaint(hWnd, &amp;ps);
			return 0;
		case WM_DESTROY:
			UninstHook();
			PostQuitMessage(0);
			return 0;

		}

		return DefWindowProc(hWnd, msg, wParam, lParam);
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2271860</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271860</guid><dc:creator><![CDATA[Francis123]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:47:41 GMT]]></title><description><![CDATA[<p>Versuch mal, deinen Code auf ein Minimalbeispiel zu reduzieren (<a href="http://www.c-plusplus.net/forum/304133" rel="nofollow">http://www.c-plusplus.net/forum/304133</a>). Eventuell findest du das Problem, dass du mit dem bösen C++ hast, dann schon selbst. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271863</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271863</guid><dc:creator><![CDATA[Dobi]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:47:41 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:49:03 GMT]]></title><description><![CDATA[<p>kann man überhaupt in einen Vector für eine klasse objekte einer abgeleiteten klasse speichern? die funktion der abgeleiteten klasse wird nach dem cast zumindest aufgerufen, aber die verfluchten variablen haben falsche werte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271864</guid><dc:creator><![CDATA[Francis123]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:49:03 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:51:35 GMT]]></title><description><![CDATA[<blockquote>
<p>der einzige konstruktor enthält zum beispiel das</p>
</blockquote>
<pre><code>ScrollBar::ScrollBar(DWORD orientation, int x, int y, int w, int h, HWND hWndParent, HINSTANCE hInstance )
{
    init(NULL, &quot;SCROLLBAR&quot;, &quot;default&quot;, orientation|WS_CHILD|WS_VISIBLE, x,y,w,h,hWndParent, NULL, hInstance, NULL);
    this-&gt;scrollStep=1;
    cons&lt;&lt;&quot;ScrollStep after setting to 1: &quot;&lt;&lt;this-&gt;scrollStep&lt;&lt;&quot;\n&quot;;
    cons&lt;&lt;&quot;Creating Scrollbar\n&quot;;

}
</code></pre>
<p>Wo?</p>
<p>Du änderst diesen Wert nur in der init() Methode und die rufst du hier</p>
<pre><code>case WM_VSCROLL:
            {
                cons&lt;&lt;&quot;WM_HSCROLL oder WM_HSCROLL\n&quot;;
            WinWrap* scroller=mainWindow.searchChild((HWND)lParam);
            if(!scroller)
                break;
            cons&lt;&lt;&quot;????????___&quot;&lt;&lt;((ScrollBar*)scroller)-&gt;asdf&lt;&lt;&quot;\n&quot;;        
            cons&lt;&lt;&quot;????????___&quot;&lt;&lt;((ScrollBar*)scroller)-&gt;scrollRange&lt;&lt;&quot;\n&quot;;     

            ((ScrollBar*)scroller)-&gt;defaultProc(wParam);

                      sprintf(strPosition, &quot;%d&quot;, CurPos);
                 SetDlgItemText(hWnd, IDC_LABEL, strPosition);
            return 0;
            }
</code></pre>
<p>doch gar nicht auf <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Oder stammt der Code, den du gepostet hast nicht von dieser Stelle?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271865</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271865</guid><dc:creator><![CDATA[Der Tobi]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:51:35 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 19:54:08 GMT]]></title><description><![CDATA[<p>Der Tobi schrieb:</p>
<blockquote>
<blockquote>
<p>der einzige konstruktor enthält zum beispiel das</p>
</blockquote>
<pre><code>ScrollBar::ScrollBar(DWORD orientation, int x, int y, int w, int h, HWND hWndParent, HINSTANCE hInstance )
{
    init(NULL, &quot;SCROLLBAR&quot;, &quot;default&quot;, orientation|WS_CHILD|WS_VISIBLE, x,y,w,h,hWndParent, NULL, hInstance, NULL);
    this-&gt;scrollStep=1;
    cons&lt;&lt;&quot;ScrollStep after setting to 1: &quot;&lt;&lt;this-&gt;scrollStep&lt;&lt;&quot;\n&quot;;
    cons&lt;&lt;&quot;Creating Scrollbar\n&quot;;
 
}
</code></pre>
<p>Wo?</p>
<p>Du änderst diesen Wert nur in der init() Methode und die rufst du hier</p>
<pre><code>case WM_VSCROLL:
            {
                cons&lt;&lt;&quot;WM_HSCROLL oder WM_HSCROLL\n&quot;;
            WinWrap* scroller=mainWindow.searchChild((HWND)lParam);
            if(!scroller)
                break;
            cons&lt;&lt;&quot;????????___&quot;&lt;&lt;((ScrollBar*)scroller)-&gt;asdf&lt;&lt;&quot;\n&quot;;        
            cons&lt;&lt;&quot;????????___&quot;&lt;&lt;((ScrollBar*)scroller)-&gt;scrollRange&lt;&lt;&quot;\n&quot;;     
 
            ((ScrollBar*)scroller)-&gt;defaultProc(wParam);
                
 
                      sprintf(strPosition, &quot;%d&quot;, CurPos);
                 SetDlgItemText(hWnd, IDC_LABEL, strPosition);
            return 0;
            }
</code></pre>
<p>doch gar nicht auf <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Oder stammt der Code, den du gepostet hast nicht von dieser Stelle?</p>
</blockquote>
<p>das im startpost ist abgeändert als beispiel, aber jede variable der abgeleiteten klasse wird nach dem scheiß cast falsch ausgegeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271867</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271867</guid><dc:creator><![CDATA[Francis123]]></dc:creator><pubDate>Sat, 17 Nov 2012 19:54:08 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sat, 17 Nov 2012 20:05:44 GMT]]></title><description><![CDATA[<p>Deine searchChild-Methode gibt ein WinWrap* zurück. Du weist diesen Rückgabewert einen WinWrap* zurück. Wo zur Hölle sollen die Informationen für den Compiler herkommen, dass du eigentlich ein ScrollBar* haben wolltest? Der fügt die bei dem Cast doch nicht einfach so dazu. Allgemein deuten Casts an, dass du nie ein richtig gutes C++ Buch gelesen hast, denn dort wäre dir die Unnötigkeit von Casts erläutert worden.</p>
<p>tl;dr: WinWrap* scroller wird ein WinWrap* zugewiesen und du versuchst mit dem Cast einfach nur Compilererrors zu unterdrücken.</p>
<p>PS: Mach dir um Sone keine Gedanken, er will nur Aufmerksamkeit.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271869</guid><dc:creator><![CDATA[Der Tobi]]></dc:creator><pubDate>Sat, 17 Nov 2012 20:05:44 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sun, 18 Nov 2012 09:40:58 GMT]]></title><description><![CDATA[<p>wenn c++ primer kein gutes buch ist dann nein, ich hab nie ein gutes c++ buch gelesen.<br />
ich dachte ein pointer wär immer gleich, egal ob es ein int pointer ist oder ein pointer zu irgendeinem objekt, ist das nicht immer nur ein int wert? oder liegt das am vector objekt wo das zeug gespeichert ist?</p>
<p>ich hab hier die sache an nem beispiel getestet:</p>
<pre><code>testclass t01=testclass();
		testclass02 t02=testclass02();

		testclass* pt01=&amp;t02;

		cout&lt;&lt;&quot;t01: a=&quot;&lt;&lt;t01.a&lt;&lt;endl;
		cout&lt;&lt;&quot;t02: a=&quot;&lt;&lt;t02.a&lt;&lt;&quot; b=&quot;&lt;&lt;t02.b&lt;&lt;endl;

		cout&lt;&lt;&quot;pointers....&quot;&lt;&lt;endl;

		cout&lt;&lt;((testclass02*)pt01)-&gt;b&lt;&lt;endl;
</code></pre>
<p>und es funktioniert so mit cast. testclass hat ne variable namens a, testclass02 eine namens b. dem pointer auf testclass wird aber die adresse vom testclass02 objekt zugewiesen, und dann durch nen cast die variable b die nur in testclass02 vorhanden ist ausgegeben. die ausgabe ist immer richtig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271947</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271947</guid><dc:creator><![CDATA[Francis123]]></dc:creator><pubDate>Sun, 18 Nov 2012 09:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sun, 18 Nov 2012 12:05:58 GMT]]></title><description><![CDATA[<p>Nikolai schrieb:</p>
<blockquote>
<p>ch dachte ein pointer wär immer gleich, egal ob es ein int pointer ist oder ein pointer zu irgendeinem objekt, ist das nicht immer nur ein int wert?</p>
</blockquote>
<p>Na klar. Ein Pointer ist nur ein ganz normaler integraler Basisdatentyp, die Größe ist meistens 4 oder 8 Byte.<br />
Grob betrachtet können Pointer eben nur eine Adresse speichern.</p>
<p>Aber diese &quot;Gleichheit&quot; hört schon da auf, wo man die Pointer benutzt.</p>
<p>Nikolai schrieb:</p>
<blockquote>
<p>oder liegt das am vector objekt wo das zeug gespeichert ist?</p>
</blockquote>
<p>Wie meinst du das? <code>std::vector</code> selbst kann natürlich nicht beeinflussen, wo das Array liegt, den der Standardallokator soll laut Standard ausdrücklich den ganz normalen <code>new</code> -Operator verwenden.</p>
<p>Nikolai schrieb:</p>
<blockquote>
<p>ich hab hier die sache an nem beispiel getestet:</p>
<pre><code>testclass t01=testclass();
		testclass02 t02=testclass02();

		testclass* pt01=&amp;t02;
		
		cout&lt;&lt;&quot;t01: a=&quot;&lt;&lt;t01.a&lt;&lt;endl;
		cout&lt;&lt;&quot;t02: a=&quot;&lt;&lt;t02.a&lt;&lt;&quot; b=&quot;&lt;&lt;t02.b&lt;&lt;endl;
	
		cout&lt;&lt;&quot;pointers....&quot;&lt;&lt;endl;

		cout&lt;&lt;((testclass02*)pt01)-&gt;b&lt;&lt;endl;
</code></pre>
<p>und es funktioniert so mit cast. testclass hat ne variable namens a, testclass02 eine namens b. dem pointer auf testclass wird aber die adresse vom testclass02 objekt zugewiesen, und dann durch nen cast die variable b die nur in testclass02 vorhanden ist ausgegeben. die ausgabe ist immer richtig.</p>
</blockquote>
<p>Na ob das mal nicht UB ist...<br />
Aber klar, der Offset der Member ist in beiden Klassen natürlich gleich, dann funktioniert es (kannst es ja auch nochmal mit<a href="http://www.cplusplus.com/reference/clibrary/cstddef/offsetof/" rel="nofollow"> <code>offsetof</code> </a>testen).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271955</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271955</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sun, 18 Nov 2012 12:05:58 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sun, 18 Nov 2012 10:14:14 GMT]]></title><description><![CDATA[<p>also ich hab jetzt in der winwrap klase den typ den std::vector speichert in pointer geändert, dadurch funktioniert auch der cast in einen pointer zu einem objekt der abgeleiteten klasse, und die verfluchte scrollbar geht jetzt auch endlich. so wie das voran geht wird bei mir nie ein programm fertig außer konsolenanwendung mit par dialogen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271961</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271961</guid><dc:creator><![CDATA[Francis123]]></dc:creator><pubDate>Sun, 18 Nov 2012 10:14:14 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sun, 18 Nov 2012 11:40:31 GMT]]></title><description><![CDATA[<p>Hallo Nikolai,</p>
<pre><code class="language-cpp">vector&lt;WinWrap&gt; children;
</code></pre>
<p>speichert nur die Informationen der Basisklasse - das Stichwort dazu lautet &quot;Slicing&quot;, s. z.B. <a href="http://en.wikipedia.org/wiki/Object_slicing" rel="nofollow">http://en.wikipedia.org/wiki/Object_slicing</a></p>
<p>Verwende aber anstatt einem Zeiger besser einen Shared-Pointer z.B. &quot;unique_ptr&quot; oder &quot;shared_ptr&quot; aus C++11 bzw. boost:</p>
<pre><code class="language-cpp">vector&lt;unique_ptr&lt;WinWrap&gt;&gt; children;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2271992</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271992</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Sun, 18 Nov 2012 11:40:31 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sun, 18 Nov 2012 12:05:10 GMT]]></title><description><![CDATA[<p>Wenn Boost, wieso dann nicht gleich Pointer-Container?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2271998</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2271998</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sun, 18 Nov 2012 12:05:10 GMT</pubDate></item><item><title><![CDATA[Reply to Falsche Variablenwerte bei abgeleiteter Klasse on Sun, 18 Nov 2012 13:06:03 GMT]]></title><description><![CDATA[<p>Ich mag diese <a href="http://www.boost.org/doc/libs/1_52_0/libs/ptr_container/doc/ptr_container.html" rel="nofollow">Pointer Container Library</a> nicht, weil sie intern immer noch &quot;void <em>&quot; anstatt &quot;T</em>&quot; verwendet...<br />
Und zum anderen, weil ich das Konzept sowie die Benennung &quot;ptr_vector&quot;, &quot;ptr_map&quot;, ... total bescheuert finde.<br />
Aber kann ja jeder halten, wie er will...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2272022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2272022</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Sun, 18 Nov 2012 13:06:03 GMT</pubDate></item></channel></rss>