Click here to Skip to main content
15,910,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Basic array problem Pin
VCProgrammer19-Apr-11 20:57
VCProgrammer19-Apr-11 20:57 
GeneralRe: Basic array problem Pin
Cool_Dev19-Apr-11 21:24
Cool_Dev19-Apr-11 21:24 
AnswerRe: Basic array problem Pin
Niklas L19-Apr-11 22:15
Niklas L19-Apr-11 22:15 
Questioni having problem to connect my MFC form to Access database using sql query.. Pin
tohard19-Apr-11 14:51
tohard19-Apr-11 14:51 
AnswerRe: i having problem to connect my MFC form to Access database using sql query.. Pin
Rajesh R Subramanian19-Apr-11 20:23
professionalRajesh R Subramanian19-Apr-11 20:23 
QuestionShared Library o DLL? Pin
Andy20219-Apr-11 6:36
Andy20219-Apr-11 6:36 
AnswerRe: Shared Library o DLL? Pin
Albert Holguin19-Apr-11 7:30
professionalAlbert Holguin19-Apr-11 7:30 
QuestionDeskband (XP) Problem.. Pin
nitin319-Apr-11 5:54
nitin319-Apr-11 5:54 
Hi,
I'm trying to create a deskband (windows xp). The class which implement
IDeskBand is CBand. I've created some brush in
the constructor of this class. And destroyed in destructor.

right click taskbar->toolbars-> select MyBand, now my deskband is visible.
then right click taskbar->toolbars->MyBand, now my deskband is gone.

But the gdi items are still in memory ? It seems
the destructor is not called.

If repeat show, hide deskband, the gdi object count increases with every time.

I've created it as specified in the following url.
http://msdn.microsoft.com/en-us/library/cc144099(v=vs.85).aspx

CBand::CBand()
{	
	//ALWAYS SHOWS
	MessageBox(0, "Construct", 0,0)  ;
	m_lRef			= 1 ;
	//create obejcts...
}
CBand::~CBand()
{
	//NEVER SHOWN
	MessageBox(0, "Destruct", 0,0)  ;
	//delete objects
}

DWORD	__stdcall CBand::AddRef()
{
	return InterlockedIncrement(&m_lRef) ;
}
DWORD	__stdcall CBand::Release()
{
	if( InterlockedDecrement(&m_lRef) == 0 )
	{
		delete this ;
	}
	return m_lRef ;
}
HRESULT __stdcall CBand::QueryInterface( REFIID riid , void** ppvObj )
{
	*ppvObj = NULL;

	if(IsEqualIID(riid, IID_IUnknown))
	{
		*ppvObj = this;
	}
	.
	.
	.
	.

	if(*ppvObj)
	{
		(*(LPUNKNOWN*)ppvObj)->AddRef();
		return S_OK;
	}

	return E_NOINTERFACE;
}


HRESULT __stdcall ShellFactory::CreateInstance(IUnknown* pUnknownOuter , const IID& iid , void** ppv ) 
{    
	if( pUnknownOuter != NULL )
	{
        return ResultFromScode( CLASS_E_NOAGGREGATION ) ;
	}

	if( IsEqualCLSID(m_clsid , CLSID_MyBand))
	{
		CBand * pObj = new CBand() ;
		if( pObj == NULL )
		{
			return E_OUTOFMEMORY;
		}
		HRESULT hRes = pObj->QueryInterface( iid , ppv ) ;	
		if(FAILED(hRes) )
		{
			pObj->Release() ;
		}
		return hRes;
	}
	return S_FALSE ;
}

Thanks & Regards

QuestionProblems with getting data from a Edit Control [modified] Pin
jhoesche19-Apr-11 4:54
jhoesche19-Apr-11 4:54 
AnswerRe: Problems with getting data from a Edit Control Pin
David Crow19-Apr-11 7:13
David Crow19-Apr-11 7:13 
GeneralRe: Problems with getting data from a Edit Control Pin
jhoesche19-Apr-11 8:49
jhoesche19-Apr-11 8:49 
AnswerRe: Problems with getting data from a Edit Control Pin
Hans Dietrich19-Apr-11 11:37
mentorHans Dietrich19-Apr-11 11:37 
GeneralRe: Problems with getting data from a Edit Control Pin
jhoesche19-Apr-11 12:12
jhoesche19-Apr-11 12:12 
GeneralRe: Problems with getting data from a Edit Control [modified] Pin
David Crow20-Apr-11 3:47
David Crow20-Apr-11 3:47 
GeneralRe: Problems with getting data from a Edit Control Pin
jhoesche20-Apr-11 5:56
jhoesche20-Apr-11 5:56 
GeneralRe: Problems with getting data from a Edit Control Pin
David Crow20-Apr-11 6:54
David Crow20-Apr-11 6:54 
GeneralRe: Problems with getting data from a Edit Control Pin
jhoesche20-Apr-11 7:16
jhoesche20-Apr-11 7:16 
GeneralRe: Problems with getting data from a Edit Control Pin
David Crow20-Apr-11 7:26
David Crow20-Apr-11 7:26 
GeneralRe: Problems with getting data from a Edit Control Pin
jhoesche20-Apr-11 10:12
jhoesche20-Apr-11 10:12 
GeneralRe: Problems with getting data from a Edit Control Pin
David Crow20-Apr-11 10:41
David Crow20-Apr-11 10:41 
Questionhow to initialize a variable whose name is passed as a string with a given value in a function in vc++6.0 Pin
manoharbalu19-Apr-11 2:36
manoharbalu19-Apr-11 2:36 
AnswerRe: how to initialize a variable whose name is passed as a string with a given value in a function in vc++6.0 Pin
Chris Losinger19-Apr-11 2:48
professionalChris Losinger19-Apr-11 2:48 
GeneralRe: how to initialize a variable whose name is passed as a string with a given value in a function in vc++6.0 Pin
manoharbalu19-Apr-11 3:12
manoharbalu19-Apr-11 3:12 
GeneralRe: how to initialize a variable whose name is passed as a string with a given value in a function in vc++6.0 Pin
Chris Losinger19-Apr-11 3:28
professionalChris Losinger19-Apr-11 3:28 
AnswerRe: how to initialize a variable whose name is passed as a string with a given value in a function in vc++6.0 Pin
Hans Dietrich19-Apr-11 3:29
mentorHans Dietrich19-Apr-11 3:29 

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.