Click here to Skip to main content
15,896,153 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Communicating with main GUI thread from worker thread Pin
Luc Pattyn23-Sep-09 4:01
sitebuilderLuc Pattyn23-Sep-09 4:01 
GeneralRe: Communicating with main GUI thread from worker thread Pin
LetsMond23-Sep-09 4:13
LetsMond23-Sep-09 4:13 
GeneralRe: Communicating with main GUI thread from worker thread Pin
Luc Pattyn23-Sep-09 6:47
sitebuilderLuc Pattyn23-Sep-09 6:47 
GeneralRe: Communicating with main GUI thread from worker thread Pin
LetsMond23-Sep-09 7:20
LetsMond23-Sep-09 7:20 
GeneralRe: Communicating with main GUI thread from worker thread Pin
Luc Pattyn23-Sep-09 6:51
sitebuilderLuc Pattyn23-Sep-09 6:51 
QuestionBitmap-Stride a multiple of 4? [modified] Pin
cherrymotion11-Sep-09 2:29
cherrymotion11-Sep-09 2:29 
AnswerRe: Bitmap-Stride a multiple of 4? Pin
Mark Salsbery11-Sep-09 6:10
Mark Salsbery11-Sep-09 6:10 
QuestionCalling managed function from unmanaged function Pin
santoshkaif8-Sep-09 9:59
santoshkaif8-Sep-09 9:59 
Hi,
I'm a newbie to VC++ using Visual Studio 2005 and facing the below mentioned problem
Read many articles over the internet but of less help.
Thing is i am stuck at using managed and managed functions at a time.
Have pasted the .lib code and application which demonstates the issue

.lib code:
int unmngd_sample(void)
{
return 1;
}

application code:
#pragma once

#include"unmngd.h"

namespace mngd {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>

public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
protected:

public: static System::Windows::Forms::RichTextBox^ Console;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->Console = (gcnew System::Windows::Forms::RichTextBox());
this->SuspendLayout();
//
// Console
//
this->Console->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)
| System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->Console->Enabled = false;
this->Console->Location = System::Drawing::Point(0, 24);
this->Console->Name = L"Console";
this->Console->Size = System::Drawing::Size(788, 556);
this->Console->TabIndex = 2;
this->Console->Text = L"";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 262);
this->Controls->Add(this->Console);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion

int func2(void)
{
return unmngd_sample();
}

};

int func1(const char *p, ...)
{
Form1::Console->AppendText("A");
return 1;
}


}

I've got a library unmngd.lib (unmanaged function), which is included in the GUI based application (managed func).
Enclosed unmngd.lib is unmanaged function and mixing is the application using managed functions.


Problem im facing is

1> if project->properties->
configuration properties->general->"Common Language Runtime support" is set to clr,
managed type or func cannot be used in an unmanaged func1(in form1.h").

Error: 'mngd::Form1': managed type or function cannot be used in an unmanaged function

2> if project->properties->configuration properties->general->"Common Language Runtime support" is set to clr/pure,
im not able to call unmanaged code(from .lib) in func2 (managed func).

Pls throw some light on this
AnswerRe: Calling managed function from unmanaged function Pin
N a v a n e e t h8-Sep-09 16:31
N a v a n e e t h8-Sep-09 16:31 
AnswerRe: Calling managed function from unmanaged function [modified] Pin
santoshkaif8-Sep-09 17:52
santoshkaif8-Sep-09 17:52 
GeneralRe: Calling managed function from unmanaged function Pin
N a v a n e e t h9-Sep-09 5:49
N a v a n e e t h9-Sep-09 5:49 
QuestionRe: Calling managed function from unmanaged function [modified] Pin
santoshkaif9-Sep-09 8:18
santoshkaif9-Sep-09 8:18 
AnswerRe: Calling managed function from unmanaged function Pin
N a v a n e e t h9-Sep-09 16:35
N a v a n e e t h9-Sep-09 16:35 
QuestionRe: Calling managed function from unmanaged function Pin
santoshkaif10-Sep-09 0:04
santoshkaif10-Sep-09 0:04 
AnswerRe: Calling managed function from unmanaged function Pin
santoshkaif10-Sep-09 0:16
santoshkaif10-Sep-09 0:16 
AnswerRe: Calling managed function from unmanaged function Pin
N a v a n e e t h10-Sep-09 6:08
N a v a n e e t h10-Sep-09 6:08 
GeneralRe: Calling managed function from unmanaged function [modified] Pin
santoshkaif10-Sep-09 7:21
santoshkaif10-Sep-09 7:21 
GeneralRe: Calling managed function from unmanaged function Pin
N a v a n e e t h10-Sep-09 16:10
N a v a n e e t h10-Sep-09 16:10 
GeneralRe: Calling managed function from unmanaged function Pin
santoshkaif10-Sep-09 18:43
santoshkaif10-Sep-09 18:43 
QuestionRe: Calling managed function from unmanaged function Pin
santoshkaif21-Sep-09 2:20
santoshkaif21-Sep-09 2:20 
AnswerRe: Calling managed function from unmanaged function Pin
N a v a n e e t h22-Sep-09 15:31
N a v a n e e t h22-Sep-09 15:31 
QuestionMultiple Forms in VS2005 Pin
rtshield6-Sep-09 15:17
rtshield6-Sep-09 15:17 
AnswerRe: Multiple Forms in VS2005 Pin
N a v a n e e t h6-Sep-09 15:58
N a v a n e e t h6-Sep-09 15:58 
QuestionWeird problem with writing to a label in a form. (VC++ 2008) Pin
alzaeem4-Sep-09 6:55
alzaeem4-Sep-09 6:55 
AnswerRe: Weird problem with writing to a label in a form. (VC++ 2008) Pin
N a v a n e e t h4-Sep-09 18:12
N a v a n e e t h4-Sep-09 18:12 

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.