Click here to Skip to main content
15,913,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow set netshare permission in vc++ SHARE_INFO_503 set permission. Pin
ashish8patil29-Apr-09 2:20
ashish8patil29-Apr-09 2:20 
QuestionDetermine if URL is folder of file? Pin
bosfan29-Apr-09 2:02
bosfan29-Apr-09 2:02 
AnswerRe: Determine if URL is folder of file? Pin
Stuart Dootson29-Apr-09 2:39
professionalStuart Dootson29-Apr-09 2:39 
QuestionHow to display Russian characters on a non-unicode dialog? Pin
Keith Worden29-Apr-09 1:58
Keith Worden29-Apr-09 1:58 
QuestionRe: How to display Russian characters on a non-unicode dialog? Pin
Rajesh R Subramanian29-Apr-09 4:34
professionalRajesh R Subramanian29-Apr-09 4:34 
AnswerRe: How to display Russian characters on a non-unicode dialog? Pin
Keith Worden29-Apr-09 4:40
Keith Worden29-Apr-09 4:40 
AnswerRe: How to display Russian characters on a non-unicode dialog? Pin
Benjamin Bruno29-Apr-09 18:48
Benjamin Bruno29-Apr-09 18:48 
GeneralRe: How to display Russian characters on a non-unicode dialog? Pin
Keith Worden30-Apr-09 0:02
Keith Worden30-Apr-09 0:02 
QuestionSwitching between tabs?? Pin
bosfan29-Apr-09 1:22
bosfan29-Apr-09 1:22 
AnswerRe: Switching between tabs?? Pin
Keith Worden29-Apr-09 2:06
Keith Worden29-Apr-09 2:06 
GeneralRe: Switching between tabs?? Pin
bosfan29-Apr-09 2:43
bosfan29-Apr-09 2:43 
GeneralRe: Switching between tabs?? Pin
Keith Worden29-Apr-09 2:53
Keith Worden29-Apr-09 2:53 
AnswerRe: Switching between tabs?? Pin
Stuart Dootson29-Apr-09 2:07
professionalStuart Dootson29-Apr-09 2:07 
AnswerRe: Switching between tabs?? Pin
Virendra Kulkarni30-Apr-09 0:28
Virendra Kulkarni30-Apr-09 0:28 
Question[Message Deleted] Pin
Padmanabha_M29-Apr-09 0:56
Padmanabha_M29-Apr-09 0:56 
AnswerRe: Folder Navigation Pin
_AnsHUMAN_ 29-Apr-09 1:24
_AnsHUMAN_ 29-Apr-09 1:24 
AnswerRe: Folder Navigation Pin
David Crow29-Apr-09 4:24
David Crow29-Apr-09 4:24 
QuestionPath Check Pin
Davitor29-Apr-09 0:56
Davitor29-Apr-09 0:56 
AnswerRe: Path Check Pin
Rajesh R Subramanian29-Apr-09 1:01
professionalRajesh R Subramanian29-Apr-09 1:01 
AnswerRe: Path Check Pin
Davitor29-Apr-09 1:02
Davitor29-Apr-09 1:02 
AnswerRe: Path Check Pin
Jijo.Raj29-Apr-09 1:02
Jijo.Raj29-Apr-09 1:02 
AnswerRe: Path Check Pin
Hamid_RT29-Apr-09 4:38
Hamid_RT29-Apr-09 4:38 
AnswerRe: Path Check Pin
Joe Woodbury29-Apr-09 10:44
professionalJoe Woodbury29-Apr-09 10:44 
QuestionInitialize variable in static library [modified] Pin
samira forooghi29-Apr-09 0:13
samira forooghi29-Apr-09 0:13 
hi every one

I create a static library with visual c++ 6.0 App wizard.
I create a new generic class and declared my variables in its header file.
Then I initialized my variables in class constructor.

I want to use it in a new dialog based project, so I add related header file and write my library name in linker tab at project setting.

I create one object of this class in my function, But at the end of function when application exits from function occurs an exception.
I can't handle this exception.

Note : when I comment initialized this exception don’t happen.
Please help me

////////////////////////////////////////////////////////////////
// static library class (Test.h)
///////////////////////////////////////////////////////////////
class CTest  
{
public:
		
	CTest();
	virtual ~CTest();
	
	int		 m_i1;//or INT   
	int		 m_i2;   
	
        bool		 m_b1;//or BOOL
	bool		 m_b2;
	
	unsigned int	 m_ui1;//or DWORD32
	unsigned int	 m_ui2;
	
	unsigned short   m_us1;//or USHORT
	unsigned short   m_us2;
	
	BYTE		 m_bte1;//#include <windef.h> in stdafx.h for BYTE data type
	BYTE		 m_bte2;
	
	CString	 m_str1;//#include <afx.h> in stdafx.h for CString data type
	CString	 m_str2;	
};</afx.h></windef.h>


// (Test.cpp)
///////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Test.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTest::CTest()
{
	
	m_i1=0;
	m_i2=0;  
		
	m_b1=true;
	m_b2=true;
		
	m_ui1=0;
	m_ui2=0;
		
	m_us1=1;
	m_us2=1;
		
	m_bte1=0;
	m_bte2=0;
		
	m_str1="";
	m_str2="";
		
}

CTest::~CTest()
{


}

////////////////////////////////////////////////////////////////
// My dialog base application
///////////////////////////////////////////////////////////////
void CUseTestLibDlg::OnBinitlib() 
{
	CTest  *pcTest=new CTest();

        delete pcTest;
	pcTest=NULL;
	
	
}// Unhandled exception in UseTestLib.exe: 0xC0000005: Access Violation.

void CUseTestLibDlg::OnBinitlib2() 
{
	CTest  pcTest;
	
}// Unhandled exception in UseTestLib.exe: 0xC0000005: Access Violation.


modified on Wednesday, April 29, 2009 6:26 AM

AnswerRe: Initialize variable in static library Pin
CPallini29-Apr-09 0:20
mveCPallini29-Apr-09 0:20 

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.