473,938 Members | 15,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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::Compone ntModel;

using namespace System::Collect ions;

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)

{

InitializeCompo nent();

}

protected:

void Dispose(Boolean disposing)

{

if (disposing && components)

{

components->Dispose();

}

__super::Dispos e(disposing);

}

private: System::Windows ::Forms::LinkLa bel * CallingAPI;

private:

/// <summary>

/// Required designer variable.

/// </summary>

System::Compone ntModel::Contai ner * components;

/// <summary>

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

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

/// </summary>

void InitializeCompo nent(void)

{

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

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::LinkLa belLinkClickedE ventHandler(thi s,
CallingAPI_Link Clicked);

//

// Form1

//

this->AutoScaleBaseS ize = 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(f alse);

}

private: System::Void CallingAPI_Link Clicked(System: :Object * sender,
System::Windows ::Forms::LinkLa belLinkClickedE ventArgs * e)

{

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

}

};

}

And COM+, How to access ? Any Idea?

--

:o)
Nov 17 '05 #1
1 1788
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
4078
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 again, Excel hangs. OR if I open Excel again (say from a desktop icon) before I close Access, Excel hangs. (this has happened for both 97 & 2000 for me) I of course thought that I mustn't be unloading a variable properly.
35
3247
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 = 2,048,000k Let's say on average each record in the database consumes 15k 2,048,000/15 = 136,533 records
9
6348
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 the attribute for the Main() function, I get "access denied error", if I use a ManagementEventWatcher to connect to the local machine to receive events. Is there anybody out there, how possibly can explain why this happens?? If I remove this...
7
1676
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. Firstly this is an extended stored procedure DLL, I've been able to debug it successfully by starting SQL server with the -c switch and when it is called via osql then it breaks into the debugger. Fine. I'm happy with that.... However the project...
2
1059
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 ensure that I have security set up to access these functions from my web form code behind? My application is just hanging when I call the functions from a webform, but they run fine in a windows application.....
5
2702
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 that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
0
2028
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 jump to this unmanaged function, but the values of the parameters inside this function Im seeing are not correct(they have some garbage values). //unmanaged class (C++ application)
7
1633
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 of exe/dll should I develop in Visual C++ so that I can meet these requirements 1) No administrator rights are required
1
928
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 external modules that they be managed if needed. I am assuming we would want them to create DLL's. I can load these dynamically with LoadLibrary and access functions using GetProcAddress and Marshal.GetDelegateForFunctionPointer.
0
10134
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11288
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8218
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7381
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6075
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4904
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3501
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.