Click here to Skip to main content
15,881,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC static variable Pin
bhanu_850914-Apr-09 9:02
bhanu_850914-Apr-09 9:02 
GeneralRe: MFC static variable Pin
Iain Clarke, Warrior Programmer14-Apr-09 9:11
Iain Clarke, Warrior Programmer14-Apr-09 9:11 
GeneralRe: MFC static variable Pin
CPallini14-Apr-09 9:19
mveCPallini14-Apr-09 9:19 
AnswerRe: MFC static variable Pin
Nemanja Trifunovic14-Apr-09 9:02
Nemanja Trifunovic14-Apr-09 9:02 
AnswerRe: MFC static variable Pin
Rajesh R Subramanian14-Apr-09 20:24
professionalRajesh R Subramanian14-Apr-09 20:24 
Questiongpedit.msc from VC++ Pin
neelu777914-Apr-09 4:25
neelu777914-Apr-09 4:25 
AnswerRe: gpedit.msc from VC++ Pin
Michael Schubert14-Apr-09 6:47
Michael Schubert14-Apr-09 6:47 
QuestionC# / C++ Interop, Odd behaviour from marshalled strings Pin
Mikey_H14-Apr-09 3:50
Mikey_H14-Apr-09 3:50 
Hello,

I am trying some Interop in my application. This is the first time I have had to pass arguments with function calls. I am experiencing some odd results.

// C# Function Call
RenderEngine.LoadNewMesh("BasicMesh", "Pyramid3", 1);

// Managed C++ Wrapper Function
void RenderEngine::LoadNewMesh(String^ meshType, String^ meshName, int nSubsets)
{
	char* cMeshType = (char*)(void*)Marshal::StringToHGlobalAnsi(meshType);
	char* cMeshName = (char*)(void*)Marshal::StringToHGlobalAnsi(meshName);

	m_engineRoot->LoadMesh.LoadNewMesh(cMeshType, cMeshName, nSubsets);
}

// Native C++ Function
void MeshLoader::LoadNewMesh(char* meshType, char* meshName, UINT nSubsets)
{
	//char* 
        m_meshType						= meshType;
	//char* 
        m_meshName						= meshName;
	m_nSubsets						= 0;
	m_nTotalSubsets					        = nSubsets;

	m_pMesh							= new BasicMesh();

        // This message box will display Pyramid3
        MessageBox(0, meshName, 0, 0);

        // This code will not trigger the message box
        if (meshName == "Pyramid3")
                MessageBox(0, (char*)"meshName is Pyramid3", 0, 0);

        // This code will trigger and m_meshName is set directly as Pyramid3
        // if it is not set directly here the call to GetMeshByName later on returns NULL
	if (strcmp(meshName,"Pyramid3") == 0)
		m_meshName = "Pyramid3";
}

// Object is referenced by name here
MeshManager::CreateMesh(m_pMesh, m_meshName);

// Will return NULL if char* is not set directly
MeshManager::GetMeshByName("Pyramid3");

AnswerRe: C# / C++ Interop, Odd behaviour from marshalled strings Pin
Chris Losinger14-Apr-09 4:35
professionalChris Losinger14-Apr-09 4:35 
GeneralRe: C# / C++ Interop, Odd behaviour from marshalled strings [modified] Pin
Mikey_H14-Apr-09 5:16
Mikey_H14-Apr-09 5:16 
GeneralRe: C# / C++ Interop, Odd behaviour from marshalled strings [modified] Pin
Chris Losinger14-Apr-09 5:29
professionalChris Losinger14-Apr-09 5:29 
GeneralRe: C# / C++ Interop, Odd behaviour from marshalled strings Pin
Iain Clarke, Warrior Programmer14-Apr-09 5:33
Iain Clarke, Warrior Programmer14-Apr-09 5:33 
GeneralRe: C# / C++ Interop, Odd behaviour from marshalled strings Pin
Chris Losinger14-Apr-09 5:40
professionalChris Losinger14-Apr-09 5:40 
GeneralRe: C# / C++ Interop, Odd behaviour from marshalled strings Pin
Iain Clarke, Warrior Programmer14-Apr-09 5:30
Iain Clarke, Warrior Programmer14-Apr-09 5:30 
GeneralRe: C# / C++ Interop, Odd behaviour from marshalled strings Pin
Mikey_H14-Apr-09 6:34
Mikey_H14-Apr-09 6:34 
QuestionHaving a generic function GetProcAddress for both unicode and ascii builds - fails in release mode Pin
Priya_Sundar14-Apr-09 3:43
Priya_Sundar14-Apr-09 3:43 
AnswerRe: Having a generic function GetProcAddress for both unicode and ascii builds - fails in release mode Pin
Iain Clarke, Warrior Programmer14-Apr-09 4:07
Iain Clarke, Warrior Programmer14-Apr-09 4:07 
AnswerRe: Having a generic function GetProcAddress for both unicode and ascii builds - fails in release mode Pin
CPallini14-Apr-09 5:47
mveCPallini14-Apr-09 5:47 
GeneralRe: Having a generic function GetProcAddress for both unicode and ascii builds - fails in release mode Pin
Priya_Sundar14-Apr-09 17:12
Priya_Sundar14-Apr-09 17:12 
Questionhow to create new thread Pin
hemlat14-Apr-09 3:39
hemlat14-Apr-09 3:39 
AnswerRe: how to create new thread Pin
Divyang Mithaiwala14-Apr-09 3:53
Divyang Mithaiwala14-Apr-09 3:53 
GeneralRe: how to create new thread Pin
hemlat14-Apr-09 4:01
hemlat14-Apr-09 4:01 
GeneralRe: how to create new thread Pin
Divyang Mithaiwala14-Apr-09 4:04
Divyang Mithaiwala14-Apr-09 4:04 
GeneralRe: how to create new thread Pin
Rajesh R Subramanian14-Apr-09 4:11
professionalRajesh R Subramanian14-Apr-09 4:11 
GeneralRe: how to create new thread Pin
ThatsAlok14-Apr-09 20:20
ThatsAlok14-Apr-09 20: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.