S
Scott Chang
Hi all,
I loaded the following program 'HelloMCPP' to my MS
VC++ .NET (2002) that is installed on my Windows XP
Professional PC:
-------------------------------------
AssemblyInfo.cpp
---------------------
#include "stdafx.h"
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
//
// General Information about an assembly is controlled
through the following
// set of attributes. Change these attribute values to
modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("")];
[assembly:AssemblyCopyrightAttribute("")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the
following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the
Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
//
// In order to sign your assembly you must specify a key
to use. Refer to the
// Microsoft .NET Framework documentation for more
information on assembly signing.
//
// Use the attributes below to control which key is used
for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not
signed.
// (*) KeyName refers to a key that has been installed
in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers
to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both
specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that
key is used.
// (2) If the KeyName does not exist and the
KeyFile does exist, the key
// in the KeyFile is installed into the CSP and
used.
// (*) In order to create a KeyFile, you can use the
sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of
the KeyFile should be
// relative to the project directory.
// (*) Delay Signing is an advanced option - see the
Microsoft .NET Framework
// documentation for more information on this.
//
[assembly:AssemblyDelaySignAttribute(false)];
[assembly:AssemblyKeyFileAttribute("")];
[assembly:AssemblyKeyNameAttribute("")];
--------------------------------
HelloMCPP.cpp
--------------------
// This is the main DLL file.
#include "stdafx.h"
#include "HelloMCPP.h"
----------------------
Stdafx.cpp
-------------------
// stdafx.cpp : source file that includes just the
standard includes
// HelloMCPP.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type
information
#include "stdafx.h"
----------------------
HelloMCPP.h
-----------------
// HelloMCPP.h
#pragma once
using namespace System;
namespace HelloMCPP
{
public __gc class HelloMCPP
{
public:
virtual void Hello()
{
Console::WriteLine(S"Hello from Managed C++!");
}
};
}
--------------------------------------
stdafx.h
-------------------------------
// stdafx.h : include file for standard system include
files,
// or project specific include files that are used
frequently,
// but are changed infrequently
#pragma once
#using <mscorlib.dll>
----------------------------------------------
I did 'Build' and ran this program - I got the following
dialog box:
HelloMCPP-Executable for Debugging Session
Please specify the name of the executable file to be
used for the debug session:
Executable file name:
------------------------------
| | \/ |
------------------------------
(There are three choices in this drop-down:
Internet Explorer
ActiveX Control Test Container
regsvr32)
URL where the project can be assessed
(ATL Server only):
--------------------------------
| |
--------------------------------
(1) I do not know what to pick in the "three choices"
and/or to fill the "URL" box. Please help and tell me
what I should do to get the "Hellow from Managed C++!"
printed out on my computer via the console or Internet.
(2) How does this program use a DLL to pass on
the "Hellow from Managed C++!" to somewhere for printing?
I do not understand this DLL at all!!!??? I do not know
much about DLL. Please explain it to me or point out
where I made a mistake for not specifying a right thing
during the conpiling of this program.
Thanks in advance,
Scott Chang
I loaded the following program 'HelloMCPP' to my MS
VC++ .NET (2002) that is installed on my Windows XP
Professional PC:
-------------------------------------
AssemblyInfo.cpp
---------------------
#include "stdafx.h"
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
//
// General Information about an assembly is controlled
through the following
// set of attributes. Change these attribute values to
modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("")];
[assembly:AssemblyCopyrightAttribute("")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the
following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the
Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
//
// In order to sign your assembly you must specify a key
to use. Refer to the
// Microsoft .NET Framework documentation for more
information on assembly signing.
//
// Use the attributes below to control which key is used
for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not
signed.
// (*) KeyName refers to a key that has been installed
in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers
to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both
specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that
key is used.
// (2) If the KeyName does not exist and the
KeyFile does exist, the key
// in the KeyFile is installed into the CSP and
used.
// (*) In order to create a KeyFile, you can use the
sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of
the KeyFile should be
// relative to the project directory.
// (*) Delay Signing is an advanced option - see the
Microsoft .NET Framework
// documentation for more information on this.
//
[assembly:AssemblyDelaySignAttribute(false)];
[assembly:AssemblyKeyFileAttribute("")];
[assembly:AssemblyKeyNameAttribute("")];
--------------------------------
HelloMCPP.cpp
--------------------
// This is the main DLL file.
#include "stdafx.h"
#include "HelloMCPP.h"
----------------------
Stdafx.cpp
-------------------
// stdafx.cpp : source file that includes just the
standard includes
// HelloMCPP.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type
information
#include "stdafx.h"
----------------------
HelloMCPP.h
-----------------
// HelloMCPP.h
#pragma once
using namespace System;
namespace HelloMCPP
{
public __gc class HelloMCPP
{
public:
virtual void Hello()
{
Console::WriteLine(S"Hello from Managed C++!");
}
};
}
--------------------------------------
stdafx.h
-------------------------------
// stdafx.h : include file for standard system include
files,
// or project specific include files that are used
frequently,
// but are changed infrequently
#pragma once
#using <mscorlib.dll>
----------------------------------------------
I did 'Build' and ran this program - I got the following
dialog box:
HelloMCPP-Executable for Debugging Session
Please specify the name of the executable file to be
used for the debug session:
Executable file name:
------------------------------
| | \/ |
------------------------------
(There are three choices in this drop-down:
Internet Explorer
ActiveX Control Test Container
regsvr32)
URL where the project can be assessed
(ATL Server only):
--------------------------------
| |
--------------------------------
(1) I do not know what to pick in the "three choices"
and/or to fill the "URL" box. Please help and tell me
what I should do to get the "Hellow from Managed C++!"
printed out on my computer via the console or Internet.
(2) How does this program use a DLL to pass on
the "Hellow from Managed C++!" to somewhere for printing?
I do not understand this DLL at all!!!??? I do not know
much about DLL. Please explain it to me or point out
where I made a mistake for not specifying a right thing
during the conpiling of this program.
Thanks in advance,
Scott Chang