|
Mark Salsbery wrote: Yes?
Is that your final answer?
led mike
|
|
|
|
|
Hello!
I'm have a public managed class in assembly1 with one internal static field field1. This assembly has attribute
[assembly: System::Runtime::CompilerServices::InternalsVisibleToAttribute("assemly2")].
But when I try to access these internal field1 from assembly2 I get an compiler error:
2> c:\projects\assembly1\assembly2\Assembly2.h(14) : error C2248: 'Assembly1::Class1::Field1' : cannot access private member declared in class 'Assembly1::Class1'
2> c:\projects\assembly1\assembly2\Assembly2.h(14) : see declaration of 'Assembly1::Class1::Field1'
2> c:\projects\assembly1\debug\assembly1.dll : see declaration of 'Assembly1::Class1'
VC++ 2008 used.
When I created the same project in VC# 2008 (assembly2) it compiles perfectly and see the internal field1 without any problems.
Source code:
<code>
#pragma once
using namespace System;
namespace Assembly1 {
public ref class Class1
{
internal:
static int Field1;
};
[assembly: System::Runtime::CompilerServices::InternalsVisibleToAttribute("Assembly2")];
}
===========================================================================
// Assembly2.h
#pragma once
using namespace System;
using namespace Assembly1;
namespace Assembly2 {
public ref class Class1
{
void TestC2248()
{
Assembly1::Class1::Field1 = 0; // C2248
}
};
}
</code>
What I'm doing wrong?
Thanks.
|
|
|
|
|
Abix wrote: What I'm doing wrong?
<font color="Red">#using "friend_assemblies.dll" as_friend</font>
from the documentation[^]
|
|
|
|
|
Thank you very much!
modified on Tuesday, January 15, 2008 11:17:56 AM
|
|
|
|
|
I have finish my application written in Visual c++ NEt 2005.
How To deploy it in another machine ?
|
|
|
|
|
|
Dear Sir,
In my Payroll Program, I need to show the picture of each worker.
I put all photos in one directory and the name of each is his id number.
What to di load photos in my form ?
|
|
|
|
|
mikobi wrote: What to di load photos in my form ?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I need it so at the hospital they need to see if the name is really the man who need health cure
|
|
|
|
|
How can I size SplitContainer panel1 so that it can have the same with then buttons I drawn in side programmatically.
|
|
|
|
|
Dear Sir,
How can I realise Navigation pane menu with Visual C++ NET 2005
|
|
|
|
|
I want to have my compiled html help point to a topic specific to where the mouse is pointing but I can't seem to determine which control the mouse is hovering over.
private: System::Void FrmMain_HelpRequested(System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent)
{
Point pt = this->PointToClient(hlpevent->MousePos);
Control^ requestingControl = dynamic_cast<control^>(sender);
Control ^ctrl = this->GetChildAtPoint(pt);
Control ^ctrl2 = this->ActiveControl;
if( File::Exists(this->helpProvider->HelpNamespace ) == true)
{
Help::ShowHelp(this, this->helpProvider->HelpNamespace);
}
}</control^>
ctrl is the form itself and crtl2 is the last active mdichild in my application.
requestingControl returns the form and not the item the mouse is over.
Hope someone can help
Programmer
Glenn Earl Graham
Austin, TX
modified on Friday, January 04, 2008 1:56:26 PM
|
|
|
|
|
Hi,
have a look at the sender parameter, I expect it to hold the current control; the only thing
required typically is a cast.
|
|
|
|
|
It does not.
The control is the form not the menu item. I have updated my code.
Thanks for the suggestion.
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Hi Glenn,
that's too bad, I don't know then.
|
|
|
|
|
I am definitely a newbie....
I'm trying to pass a path to a function that calls 'ShellExecute'...
I know that ShellExecute only recognizes path with '\\' in it.
I don't want the user to have to put '\\' in place of '\' in their path.
example:
real path > c:\thisfolder\thisfile.txt
c++ code > c:\\thisfolder\\thisfile.txt
does anyone know what I can do to figure this out...?
|
|
|
|
|
You can use the Replace method from the String class in your code.
yourString.Replace("\\","\\\\") , where yourString contains the real path.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
If you're getting a string from the user, you shouldn't have to
worry about this.
The "\\" is only used in string literals in your code. This is
necessary because a single '\' in a string literal starts an escape
sequence. When you use \\ in your string literals, the compiler will
convert it to \
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I've seen this happen with C# 2008 Express Edition on my desktop machine, but it works fine on the laptop.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello, I'm not sure which topic to post this kind of problem.
If I ask on the wrong board, please let me know.
I write a windows form project with CLR supporting, and I want to
package it into an exe file.
I run the exe file in the Debug folder. It works on my computer, but not on other's computer which doesn't install .NET.
But I want the exe file to be portable and without install.
It seems that it needs a .NET environment.
I try to install .net framework 2.0 to the computer which doesn't install Microsoft Visual Studio 2005.
But I still can't open the exe file, too.
Is it possible to create a exe file without install in Microsoft Visual Studio 2005?
Thx for ur reply.
Jane
|
|
|
|
|
minihotto wrote: But I want the exe file to be portable and without install.
Then don't use the .NET platform
minihotto wrote: Is it possible to create a exe file without install in Microsoft Visual Studio 2005?
Yes. The MSDN documentation has information detailing deployment issues of Visual Studio C++ projects, well any type of Visual Studio project actually.
|
|
|
|
|
A program written using /clr should run on any computer with .Net framework installed. Make sure that
1. The program in 100% .Net /clr then you can just install dotnetfx
2. Also check which version of .net are you targeting
3. If you are doing a mixed assembly, make sure you deploy appropriate CRT/OpenMP/ etc DLLs as well,
you can distribute using vcredist<arch>.exe or MSMs.
4. And finally, you need to distribute applications built in Release mode not Debug mode. Debug DLLs cannot be distributed.
|
|
|
|
|
How can I gain access to a file hosted on my server, and read from it?
Please help.
|
|
|
|
|
I'm beginner for graphical prog. in C++,
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* return with error code */
}
/* draw a line */
line(0, 0, getmaxx(), getmaxy());
/* clean up */
getch();
closegraph();
return 0;
}
But this programme show error while linking after compilation,
like, undefined symbol initgraph in module <prog. name.cpp="">
undefined symbol line in module <prog. name.cpp="">
undefined symbol graphresult in module <prog. name.cpp="">
Please someone help me in compiling and running it successfully.....Please
Thanks in Advance...
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
"Winners don't do different things. They do things differently. ...
|
|
|
|