Click here to Skip to main content
15,910,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralC++ and serialization Pin
_psh_23-Mar-04 5:42
_psh_23-Mar-04 5:42 
GeneralRe: C++ and serialization Pin
Robert A. T. Káldy23-Mar-04 10:30
Robert A. T. Káldy23-Mar-04 10:30 
GeneralRe: C++ and serialization Pin
_psh_23-Mar-04 21:48
_psh_23-Mar-04 21:48 
GeneralRe: C++ and serialization Pin
Ravi Bhavnani23-Mar-04 11:05
professionalRavi Bhavnani23-Mar-04 11:05 
GeneralRe: C++ and serialization Pin
_psh_23-Mar-04 23:10
_psh_23-Mar-04 23:10 
GeneralRe: C++ and serialization Pin
Ravi Bhavnani24-Mar-04 3:43
professionalRavi Bhavnani24-Mar-04 3:43 
GeneralRe: C++ and serialization Pin
_psh_24-Mar-04 3:53
_psh_24-Mar-04 3:53 
GeneralMixing C++ and C code - HELP Pin
Member 62566623-Mar-04 5:15
Member 62566623-Mar-04 5:15 
I have created a simple Form project and tried to mix C++ and my existing C code. With problems of course. There is no need for controls on the form to try this example. Here is the important code.

/* BEGIN - don.c */
/* ############################################################ */
/* ### This just a cut-down example of my C code ### */
/* ############################################################ */
/* ### The fact that it is C code and not C++ cannot change ### */
/* ############################################################ */
#include <stdio.h>

extern void showme(int); /* call this routine in Form1.h */

int magiccalc() /* Magic calculation - written in C */
{
showme(3); /* use the integer 3 instead of showing the calculations code */

return(0);
}
/* ############################################################ */
/* END - don.c */


/* BEGIN - Form1.h */
#pragma once


extern int magiccalc(void);

namespace sim50avc
{
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 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.
///

public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
int num;

InitializeComponent();
num = magiccalc(); /* Call magiccalc in don.c */
/* num is a meaningless return value */
}

protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}

private: System::Windows::Forms::TextBox * inputBox;
private: System::Windows::Forms::TextBox * outputBox;

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)
{
this->inputBox = new System::Windows::Forms::TextBox();
this->outputBox = new System::Windows::Forms::TextBox();
this->SuspendLayout();
//
// inputBox
//
this->inputBox->Location = System::Drawing::Point(16, 24);
this->inputBox->Multiline = true;
this->inputBox->Name = S"inputBox";
this->inputBox->Size = System::Drawing::Size(256, 88);
this->inputBox->TabIndex = 1;
this->inputBox->Text = S"inputBox";
//
// outputBox
//
this->outputBox->Location = System::Drawing::Point(16, 184);
this->outputBox->Multiline = true;
this->outputBox->Name = S"outputBox";
this->outputBox->Size = System::Drawing::Size(256, 88);
this->outputBox->TabIndex = 2;
this->outputBox->Text = S"";
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(292, 302);
this->Controls->Add(this->outputBox);
this->Controls->Add(this->inputBox);
this->Name = S"Form1";
this->Text = S"Form1";
this->ResumeLayout(false);

}

public:
void __cdecl showme(int thenum)
{
MessageBox::Show(S"abc", S"Result...");
}

};
}
/* END - Form1.h */

/* Thank You in advance */

Don
GeneralRe: Mixing C++ and C code - HELP Pin
Member 62566623-Mar-04 5:20
Member 62566623-Mar-04 5:20 
GeneralRe: Mixing C++ and C code - HELP Pin
Maximilien23-Mar-04 5:44
Maximilien23-Mar-04 5:44 
GeneralRe: Mixing C++ and C code - HELP Pin
Pedro Ruiz23-Mar-04 7:30
Pedro Ruiz23-Mar-04 7:30 
GeneralRe: Mixing C++ and C code - HELP Pin
Member 62566623-Mar-04 7:36
Member 62566623-Mar-04 7:36 
GeneralRe: Mixing C++ and C code - HELP Pin
Pedro Ruiz23-Mar-04 7:48
Pedro Ruiz23-Mar-04 7:48 
GeneralRe: Mixing C++ and C code - HELP Pin
Member 62566623-Mar-04 7:35
Member 62566623-Mar-04 7:35 
GeneralRe: Mixing C++ and C code - HELP Pin
John R. Shaw23-Mar-04 11:04
John R. Shaw23-Mar-04 11:04 
Generaldll not terminating correctly Pin
BlackDice23-Mar-04 5:10
BlackDice23-Mar-04 5:10 
GeneralRe: dll not terminating correctly Pin
Blake Miller24-Mar-04 5:54
Blake Miller24-Mar-04 5:54 
GeneralLoad an image Pin
rrrado23-Mar-04 5:09
rrrado23-Mar-04 5:09 
GeneralRe: Load an image Pin
Jörgen Sigvardsson23-Mar-04 5:22
Jörgen Sigvardsson23-Mar-04 5:22 
GeneralRe: Load an image Pin
rrrado23-Mar-04 21:02
rrrado23-Mar-04 21:02 
GeneralRe: Load an image Pin
RadioShark23-Mar-04 6:21
RadioShark23-Mar-04 6:21 
GeneralRe: Load an image Pin
Jörgen Sigvardsson23-Mar-04 6:31
Jörgen Sigvardsson23-Mar-04 6:31 
QuestionMouse direction settings? Pin
DaFrawg23-Mar-04 4:35
DaFrawg23-Mar-04 4:35 
GeneralDisplaying CPropertySheet in a Dialog Pin
mmica23-Mar-04 4:09
mmica23-Mar-04 4:09 
GeneralRe: Displaying CPropertySheet in a Dialog Pin
David Crow23-Mar-04 4:16
David Crow23-Mar-04 4:16 

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.