Hi, The C program is the main executable file, the codes in c# is the function i would like to call. Can i compile the C# into a dll and use it in the C program? As i have not use the VC++.net before, do you have any idea whats the difference between the MFC, Win 32 or window Form. I wish to build a GUI, and some of my frds mention that i can use the MFC as it has the auto drag and drop toolbox, but i found out recently that VC++ window form also has this properties. Sorry for the trouble thanks alot jas
Cassiopeiaxy
Posts
-
Integrate C and C# Codes -
Integrate C and C# CodesHi, I find out that we can use the user32.dll to control the cursor. Do you happen to know the difference between using the user32.dll and ::Cursor::Position? Do you think it is easier if i convert my c coding to c++ using the ::Cursor::Position or should i try to use the user32.dll with the c coding? I try to create a new C++ file with the following codes: SAMPLE CODING: #pragma once namespace yg { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean up any resources being used. /// ~Form1() { if (components) { delete components; } } private: /// /// Required designer variable. /// System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// void InitializeComponent(void) { this->components = gcnew System::ComponentModel::Container(); this->Size = System::Drawing::Size(300,300); this->Text = L"Form1"; this->Padding = System::Windows::Forms::Padding(0); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; } #pragma endregion }; void MoveCursor() { ::Cursor::Position = Point(::Cursor::Position.X - 50,::Cursor::Position.Y - 50); } } Errors Encountered: error C3083: 'Cursor': the symbol to the left of a '::' must be a type c:\projects\yp\yg\yg\Form1.h 70 error C2039: 'Position' : is not a member of '`global namespace'' c:\projects\yp\yg\yg\Form1.h 70 error C2065: 'Position' : undeclared identifier c:\projects\yp\yg\yg\Form1.h 70 error C3083: 'Cursor': the symbol to the left of a '::' must be a type c:\projects\yp\yg\yg\Form1.h 70 error C2228: left of '.X' must have class/struct/union c:\projects\yp\yg\yg\Form1.h 70 error C3083: 'Cursor': the symbol to the left of a '::' must be a type c:\projects\yp\yg\yg\Form1.h 70 error C2228: left of '.Y' must have class/struct/union c:\projects\yp\yg\yg\Form1.h 70 Sorry for the trouble Thanks alot Jas
-
Integrate C and C# CodesHi, I can current move the cursor to the position by doing in a c# application: Cursor.Position = new Point(Cursor.Position.X - 0, Cursor.Position.Y - 80); However, if i run the above codes in a C application, it will give errors. I am developing a C application which is compile and run by using visual studio.net 2005, i cannot add the "using System.Windows.Forms;" to the C application too. Is there any other method they can perform the above cursor.position function in a C application? A short sample of the coding: #include "cv.h" #include "highgui.h" #include #ifdef _EiC #define WIN32 #endif using namespace System::Windows::Forms; <--- when i try to add the namespace, the program have alot of error upon compilation static CvMemStorage* storage = 0; static CvHaarClassifierCascade* cascade = 0; void detect_and_draw( IplImage* image ); Errors Encounter: error C2061: syntax error : identifier 'namespace' error C2143: syntax error : ';' error C2143: syntax error : missing '{' before ':' error C2059: syntax error: ':' I can't figure out the problems behind. Can anyone help? Thanks Jas
-
Mouse ClickingHi, I am currently working on a project named "motion detection to control pc". It is a project which can assist paralysed patient to access the pc using facial movement. I have a webcam capturing movement of head and translate it to mouse(cursor) movement. I can move the mouse(cursor) by using the Cursor.property function, however, i am still unable to double click/right click the mouse using codes. Any can help? ***************************************************************************** Cursor.Position = new Point(Cursor.Position.X - 0, Cursor.Position.Y - 80); ***************************************************************************** Thanks~
-
Image Processing using visual c++Hi, I am a newbie to image processing and c++. Actually, i have a web cam running, i need to snap shot consecutive pictures and convert each picture into a 2D array storing intensity(integer). If i have 2 picture namely picture 1 and picture 2: Picture 1 -- First 2 D array Picture 2 -- Second 2D array A comparison have to be done with the two 2 D array to find the differences. I have no idea on how should i start the project, anyone can assist me pls? Thanks
-
Program Mouse(Cursor)Hi, I am a newbie towards c#, not very sure whether i did the correct way. Can you assist me? I have write a simple coding using Cursor.Position: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void MoveCursor() { if(!this.Cursor.Equals(Cursors.Default)) { this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50); MessageBox.Show(Cursor.Position.X.ToString); } } private void Form1_Load(object sender, System.EventArgs e) { MoveCursor(); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I actually wanna do a simple codes which can read the current mouse position and write a new mouse position to it. However, the above codes cause an error: "Method 'int.ToString(string)' referenced without parentheses" which i do not the cause of this error.
-
Program Mouse(Cursor)Hi, I am currently working on a project named "motion detection to control pc". It is a project which can assist paralysed patient to access the pc using facial movement. I have a webcam capturing movement of head and translate it to mouse(cursor) movement. Do anyone have any idea on how to use codes to control/ program the mouse(cursor) movement? Thanks~