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

Managed C++/CLI

 
QuestionSecurity issue Pin
xiwangxin23-Mar-09 23:26
Memberxiwangxin23-Mar-09 23:26 
QuestionPause button..... Pin
Thilek23-Mar-09 5:30
MemberThilek23-Mar-09 5:30 
QuestionIs this a Managed CLI question? [modified] Pin
led mike23-Mar-09 6:06
Memberled mike23-Mar-09 6:06 
AnswerRe: Is this a Managed CLI question? Pin
Thilek23-Mar-09 6:56
MemberThilek23-Mar-09 6:56 
GeneralRe: Is this a Managed CLI question? Pin
led mike23-Mar-09 6:58
Memberled mike23-Mar-09 6:58 
AnswerRe: Is this a Managed CLI question? Pin
Thilek25-Mar-09 0:37
MemberThilek25-Mar-09 0:37 
GeneralRe: Is this a Managed CLI question? Pin
Sci_fie26-Mar-09 7:45
MemberSci_fie26-Mar-09 7:45 
Questionhow to use #pragma data_seq Pin
ernst2002053020-Mar-09 9:36
Memberernst2002053020-Mar-09 9:36 
I should write a Windows32 form, in which I can input Unicode. When I create multiple instances of application.all the form must display some content, and When I change the content, the content in all instances must change according to the changed Unicode.
Now I can get the content of input, but how can I put the value into the variable in commen memory area?

#include "stdafx.h"
#include "windows.h"
#include <memory.h>
#include <TCHAR.h>
//#pragma once

#pragma data_seq("Shared")
volatile wchar_t* content;
#pragma data_seq()
#pragma comment(linker, "/Section:Shared,RWS")


namespace ShareMemory2 {

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;
}
}
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Button^ button1;
protected:

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->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(67, 26);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(164, 20);
this->textBox1->TabIndex = 0;
//
// button1
//
this->button1->Location = System::Drawing::Point(105, 64);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 1;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(296, 111);
this->Controls->Add(this->button1);
this->Controls->Add(this->textBox1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion

private : System::String^ Pwchar_tToString(wchar_t* content){
System::IntPtr ptr(content);
System::String^ string = System::Runtime::InteropServices::Marshal::PtrToStringUni(ptr);
return string;
};

private : wchar_t *StringToPwchar_t(System::String^ str){
IntPtr ptr = System::Runtime::InteropServices::Marshal::StringToHGlobalUni(str);
wchar_t *string = reinterpret_cast<wchar_t*>(ptr.ToPointer());
return string;
};

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
/*wchar_t**/ content=TEXT("abc");
//memcpy((void*)content,content2,4);
wchar_t* cont2=TEXT("abc");
int i=0;
this->textBox1->Text=Pwchar_tToString(cont2);
}

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
wchar_t* in=StringToPwchar_t(this->textBox1->Text);
int i=0;
}
};


}
AnswerRe: how to use #pragma data_seq Pin
ernst2002053020-Mar-09 9:39
Memberernst2002053020-Mar-09 9:39 
AnswerRe: how to use #pragma data_seq Pin
Mark Salsbery22-Mar-09 7:23
MemberMark Salsbery22-Mar-09 7:23 
GeneralRe: how to use #pragma data_seq Pin
ernst2002053022-Mar-09 16:06
Memberernst2002053022-Mar-09 16:06 
GeneralRe: how to use #pragma data_seq Pin
led mike23-Mar-09 6:03
Memberled mike23-Mar-09 6:03 
GeneralRe: how to use #pragma data_seq Pin
Mark Salsbery23-Mar-09 11:00
MemberMark Salsbery23-Mar-09 11:00 
QuestionMouse hook problem Pin
g_sandipan19-Mar-09 20:50
Memberg_sandipan19-Mar-09 20:50 
QuestionHow to Access numerical array data from various controls? Pin
isaaks16-Mar-09 14:12
Memberisaaks16-Mar-09 14:12 
AnswerRe: How to Access numerical array data from various controls? Pin
N a v a n e e t h16-Mar-09 23:36
MemberN a v a n e e t h16-Mar-09 23:36 
GeneralRe: How to Access numerical array data from various controls? Pin
isaaks17-Mar-09 9:52
Memberisaaks17-Mar-09 9:52 
GeneralRe: How to Access numerical array data from various controls? Pin
N a v a n e e t h17-Mar-09 23:33
MemberN a v a n e e t h17-Mar-09 23:33 
QuestionHaving a program create its own variables? [modified] Pin
TabascoSauce14-Mar-09 22:33
MemberTabascoSauce14-Mar-09 22:33 
AnswerRe: Having a program create its own variables? Pin
N a v a n e e t h15-Mar-09 6:41
MemberN a v a n e e t h15-Mar-09 6:41 
GeneralRe: Having a program create its own variables? [modified] Pin
TabascoSauce15-Mar-09 12:36
MemberTabascoSauce15-Mar-09 12:36 
QuestionUpdating form controls outside of form file Pin
Lavake14-Mar-09 12:14
MemberLavake14-Mar-09 12:14 
AnswerRe: Updating form controls outside of form file Pin
N a v a n e e t h14-Mar-09 17:28
MemberN a v a n e e t h14-Mar-09 17:28 
GeneralRe: Updating form controls outside of form file Pin
Lavake15-Mar-09 5:06
MemberLavake15-Mar-09 5:06 
GeneralRe: Updating form controls outside of form file Pin
N a v a n e e t h15-Mar-09 6:21
MemberN a v a n e e t h15-Mar-09 6:21 

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.