|
sorry about posting in the wrong forum... I'm a student, and to be honest, I don't know what the difference is between C++/CLI or any other C++ programing. All I know is that it's C++ and this forum has "C++" in the title.
Sorry again.
Ruby
|
|
|
|
|
Hello,
Jus try:
1. total_grams = grams + kilograms * GRAMS_PER_KILOGRAM;
2. ounces = pounds*OUNCES_PER_POUND;
3. total_pounds = pounds + ounces/OUNCES_PER_POUND;
Regards,
|
|
|
|
|
For many years, I have been "naughty" in reusing my classes by copying the relevent files in to my current project in MSVC - I knew that I should be generating a library, but I was lazy !!! I have now generated a library and tried to alter my project settings to use MyLibrary. (I have experimented with a known working project) I have referenced the library by stating the path in MSVC/Project/Settings/Link and adding it to "Object/Library modules".
When I compile/link the project without making any source code changes (apart from adding a constructor for a class contained in MyLibrary), I get loads of errors (just under 200 !!), one of which I quote below:-
nafxcwd.lib(wincore.obj) : error LNK2005: "public: virtual void __thiscall CWnd::OnFinalRelease(void)" (?OnFinalRelease@CWnd@@UAEXXZ) already defined in mfc42d.lib(MFC42D.DLL)
If I remove the constructor for the class contained in MyLibrary, it links without error.
Can someone pin-point what I am doing wrong in the setup of my project within the MSVC (vers 6.0) build and usage of MyLibrary ?
Doug
|
|
|
|
|
DougButtimer wrote: 6.0
VC6.0 does not support C++/CLI, therefore this is the wrong forum, try the Visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
My apologies !! I realised that I had the wrong forum JUST after I posted it, but decided to let it go in case someone on this side knew the answer !!
Doug
|
|
|
|
|
Hello,
I am developing a dozen or so C++/CLI assemblies in my solution. When I apply even a smallest change to one of them (so the binary is updated on build), all other assemblies that refer to this modified assembly are getting fully rebuilt (along with their precompiled headers). It takes quite a lot of time, and seem completely unnecessary to me, as I am not modifying any interfaces, only implementations.
Is there a reasonable way to prevent the dependent assemblies from being rebuilt?
|
|
|
|
|
I need to create an 2 dimension array, wich type is picture box, so I have write such code:
<br />
private: static unsigned short int n = 100;<br />
private: static array < System::Windows::Forms::PictureBox^ >^ m; <br />
m = gcnew array < System::Windows::Forms::PictureBox^ > (n);<br />
for(int i=0; i < n; i++){<br />
m[i] = gcnew array < System::Windows::Forms::PictureBox^ >(n);<br />
for( int j = 0; j < n; j++){<br />
m[i, j] = gcnew System::Windows::Forms::PictureBox();<br />
m[i, j]->Location = System::Drawing::Point(200 + i, 250);<br />
m[i, j]->Visible = true;<br />
m[i, j]->Size = System::Drawing::Size(1, 1);<br />
m[i, j]->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;<br />
m[i, j]->Load("a.gif");<br />
Controls->Add(m[i, j]);<br />
}<br />
}
but i get an error, that this array is not 2 dimension
what can be wrong?
|
|
|
|
|
To create it in two dimensions, you need to create an array of arrays.
private: static array < array < System::Windows::Forms::PictureBox^> >^ m;
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thank you for your help
|
|
|
|
|
array<System::Windows::Forms::PictureBox^,2>^ m;
m = gcnew array<System::Windows::Forms::PictureBox^,2>(n,n);
|
|
|
|
|
i would adding a menu on treeView,i try
TreeNode^ eventLogsNode = gcnew TreeNode("Event Logs");<br />
eventLogsNode->ImageIndex=2;<br />
eventLogsNode->SelectedImageIndex=2;<br />
eventLogsNode->ContextMenuStrip=computerContextMenuStrip;<br />
treeView1->Nodes->Add(eventLogsNode);
But they are error:
error C2065: 'computerContextMenuStrip' : undeclared identifier
|
|
|
|
|
i would set the shortcut menu associated with this tree node
-- modified at 15:40 Saturday 10th March, 2007
|
|
|
|
|
I want to add a menu; treeView, there has for example root, and that we click on + who is situated near root a submenu which opens, Thank you
|
|
|
|
|
Hi,
It's about 5 day that I'm traying to create a MixedMode DLL with MFC and Managed C++. At this time I'm freak I don't really know what I'm doing. I have read a lot of documentation and I still confuse.
With more detail, I want to create an MFC Regular DLL that can be accessible in C# and from an other MFC application.
If any body have a good tutorial or a small project that implement the DLL, an application in MFC and an other application in C#.
Thank for your help.
|
|
|
|
|
When i declare :
EventLog* log2 = new EventLog();
it's write error about (*)??
Thank you
|
|
|
|
|
Perhaps if you told us what the error is ?
If EventLog is a managed object, I thought you needed to use gcnew ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How to create a new instance of treenode in winforms? in C# :
TreeNode eventLogsNode = new TreeNode("Event Logs");
and it work,
thank you
|
|
|
|
|
|
I would GetHostName and show him in treeView, i work with winforms, i try for
System::Net::Dns::GetHostName^ er;
treeView1->Nodes->Add(er);
and there are errors:
error C2065: 'er' : undeclared identifier
error C3867: 'System::Net::Dns::GetHostName': function call missing argument list; use '&System::Net::Dns::GetHostName' to create a pointer to member
Thank you
|
|
|
|
|
GetHostName is a static method:
String^ hostName = System::Net::Dns::GetHostName();
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I know the answer to this may be obvious but I have been struggling with it for about 8 hours now and just can't figure it out and my googling and other searchs have not yielded an answer.
I'm writng a managed C++ program in VS 2005 that is using some c# assemblies. I have one c# assembly method that has a signature like this:
public virtual void DoThis(string title, out Object valueToChange);
I have an example where some c# code is overriding the above method and the signature in the subclass is:
public override void DoThis(string title, out Object valueToChange);
In my C++ code I just cannot get my program to use my overriden implementation of this method. I have tried the following signatures in C++. None of them seem to match according to what I see in the debugger.
public virtual void DoThis(String title, Object % valueToChange);
public virtual void DoThis(String^ title, Object ^% valueToChange);
public virtual void DoThis(String^ title, Object ^ valueToChange);
public virtual void DoThis(String title, Object valueToChange);
public virtual void DoThis(String title, Object^ valueToChange);
public void DoThis(String title, Object % valueToChange);
public void DoThis(String^ title, Object ^% valueToChange);
public void DoThis(String^ title, Object ^ valueToChange);
public void DoThis(String title, Object valueToChange);
public void DoThis(String title, Object^ valueToChange);
What is the correct way to override an "out" c# method parameter in c++ code?
Thanks for any help
-Darryl
-- modified at 16:50 Friday 9th March, 2007
|
|
|
|
|
Have you tried:
using namespace System::Runtime::InteropServices;
...
public:
virtual void DoThis(String^ title, [Out] Object^% valueToChange) override;
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Wow thanks so much! I did have to change 1 part of what you suggested to get it to work (No ^ on the 1st param) but now I am so happy. I had wasted so much time on this problem. I didn't know about the InteropServices namespace before. I'll have to read up on it.
public:
virtual void DoThis(String title, [System::Runtime::InteropServices::Out] Object^% valueToChange) override;
Thanks,
-Darryl
|
|
|
|
|
I want to erase the contents of a progressbar and I save not what is the methode? I performed the progressbar with progressBar1->PerformStep();, i work with winforms
|
|
|
|
|
You could set Value to 0.
|
|
|
|