|
See System::Runtime::InteropServices::Marshal class.
|
|
|
|
|
You can't do a plain cast from a managed pointer to an unmanged one, you need to pin the managed pointer so the underlying object doesn't move during GCs.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi, I would like to know how to search through a file for specific words or phrases using VisualC++ 2003
-- modified at 7:38 Thursday 20th July, 2006
|
|
|
|
|
Load the file into memory and search then. It's easier and faster.
|
|
|
|
|
I currently have a COM component (and source) that talks to a printer and also a hardware port through a Vendor supplied DLL that makes fairly low level calls, and was wondering if there is a reference for displaying how to create a Managed Assembly in C++ that can performed the unmanaged calls, but present a nice .Net interface for the other developers. It does lots of GetProcAddress and
I would prefer not to interop to my existing COM Component, because I am trying to get a clean project.
I could possibly do it in C#, but wondering if it would be better in managed C++?
<br />
PORTOUT PortOut;<br />
PORTWORDOUT PortWordOut;<br />
PORTDWORDOUT PortDWordOut;<br />
PORTIN PortIn;<br />
PORTWORDIN PortWordIn;<br />
PORTDWORDIN PortDWordIn;<br />
SETPORTBIT SetPortBit;<br />
CLRPORTBIT ClrPortBit;<br />
NOTPORTBIT NotPortBit;<br />
GETPORTBIT GetPortBit;<br />
RIGHTPORTSHIFT RightPortShift;<br />
LEFTPORTSHIFT LeftPortShift;<br />
ISDRIVERINSTALLED IsDriverInstalled;<br />
...<br />
and then makes calls like this<br />
...<br />
<br />
LoadIODLL();<br />
PortOut(0x2E,(unsigned char) 0x87);<br />
PortOut(0x2E,(unsigned char) 0x87);<br />
PortOut(0x2E,(unsigned char) 0x07);<br />
PortOut(0x2F,(unsigned char) 0x07);<br />
PortOut(0x2E,(unsigned char) 0xf1);<br />
<br />
...<br />
<br />
hio = LoadLibrary("cashdrawerio.dll");<br />
if (hio == NULL)<br />
{<br />
return;<br />
}<br />
else<br />
{<br />
<br />
PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");<br />
PortWordOut = (PORTWORDOUT)GetProcAddress(hio, "PortWordOut");<br />
PortDWordOut = (PORTDWORDOUT)GetProcAddress(hio, "PortDWordOut");<br />
PortIn = (PORTIN)GetProcAddress(hio, "PortIn");<br />
PortWordIn = (PORTWORDIN)GetProcAddress(hio, "PortWordIn");<br />
PortDWordIn = (PORTDWORDIN)GetProcAddress(hio, "PortDWordIn");<br />
SetPortBit = (SETPORTBIT)GetProcAddress(hio, "SetPortBit");<br />
ClrPortBit = (CLRPORTBIT)GetProcAddress(hio, "ClrPortBit");<br />
NotPortBit = (NOTPORTBIT)GetProcAddress(hio, "NotPortBit");<br />
GetPortBit = (GETPORTBIT)GetProcAddress(hio, "GetPortBit");<br />
RightPortShift = (RIGHTPORTSHIFT)GetProcAddress(hio, "RightPortShift");<br />
LeftPortShift = (LEFTPORTSHIFT)GetProcAddress(hio, "LeftPortShift");<br />
IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");<br />
<br />
}<br />
|
|
|
|
|
Hi there..
I'm currently writing a managed c++ application which adds user entered data (textbox) into a access database.
I have some problems with formatting the sql string in the right format.. this is the sql string:
String *sqlstr = S"INSERT INTO klanten (Naam, Adres) VALUES", textBox1->Text->ToString(), textBox2->Text->ToString();
When running the program I get the following error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
I don't know how to correct the sql string
|
|
|
|
|
vincent7_6 wrote: I don't know how to correct the sql string
Debug the application and get the sql string value. Then find out why it is not valid SQL. If you don't know SQL well enough to determine the problem, CodeProject has a SQL forum you get help from.
Also using SQL in this fashion makes the application vulnerable to "SQL Injection Attack".
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
SQL Syntax is:
INSERT INTO klanten (Naam, Adres) VALUES ('Whatever','Whatever')
But like led mike said, you should guard against:SQL Injection Attacks[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Using the designer to create the main form for an application generated the following code in the .cpp file:
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;
Application::Run(new DataForm(lpCmdLine));
return 0;
}
The DataForm class has a button which generates a new form:
linkedForm = new LinkedForm() ;
The LinkedForm class exists in the same namespace as the DataForm class.
What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature?
Thanks,
MrHonus
|
|
|
|
|
See the MVC (Model-View-Controller) design pattern. It is on Wikipedia. Forms are Views and should not be coupled. Views (Forms) should access a "Controller" to initiate action based on UI (User) events. Views subscribe to events exposed from the "Model" to be notified of data and/or "state" changes. Views then obtain the latest data to display from the "Model".
|
|
|
|
|
Well, since I used the .net designer to create all of the views, it doesn't seem to lend itself to mvc. Are there any examples of how to use mvc with studio/net generated forms?
Thanks for the reply
|
|
|
|
|
mrhonus wrote: it doesn't seem to lend itself to mvc.
That makes no sense.
mrhonus wrote: Are there any examples of how to use mvc with studio/net generated forms?
Sure the Microsoft UI Composit Application Block[^]
|
|
|
|
|
I agree, it makes no sense.
Well, I am looking for C++ examples.
Thanks
|
|
|
|
|
mrhonus wrote: Well, I am looking for C++ examples.
You are using .NET WinForms
mrhonus wrote: Application::Run(new DataForm(lpCmdLine));
The application block is .NET library so you can use it. If you can't translate C# samples into Managed C++ why are you doing Managed Development in C++?
|
|
|
|
|
Mainly because so many things which I know about C++ don't seem to apply in the .Net environment. I'm doing Managed Devlopment in C++ because I wasn't allowed to choose the development environment. I would have chosen Java, which is much more straightforward. But since you're now getting snide, I guess you've helped me enough--thanks for your time.
|
|
|
|
|
mrhonus wrote: But since you're now getting snide
Not at all. So many times in message based communications people leave out reasons for things that create gaps in understanding. I was just trying to understand how you arrived in your situation to see if a different view might help. It does not appear so.
mrhonus wrote: I would have chosen Java, which is much more straightforward.
Much more straight forward than Managed C++ but very similar to C#. Perhaps you could use C# Research apps as a way of learning the .NET libraries you need and then translate your own C# code into managed C++. That would also allow you to apply samples you can find to the C# research application. It's not real pretty but after time you probably won't need the C# step as you would be able to translate the samples directly to C++.
Also on the MSDN2 web site many of the .NET Framework Documentation contains short samples in C++.
|
|
|
|
|
Hi,
I've got a rather strange question that I've been trying to figure out. Perhaps some of you can give me some hints.
I'd like to call a java method from C++ (or any other language for that matter). The java method is compiled into a java bean which is contained in an applet. I've got no control over the applet and I have full control over the bean which contains a callback method to the applet. This is the method i'd like to call, is it possible?
Cheers!
|
|
|
|
|
Hi,
Check out JNI (Java Native Interface) for this.
|
|
|
|
|
hi everybody.I am newbie in managed c++.I have few questions for you.how do i send data to serial port with using event handler. Before sending the data, do I need to create an object class for serial port or is it already in windows library.I mean in .NET 2005 with framework 2.0 there is a namespace System::IO::Port but I use framework 1.1 with .net 2003 and i haven`t find something like that.
I post what I write below without comments sorry about it
Moreover when the mouse cursor is in the panel coordinates cpu usage rises 100% what should i do to decrease that usage
thanks a lot for your help
Note: Sorry about my pour english
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitForm();
InitializeComponent();
MouseWheel+=new MouseEventHandler(this,Wheeled);
panel1->MouseUp += newMouseEventHandler(this,Joystick_MouseUp);
panel1->MouseMove += new MouseEventHandler(this,Joystick_MouseMove);
panel1->MouseDown += new MouseEventHandler(this,Joystick_MouseDown);
this->panel1->SetStyle( ControlStyles::AllPaintingInWmPaint, true);
this->panel1->SetStyle( ControlStyles::DoubleBuffer, true );
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::Panel * panel1;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Button * button2;
private: System::Windows::Forms::Button * button3;
private: System::Windows::Forms::Button * button4;
private: System::Windows::Forms::Button * button5;
private: System::Windows::Forms::Button * button6;
private: System::Windows::Forms::Button * button7;
private: System::Windows::Forms::Button * button8;
private: System::Windows::Forms::Button * button9;
private: System::Windows::Forms::Button * button10;
private: System::Windows::Forms::Button * button11;
private: System::Windows::Forms::Button * button12;
private: System::Windows::Forms::Button * button13;
private: System::Windows::Forms::Button * button14;
private: System::Windows::Forms::Button * button15;
private: System::Windows::Forms::Button * button16;
private: System::Windows::Forms::Button * button17;
private: System::Windows::Forms::OpenFileDialog * openFileDialog1;
private: System::Windows::Forms::VScrollBar * vScrollBar1;
private: System::Windows::Forms::TextBox * textBox1;
private: static int x=40;//x degeri
private: static int y=88;//y degeri
private: double diameter;
private: Pen* rubberband;
private: Graphics* g;
private: Point offset;
private: LineCap endCap;
private: bool mouseLock;
private: bool mouseDown;
private: double magnitude;
private: int radius;
private: SolidBrush* insideColor;
private: Point cursorLocation;
private:
///
/// Required designer variable.
///
System::ComponentModel::Container * components;
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(HaloControl::Form1));
this->panel1 = new System::Windows::Forms::Panel();
this->label1 = new System::Windows::Forms::Label();
this->button1 = new System::Windows::Forms::Button();
this->button2 = new System::Windows::Forms::Button();
this->button3 = new System::Windows::Forms::Button();
this->button5 = new System::Windows::Forms::Button();
this->vScrollBar1 = new System::Windows::Forms::VScrollBar();
this->textBox1 = new System::Windows::Forms::TextBox();
this->button6 = new System::Windows::Forms::Button();
this->button7 = new System::Windows::Forms::Button();
this->button8 = new System::Windows::Forms::Button();
this->button9 = new System::Windows::Forms::Button();
this->button10 = new System::Windows::Forms::Button();
this->button11 = new System::Windows::Forms::Button();
this->button12 = new System::Windows::Forms::Button();
this->button13 = new System::Windows::Forms::Button();
this->button14 = new System::Windows::Forms::Button();
this->button15 = new System::Windows::Forms::Button();
this->button16 = new System::Windows::Forms::Button();
this->button17 = new System::Windows::Forms::Button();
this->openFileDialog1 = new System::Windows::Forms::OpenFileDialog();
this->SuspendLayout();
//
// panel1
//
this->panel1->BackColor = System::Drawing::SystemColors::Desktop;
this->panel1->Cursor = System::Windows::Forms::Cursors::Cross;
this->panel1->Location = System::Drawing::Point(272, 136);
this->panel1->Name = S"panel1";
this->panel1->Size = System::Drawing::Size(160, 160);
this->panel1->TabIndex = 0;
this->panel1->Paint += new System::Windows::Forms::PaintEventHandler(this, panel1_Paint);
//
// label1
//
this->label1->BackColor = System::Drawing::SystemColors::Desktop;
this->label1->Image = (__try_cast<system::drawing::image *="">(resources->GetObject(S"label1.Image")));
this->label1->Location = System::Drawing::Point(16, 16);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(152, 64);
this->label1->TabIndex = 1;
//
// button1
//
this->button1->BackColor = System::Drawing::SystemColors::Desktop;
this->button1->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button1.BackgroundImage")));
this->button1->Cursor = System::Windows::Forms::Cursors::PanWest;
this->button1->Location = System::Drawing::Point(224, 208);
this->button1->Name = S"button1";
this->button1->Size = System::Drawing::Size(40, 25);
this->button1->TabIndex = 2;
this->button1->Click += new System::EventHandler(this, button1_Click);
//
// button2
//
this->button2->BackColor = System::Drawing::SystemColors::Desktop;
this->button2->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button2.BackgroundImage")));
this->button2->Cursor = System::Windows::Forms::Cursors::PanEast;
this->button2->Location = System::Drawing::Point(440, 208);
this->button2->Name = S"button2";
this->button2->Size = System::Drawing::Size(40, 25);
this->button2->TabIndex = 3;
//
// button3
//
this->button3->BackColor = System::Drawing::SystemColors::Desktop;
this->button3->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button3.BackgroundImage")));
this->button3->Cursor = System::Windows::Forms::Cursors::PanNorth;
this->button3->Location = System::Drawing::Point(336, 88);
this->button3->Name = S"button3";
this->button3->Size = System::Drawing::Size(25, 40);
this->button3->TabIndex = 4;
//
// button5
//
this->button5->BackColor = System::Drawing::SystemColors::Desktop;
this->button5->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button5.BackgroundImage")));
this->button5->Cursor = System::Windows::Forms::Cursors::PanSouth;
this->button5->Location = System::Drawing::Point(336, 304);
this->button5->Name = S"button5";
this->button5->Size = System::Drawing::Size(25, 40);
this->button5->TabIndex = 11;
//
// vScrollBar1
//
this->vScrollBar1->BackColor = System::Drawing::SystemColors::Desktop;
this->vScrollBar1->Location = System::Drawing::Point(512, 160);
this->vScrollBar1->Maximum = 40;
this->vScrollBar1->Name = S"vScrollBar1";
this->vScrollBar1->Size = System::Drawing::Size(24, 112);
this->vScrollBar1->TabIndex = 7;
this->vScrollBar1->Value = 20;
this->vScrollBar1->Scroll += new System::Windows::Forms::ScrollEventHandler(this, vScrollBar1_Scroll);
//
// textBox1
//
this->textBox1->BackColor = System::Drawing::SystemColors::InactiveCaptionText;
this->textBox1->Location = System::Drawing::Point(32, 216);
this->textBox1->Name = S"textBox1";
this->textBox1->Size = System::Drawing::Size(176, 20);
this->textBox1->TabIndex = 9;
this->textBox1->Text = S"textBox1";
//
// button6
//
this->button6->BackColor = System::Drawing::SystemColors::Desktop;
this->button6->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button6.BackgroundImage")));
this->button6->Cursor = System::Windows::Forms::Cursors::Default;
this->button6->Location = System::Drawing::Point(624, 152);
this->button6->Name = S"button6";
this->button6->Size = System::Drawing::Size(40, 25);
this->button6->TabIndex = 12;
//
// button7
//
this->button7->BackColor = System::Drawing::SystemColors::Desktop;
this->button7->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button7.BackgroundImage")));
this->button7->Cursor = System::Windows::Forms::Cursors::Default;
this->button7->Location = System::Drawing::Point(680, 152);
this->button7->Name = S"button7";
this->button7->Size = System::Drawing::Size(40, 25);
this->button7->TabIndex = 13;
//
// button8
//
this->button8->BackColor = System::Drawing::SystemColors::Desktop;
this->button8->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button8.BackgroundImage")));
this->button8->Cursor = System::Windows::Forms::Cursors::Default;
this->button8->Location = System::Drawing::Point(568, 272);
this->button8->Name = S"button8";
this->button8->Size = System::Drawing::Size(40, 25);
this->button8->TabIndex = 14;
//
// button9
//
this->button9->BackColor = System::Drawing::SystemColors::Desktop;
this->button9->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button9.BackgroundImage")));
this->button9->Cursor = System::Windows::Forms::Cursors::Default;
this->button9->Location = System::Drawing::Point(680, 192);
this->button9->Name = S"button9";
this->button9->Size = System::Drawing::Size(40, 25);
this->button9->TabIndex = 15;
//
// button10
//
this->button10->BackColor = System::Drawing::SystemColors::Desktop;
this->button10->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button10.BackgroundImage")));
this->button10->Cursor = System::Windows::Forms::Cursors::Default;
this->button10->Location = System::Drawing::Point(624, 192);
this->button10->Name = S"button10";
this->button10->Size = System::Drawing::Size(40, 25);
this->button10->TabIndex = 4;
//
// button11
//
this->button11->BackColor = System::Drawing::SystemColors::Desktop;
this->button11->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button11.BackgroundImage")));
this->button11->Cursor = System::Windows::Forms::Cursors::Default;
this->button11->Location = System::Drawing::Point(568, 192);
this->button11->Name = S"button11";
this->button11->Size = System::Drawing::Size(40, 25);
this->button11->TabIndex = 4;
//
// button12
//
this->button12->BackColor = System::Drawing::SystemColors::Desktop;
this->button12->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button12.BackgroundImage")));
this->button12->Cursor = System::Windows::Forms::Cursors::Default;
this->button12->Location = System::Drawing::Point(568, 232);
this->button12->Name = S"button12";
this->button12->Size = System::Drawing::Size(40, 25);
this->button12->TabIndex = 16;
//
// button13
//
this->button13->BackColor = System::Drawing::SystemColors::Desktop;
this->button13->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button13.BackgroundImage")));
this->button13->Cursor = System::Windows::Forms::Cursors::Default;
this->button13->Location = System::Drawing::Point(624, 232);
this->button13->Name = S"button13";
this->button13->Size = System::Drawing::Size(40, 25);
this->button13->TabIndex = 4;
//
// button14
//
this->button14->BackColor = System::Drawing::SystemColors::Desktop;
this->button14->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button14.BackgroundImage")));
this->button14->Cursor = System::Windows::Forms::Cursors::Default;
this->button14->Location = System::Drawing::Point(680, 232);
this->button14->Name = S"button14";
this->button14->Size = System::Drawing::Size(40, 25);
this->button14->TabIndex = 4;
//
// button15
//
this->button15->BackColor = System::Drawing::SystemColors::Desktop;
this->button15->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button15.BackgroundImage")));
this->button15->Cursor = System::Windows::Forms::Cursors::Default;
this->button15->Location = System::Drawing::Point(624, 72);
this->button15->Name = S"button15";
this->button15->Size = System::Drawing::Size(96, 25);
this->button15->TabIndex = 17;
//
// button16
//
this->button16->BackColor = System::Drawing::SystemColors::Desktop;
this->button16->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button16.BackgroundImage")));
this->button16->Cursor = System::Windows::Forms::Cursors::Default;
this->button16->Location = System::Drawing::Point(624, 272);
this->button16->Name = S"button16";
this->button16->Size = System::Drawing::Size(96, 25);
this->button16->TabIndex = 18;
//
// button17
//
this->button17->BackColor = System::Drawing::SystemColors::Desktop;
this->button17->BackgroundImage = (__try_cast<system::drawing::image *="">(resources->GetObject(S"button17.BackgroundImage")));
this->button17->Cursor = System::Windows::Forms::Cursors::Default;
this->button17->Location = System::Drawing::Point(568, 152);
this->button17->Name = S"button17";
this->button17->Size = System::Drawing::Size(40, 25);
this->button17->TabIndex = 19;
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->BackColor = System::Drawing::SystemColors::ControlDarkDark;
this->ClientSize = System::Drawing::Size(744, 358);
this->Controls->Add(this->button17);
this->Controls->Add(this->button16);
this->Controls->Add(this->button15);
this->Controls->Add(this->button12);
this->Controls->Add(this->button9);
this->Controls->Add(this->button8);
this->Controls->Add(this->button7);
this->Controls->Add(this->button6);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->vScrollBar1);
this->Controls->Add(this->button5);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Controls->Add(this->panel1);
this->Controls->Add(this->button10);
this->Controls->Add(this->button11);
this->Controls->Add(this->button13);
this->Controls->Add(this->button14);
this->Font = new System::Drawing::Font(S"Franklin Gothic Book", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, (System::Byte)0);
this->ForeColor = System::Drawing::SystemColors::ControlText;
this->Icon = (__try_cast<system::drawing::icon *="">(resources->GetObject(S"$this.Icon")));
this->Name = S"Form1";
this->Text = S"Form1";
this->ResumeLayout(false);
}
void InitForm()
{
//pen
this->rubberband = new Pen(Color::Blue, 5);
//point offset
//this->offset= Point(,0);
this->insideColor = new SolidBrush(Color::Thistle);
this->mouseDown = false;
this->mouseLock = false;
}
private: System::Void Joystick_MouseUp(Object* sender, MouseEventArgs* e)
{
mouseDown = false;
if(!mouseLock)
{
this->panel1->Refresh();//Invalidate();
}
}
private: System::Void Wheeled (Object *sender,MouseEventArgs* e)
{
// i will use here later
}
private: System::Void Joystick_MouseMove(Object* sender, MouseEventArgs* e)
{
//static Point offset;
offset = System::Drawing::Point(e->X,e->Y);
if(e->Button == MouseButtons::Left || e->Button == MouseButtons::Right)
{
String *text = new String("");
//text = text->Concat( S" Veli ", S" Veli" );
text = text->Concat(offset.X.ToString(), S",", offset.Y.ToString());
this->textBox1->Text = text;
}
if(mouseDown)
{
offset.X = e->X;
offset.Y = e->Y;
this->panel1->Refresh();// same as Invalidate(System::Drawing::Rectangle(0,0,160,160), false);
}
else if( !mouseLock)
{
offset.X = radius;
offset.Y = radius;
this->panel1->Refresh();
}
//this->Invalidate(System::Drawing::Rectangle(100,100,150,150), false);
}
private: System::Void Joystick_MouseDown(Object* sender, MouseEventArgs* e)
{
if(e->Button == MouseButtons::Left)
{
mouseDown = true;
mouseLock = false;
offset.X = e->X;
offset.Y = e->Y;
this->panel1->Refresh();// same as Invalidate();
}
else if(e->Button == MouseButtons::Right)
mouseLock = true;
}
/* GUI joystick (mouse stick) in panel */
private: System::Void panel1_Paint(System::Object * sender, PaintEventArgs * e)
{
this->g = e->Graphics;
GraphicsPath* serge = new GraphicsPath();
SolidBrush *sb = new SolidBrush(Color::Cornsilk);
SolidBrush *sb2= new SolidBrush(Color::Blue);
serge->AddEllipse(this->panel1->ClientRectangle);
g->FillEllipse(sb2,System::Drawing::Rectangle(0,0,160,160));
g->FillEllipse(sb,System::Drawing::Rectangle(5,5,150,150));
this->panel1->Region = new System::Drawing::Region(serge);
g->DrawLine(rubberband,offset.X,offset.Y,80,80);
// in order to solve flickering i have to use double buffering
this->SetStyle( ControlStyles::AllPaintingInWmPaint, true);
this->SetStyle( ControlStyles::UserPaint, true);
this->SetStyle( ControlStyles::DoubleBuffer, true );
}
};
}
|
|
|
|
|
In C# project I could include any file in my assembly and access them with
Assembly.GetManifestResourceStream(...)
Is it possible to do the same thing in ManagedC++ projects?
How?
|
|
|
|
|
found it:
project properties => configuration properties => linker => input => embeded managed resource file
|
|
|
|
|
Hi
I have a project where by I define a pre-processor variable entitled PROEDITION. In the project where I define this variable some .cpp files seem to understand that the variable PROEDITION has been defined. Unfortunately one of the most important .cpp files does not seem to pick up this pre-processor variable. Is there a reason why this would happen? It's not just this pre-processor variable, it could be any of them that I define at project scope. It just seems that one of my .cpp files does not understand the pre-processor variables at all.
Any help on this would be appreciated.
Dave
|
|
|
|
|
Where did you define PROEDITION?
Best,
Jun
|
|
|
|
|
I defined PROEDITION in the Pre Processor Definitions
WIN32;_DEBUG;_WINDOWS;_USRDLL;PROEDITION
That is what is in there currently.
Dave
test
|
|
|
|
|
Is the last separator a ":" or a ";"? I am asking because there is a smiley there and I am not sure if this forum uses (thats a test - Semicolon P) as a smiley or :P (another test - Colon P) or maybe both.
Edit: OK. It uses both.
Worth a try, though.
*Test ends*
|
|
|
|
|