Click here to Skip to main content
15,906,558 members
Home / Discussions / C#
   

C#

 
AnswerRe: FileUpload Control Pin
subai5-Jan-07 20:01
subai5-Jan-07 20:01 
GeneralRe: FileUpload Control Pin
Reji Gopalakrishnan5-Jan-07 20:10
Reji Gopalakrishnan5-Jan-07 20:10 
GeneralRe: FileUpload Control Pin
subai5-Jan-07 23:20
subai5-Jan-07 23:20 
AnswerRe: FileUpload Control Pin
Vasudevan Deepak Kumar5-Jan-07 22:10
Vasudevan Deepak Kumar5-Jan-07 22:10 
QuestionHow can I Change color depth/Quality? Pin
oren20105-Jan-07 17:28
oren20105-Jan-07 17:28 
AnswerRe: How can I Change color depth/Quality? Pin
Luc Pattyn5-Jan-07 17:34
sitebuilderLuc Pattyn5-Jan-07 17:34 
QuestionC++ to C# stupid question??? Pin
Pet Lizard5-Jan-07 17:20
Pet Lizard5-Jan-07 17:20 
AnswerRe: C++ to C# stupid question??? Pin
Luc Pattyn5-Jan-07 17:24
sitebuilderLuc Pattyn5-Jan-07 17:24 
GeneralRe: C++ to C# stupid question??? Pin
Pet Lizard6-Jan-07 0:17
Pet Lizard6-Jan-07 0:17 
GeneralRe: C++ to C# stupid question??? Pin
Luc Pattyn6-Jan-07 4:09
sitebuilderLuc Pattyn6-Jan-07 4:09 
GeneralRe: C++ to C# stupid question??? Pin
Pet Lizard6-Jan-07 5:20
Pet Lizard6-Jan-07 5:20 
GeneralRe: C++ to C# stupid question??? Pin
Luc Pattyn6-Jan-07 7:00
sitebuilderLuc Pattyn6-Jan-07 7:00 
AnswerRe: C++ to C# stupid question??? Pin
Steve Hansen5-Jan-07 22:36
Steve Hansen5-Jan-07 22:36 
GeneralRe: C++ to C# stupid question??? Pin
Pet Lizard6-Jan-07 0:17
Pet Lizard6-Jan-07 0:17 
QuestionColumn Resize not executed if Control not visible? Pin
JoeRip5-Jan-07 15:12
JoeRip5-Jan-07 15:12 
QuestionHow to get a bitmap image from part of a larger bitmap? Pin
Subterranean5-Jan-07 13:29
Subterranean5-Jan-07 13:29 
AnswerRe: How to get a bitmap image from part of a larger bitmap? [modified] Pin
hpjchobbes5-Jan-07 15:31
hpjchobbes5-Jan-07 15:31 
AnswerRe: How to get a bitmap image from part of a larger bitmap? Pin
Luc Pattyn5-Jan-07 17:21
sitebuilderLuc Pattyn5-Jan-07 17:21 
Questionhow to check your sql for ANSI complaint Pin
WayneGretzky5-Jan-07 9:41
WayneGretzky5-Jan-07 9:41 
AnswerRe: how to check your sql for ANSI complaint Pin
Christian Graus5-Jan-07 9:48
protectorChristian Graus5-Jan-07 9:48 
Questionc++ from c# Pin
picazo5-Jan-07 8:42
picazo5-Jan-07 8:42 
Hi,

I have an unmanaged C++ class, and a managed c++ wrapper for the class. I then access the managed c++ from c# client. The whole thing compiles fine, but when I run the c# client, it crashes as soon as it hits the line where the managed c++ object is initialized. Here is the code that I am working with:

// C++ CODE

#include <windows.h>
#include <vcclr.h>
#using <System.dll>
using namespace System;


// from msdn
class UnManagedClass
{
public:
	LPCWSTR GetPropertyA() { return 0; }
	void MethodB ( LPCWSTR ) {}
};

public ref class AdapterNET
{
private:
	UnManagedClass * m_unman;

public:
	// allocate unmanaged object
	AdapterNET() : m_unman( new UnManagedClass ) {}

	// deallocate unmanaged object
	~AdapterNET() { delete m_unman; }

protected:
	// deallocated unmanaged object in finalizer in case the constructor is never called
	!AdapterNET() { delete m_unman; }

public:
	property String ^ get_PropertyA
	{
		String ^ get()
		{
			return gcnew  String( m_unman->GetPropertyA() );
		}
	}

	void MethodB( String ^ aString )
	{
		pin_ptr<const WCHAR> str = PtrToStringChars( aString );
		m_unman->MethodB( str );
	}
};


// C# CODE
using System;
using System.Collections.Generic;
using System.Text;

namespace TestingAdapterNET
{
	class AdapterNETDriver
	{
		static void Main( string[] args )
		{
			AdapterNET _adapterNET = new AdapterNET();  // <-- crashes here
			string propA = _adapterNET.get_PropertyA;
			_adapterNET.MethodB( propA );
		}
	}
}


Any ideas?

Thanks,

-----------------
Genaro

AnswerRe: c++ from c# Pin
Luc Pattyn5-Jan-07 8:50
sitebuilderLuc Pattyn5-Jan-07 8:50 
GeneralRe: c++ from c# Pin
picazo5-Jan-07 9:08
picazo5-Jan-07 9:08 
GeneralRe: c++ from c# Pin
Luc Pattyn5-Jan-07 9:32
sitebuilderLuc Pattyn5-Jan-07 9:32 
GeneralRe: c++ from c# Pin
picazo5-Jan-07 9:49
picazo5-Jan-07 9:49 

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.