|
|
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.
|
|
|
|
|
|
abbd wrote: How set to 0 ?????
progressBar1.Value = 0;
|
|
|
|
|
Set the ProgressBar.Value property to 0?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I have developed a text editor supporting international languages.
One problem still bother me: The location of the IME window.
When I have an asian user entering asian characters, (s)he does so through an IME window which is located in a seemingly unpredictable/uncontrollable location.
Is there a way I could set the location, size, and font (or at least font size) used by this IME window?
How could I know when it is used or not?
|
|
|
|
|
I would use listView, but i don't know how ican add 2 item i try:
istView1->Items->Add(cli::array<string^>^ tabChaine = {"Element 1", "Element 2"});
but there are errors,Thank you
|
|
|
|
|
What are the errors?
I don't see a ListView.ListViewItemCollection.Add overload that takes a "cli::array^" as an
argument.
Also managed object references don't work like C++ pointers so this won't work:
cli::array^ tabChaine = {"Element 1", "Element 2"}
Have you seen the example code here[^]?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Mark Salsbery wrote: Also managed object references don't work like C++ pointers so this won't work:
cli::array^ tabChaine = {"Element 1", "Element 2"}
However, the below code works but not in the context our friend was using it in.
array<String^>^ items = {L"Hello", L", ", L"world!\n"};<br />
<br />
for each (String^ item in items)<br />
{<br />
Console::Write(item);<br />
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
wow. I need to move to VS 2005
Thanks!
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hey guys, it has been a while /cry. I seem to be having some issues with comparing values in a file, such as finding the highest value in a file in mixed order and outputting to a file in correct order. I have a file created with the following text 4,3,1,2, my object is to find the highest value then output to a file in correct orsder to 1,2,3,4. This is all I have and I am a little rusty cause it has been a while:
// iofilecomp.cpp : Defines the entry point for the console application.
// iofilecomp.cpp : Explains how to copy the contents from one file to another.
//
#include "stdafx.h"
#include <conio.h>
#include <string>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream ins; //reads from file
ofstream ous; //writes to file
ins.open("in.dat");
ous.open("ou.dat");
string line;
if( ins.is_open )
{
while ( ! ins.eof() )
{
getline(ins, line);
cout << line << endl;
}
ins.close();
}
else cout << "Unable to open file.";
ous.close();
_getch();
return 0;
}
The above will only output in the order read from the file. Possibly could I get some assistance or pointed in the right direction please. Thank you.
|
|
|
|
|
Probably, you can ask this in right forum. VC++[^] in this case.
|
|
|
|
|
Sorry I am unfamiliar with the sort/vector function i was hoping something a little more basic something like using the if do func, I just need to get either the lowest value first or the highest value first then start comparing. How would I go about find the highest/lowest value in a file.
|
|
|
|
|
I guess you didn't understand prasad_som! This is the wrong forum to ask a Native C++ question. You need to go to the Visual C++/MFC forum to ask your question. This is the (MANAGED) C++/CLI forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I would create an executable who can run in any computer, I work with WinForms
Thank you very mutch
|
|
|
|
|
You would like to create a managed C++/CLI executable using Windows Forms that can run on any computer?
No, you cannot create such an executable.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I use Windows Forms Application and i would execute an another application like a Word file, i try ShellExecute; But there are errors, i write :
ShellExecute(0,'OPEN','C:\Documents and Settings\abbd\Bureau\App2.0\Ids 0.0\Ids 0.0\az.doc',Nil,Nil, SW_SHOW);
error C2015: too many characters in constant
error C2065: 'Nil' : undeclared identifier
error C2065: 'SW_SHOW' : undeclared identifier
error C3861: 'ShellExecute': identifier not found
Please help to execute this file, thank you.
|
|
|
|
|
Since you are using .NET, you should use Process::Start
|
|
|
|
|
abbd wrote: error C3861: 'ShellExecute': identifier not found
That error indicates you don't know how to #include header files for C++ development. The fact that you don't know that indicates that you need to step back to student mode and learn some prerequisite programming topics before you try to write working windows applications.
led mike
|
|
|
|