473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to access API function of a Managed C++ application?

Hi all,

How to access API function of a Managed C++ application?

Sample:

This doesn't work. (::MessageBox.)

----------------------------------------------------------------------------
------------------------

#pragma once

namespace teste

{

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 __gc class Form1 : public System::Windows::Forms::Form

{

public:

Form1(void)

{

InitializeComponent();

}

protected:

void Dispose(Boolean disposing)

{

if (disposing && components)

{

components->Dispose();

}

__super::Dispose(disposing);

}

private: System::Windows::Forms::LinkLabel * CallingAPI;

private:

/// <summary>

/// Required designer variable.

/// </summary>

System::ComponentModel::Container * components;

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

void InitializeComponent(void)

{

this->CallingAPI = new
System::Windows::Forms::LinkLabel();

this->SuspendLayout();

//

// CallingAPI

//

this->CallingAPI->Location = System::Drawing::Point(96,
96);

this->CallingAPI->Name = S"CallingAPI";

this->CallingAPI->TabIndex = 0;

this->CallingAPI->TabStop = true;

this->CallingAPI->Text = S"linkLabel1";

this->CallingAPI->LinkClicked += new
System::Windows::Forms::LinkLabelLinkClickedEventH andler(this,
CallingAPI_LinkClicked);

//

// Form1

//

this->AutoScaleBaseSize = System::Drawing::Size(5, 13);

this->ClientSize = System::Drawing::Size(292, 266);

this->Controls->Add(this->CallingAPI);

this->Name = S"Form1";

this->Text = S"Form1";

this->ResumeLayout(false);

}

private: System::Void CallingAPI_LinkClicked(System::Object * sender,
System::Windows::Forms::LinkLabelLinkClickedEventA rgs * e)

{

::MessageBox(NULL, "Call API MessageBox Function",
NULL, NULL); /***********************HERE**********************/

}

};

}

And COM+, How to access ? Any Idea?

--

:o)
Nov 17 '05 #1
1 1774
Renato,

Renato T. Forti wrote:
How to access API function of a Managed C++ application?
Remember to include the windows.h header file!

In form1.cpp, it reads:

#include "Form1.h"
#include <windows.h>

Change this to:

#include <windows.h>
#include "Form1.h"

Now it should work.
And COM+, How to access ? Any Idea?


COM+ components are known in .NET as serviced components. See

MSDN Library
-> Visual Studio .NET
-> .NET Framework
-> Programming with the .NET Framework
-> Writing Serviced Components

Bart Jacobs

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
35
by: deko | last post by:
Do I get more scalability if I split my database? The way I calculate things now, I'll be lucky to get 100,000 records in my Access 2003 mdb. Here some math: Max mdb/mde size = 2000 x 1024 =...
9
by: | last post by:
Hi All, I have allready tried to ask a similar question , but got no answer until now. In the meantime, I found, that I cannot understand some thread-settings for the Main() function . If I use...
7
by: Bonj | last post by:
Hi I have a mixed managed/unmanaged project which thanks to you guys I've managed to get rid of the linker errors of, so cheers for that. But now I'm experiencing an unknown access violation....
2
by: James Radke | last post by:
Hello, If I have some older C++ functions that I am calling from my code behind in a web form; and these functions use the C++ runtime which is found in the windows/system32 directory; how do I...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
0
by: Haxan | last post by:
Hi, I have an unmanaged application that converts a function pointer to a delegate and then pass this as a parameter(delegate) to a managed function which then invokes it. Currently Im able to...
7
by: Ashutosh Bhawasinka | last post by:
Hi, I have a C# .Net application which needs to use some feature which can be only developed in Visual C++ (its extended MAPI). The C# exe will be supplied to users without a setup. What kind...
1
by: GaryGen | last post by:
Hi, I have a VB.NET EXE which needs to remain in house. We would like to have outside people code modules that can be dynamically loaded and used by our EXE. We can place the requirement on the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.