|
I prefer to do things at the command line. I'm an emacs person to the core, and I really can't get on top of IDEs. I only need to know how to get my code working in Visual Studio for the tutorial I'm writing that will be packaged with the code.
Yes, MyUnmanagedLibrary.lib
|
|
|
|
|
I prefer to do things at the command line. I'm an emacs person to the core, and I really can't get on top of IDEs. I only need to know how to get my code working in Visual Studio for the tutorial I'm writing that will be packaged with the code.
Yes, MyUnmanagedLibrary.lib , is linked to MyWrapper.dll , but I assumed I didn't have to do anything special in Visual Studio, just drop the library file in the same folder as the dynamic link library. When I distribute the code to another machine, all I need to do to compile new C# applications that use MyWrapper.dll is direct the compiler at MyWrapper.dll using the /r:MyWrapper.dll flag. If there's something else I need to do, I'd love to hear.
Once again thank you very much, Navaneeth, you're quite the .NET guru.
|
|
|
|
|
Since the MyUnmanagedLibrary.lib is statically linked to MyWrapper.dll , you only need to distribute MyWrapper.dll .
Shadowsoal wrote: When I distribute the code to another machine, all I need to do to compile new C# applications that use MyWrapper.dll is direct the compiler at MyWrapper.dll using the /r:MyWrapper.dll flag
Yes.
Shadowsoal wrote: I prefer to do things at the command line. I'm an emacs person to the core,
I use EMACS at work for doing C++ on LINUX. It's a great editor. But when developing on top of .NET framework, I guess VS is more appropriate.
|
|
|
|
|
I'm trying to override an indexer in a Dictionary but I can't figure out what the syntax is (or even if this is possible). I tried overloading the operator but it simply complains that you cannot have both a default property indexer and an operator. There seems to be a lot of examples for C#, can anyone help me out?
Regards,
JP
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
Esmo2000 wrote: I'm trying to override an indexer in a Dictionary
Dictionary classes indexer is not virtual. So you can't override it. If you are looking for writing virtual indexer and overriding in a derived class, here you go.
ref class BaseClass
{
public:
property int Index[int]
{
virtual int get(int index)
{
Console::WriteLine("Base class get()");
return 0;
}
}
};
ref class DerivedClass : public BaseClass
{
public:
property int Index[int]
{
virtual int get(int index) override
{
Console::WriteLine("Derived class get()");
return 0;
}
}
};
int main()
{
BaseClass^ b = gcnew DerivedClass();
int a = b->Index[10];
return 0;
} Like in standard C++, implicit overriding is not supported in C++/CLI. You have to explicitly specify it with override keyword.
|
|
|
|
|
I am using Visual c++ 2005,
How can I read Excel Spreadsheet and write to it ?
I have expent much time to search how to do it.
Can you help me.
Urgent.
Thanks
|
|
|
|
|
Use Microsoft.Office.Interop.Excel
|
|
|
|
|
Hello,
I have used timezoneinfo class in C# and until i know it is part of .net libraries.
But I am not able to use it under c++. It returns with error "class not found".
Does anybody have any idea about this?
Regards,
Parth
|
|
|
|
|
TimeZoneInfo is a new class added in .NET 3.5. So probably the project don't have correct references. Try the following
1 - Right click on project and take properties
2 - Navigate to Common Properties - Framework and references
3 - Check the version of System.Core referenced. It should be 3.5. If it is not 3.5 or not added, use Add Reference to add it.
Now you will have access to TimeZoneInfo .
|
|
|
|
|
That worked.
Thanks,
Parth
|
|
|
|
|
hi guys,
i have been battling with this code for the last 2 days and i still cant get on top of it. all i want is to save all of the lines that i have in my listbox to a specified ini file. i think i am getting real close but i am getting this one error that i dont know what it means.
if(listBox1->Items->Count>0)<br />
{ <br />
IniFile ^iniFile = gcnew IniFile("C:\\wefne\\ndf");<br />
iniFile->writeSection("Options", "Startfile", "D:\\Sasdsa\\asdas\\__sdfsdf.txt");<br />
<br />
IniFile ^iniFile1 = gcnew IniFile("D:\\Student\\sdfsd\\sds.ini");<br />
for(int i=0; listBox1->Items->Count-1; i++)<br />
{<br />
<br />
<br />
iniFile1->WritePrivateProfileString("Last Variables", "listBox1_Items" + i.ToString(), listBox1->Items[i], L"D:\\Student\\sdfsd\\sds.ini");<br />
}<br />
the error i am getting is error C2039: 'WritePrivateProfileString' : is not a member of 'IniFileHandling::IniFile
i am using Visual Studio Express 2008
thanks in advance
|
|
|
|
|
Yane87 wrote: error C2039: 'WritePrivateProfileString' : is not a member of 'IniFileHandling::IniFile
That message is very clear. The object in your code iniFile1 is of type IniFile and you are attempting to call a method of the class named WritePrivateProfileString which does not exist as a method of that class.
|
|
|
|
|
for(int i=0; listBox1->Items->Count+1; i--)
{
// Get the string contained in each item.
listBox1->GetItemText;
String^ itemString = (String^) listBox1->Items[i];
//String itemString = listBox1->GetItemText( listBox1->Items[i]);
iniFile1->writeSection("Last Variables", "listBox1_Items" ,/*+ i.ToString(), itemString */listBox1->Items[i], );
}
here is some new code that i have, the for loop seems to be fine. but the problem is getting the items from the listbox and converting them to text. then ´gettiing the text and putting it into an ini file.
does anyone have any suggestions? i am not exactly expecting the code done for me, but some tips would be greatly apprectiated. thanks
|
|
|
|
|
It seems likely that you need to obtain a beginner programmers book or enroll at University or something. Trying to learn how to program using internet forums is very unproductive and illogical. Furthermore I would certainly NOT recommend C++/CLI as a beginner language.
|
|
|
|
|
Mate if you dont know the answer to the question just keep your stupid comments to yourself. Or just be man enough to admit it that you dont know the answer. I ended up finding the problem and fixing it anyway, not bad for a beginner ha??
Just for your info I am a University student, and I do have a beginners book. But contrary to what you might think, you cant find the answer to all the questions in a book.
|
|
|
|
|
f*** off a**hole
Yane87 wrote: Mate if you dont know the answer to the question just keep your stupid comments to yourself. Or just be man enough to admit it that you dont know the answer.
> From: Yane87
>
> Mate you are a joke. I do know how to program and I am enrolled at a very good University. I am just stuck on one little problem and I am asking for help just like anyone else on this forum. What gives you the right to go and try to put me down with such comments. If you know the answer to the question I posted answer it, if not just keep your dirty little mouth shut.
modified on Friday, June 26, 2009 10:54 AM
|
|
|
|
|
std::list < xlong > ClientConfig:: GetHistory(int id)
{
....
doing something
....
return 0;
}
When the above code is compailed in VS 2005 (VC++), following is the error
error C2664: 'stlp_std::list<_Tp>::list(const stlp_std::list<_Tp> &)' : cannot convert parameter 1 from 'int' to 'const stlp_std::list<_Tp> &'
with
[
_Tp=xlong
]
Reason: cannot convert from 'int' to 'const stlp_std::list<_Tp>'
with
[
_Tp=xlong
]
Constructor for class 'stlp_std::list<_Tp>' is declared 'explicit'
with
[
_Tp=xlong
]
resdata.cpp
I tried to return xlong value, but still getting the same error
Can any once help to fix the same
|
|
|
|
|
int ClientConfig::GetHistory(int id)
{
... do something...
return 0;
}
|
|
|
|
|
In my CLI program, when I say:
CHAR *Buffer = new CHAR[ 4096 ];
.
strncpy( Buffer, OtherBuffer, 1024 );
.
.
CString Message = Buffer;
the CString cuts off the string after 256 characters.
Why does it do this, and what can I do about it?
|
|
|
|
|
Richard Andrew x64 wrote: Why does it do this, and what can I do about it?
The why is most like dependent on what is in the source buffer. The most obvious guess is that it contains a null byte at 257
|
|
|
|
|
When I put using namespace System::Drawing; into my ref class header file, it says that "'Drawing' is not a member of 'System'"
I have manually added a reference to the System.Drawing.dll , but it still can't find the Drawing namespace.
What could be wrong?
|
|
|
|
|
Nevermind, I rebuilt the project, and now it works.
Seems the problem had to do with the pre-compiled header not being rebuilt.
|
|
|
|
|
Hi, sorry if this has already been answered somewhere, I wasn't able to locate it. I'm trying to dynamically assign one buttons "ButtonClick" event handler to another.
ex: Button2->Click = Button1->Click;
Except I get this error:
error C3918: usage requires 'System::Windows::Forms::Button::Click' to be a data member
I know this means I need to do something like "gcnew EventHandler(this, &Button1_Click);", which is how button 1 is setup, but is there anyway to assign that event dynamically to Button2? Thanks!
|
|
|
|
|
Hi,
My C++/CLI is not fluent, so I'll give you principles only.
All code is dynamic, it runs at run-time. Even the stuff you "design" using Visual Designer gets turned into real code, which sits hidden in some project files (look in your solution pane, there will be files you did not create yourself).
Then, whatever does it for button1 would also do it for button2, just create similar statements; do put them in one of your own files, possibly in your form's constructor, right after the call to InitializeComponents.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Ok, but to setup Button2 like Button1 I would have to hard code the function name which I want to use as the event handler function (eg: Button2->Click += gcnew EventHandler(this, &BUTTON1_EVENT_FUNCTION);) I cannot do this, as I'm trying to set Button2 to whatever the last button used was, so I would like to avoid having to hard code EVERY possible function in some sort of switch statement for Button2. I just want to be able to set its EventHandler in run time.
|
|
|
|