|
One more question:
How do I get the resource files to compile as separate satellite assemblies rather than in the exe itself.
Right now I have 5 language resources, all of which are getting compiled into the EXE itself.
I want them to be separate as they should be.
This resources are Form resources. I have named them appropriately with .en-US.resx, .de-De.resx etc names
|
|
|
|
|
What "command line" are you referring to?
If you mean a command window, then there shouldn't be one by default in a Forms app.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, I am talking about command window.
It is showing up. I created the app from scratch, so I guess there is some problem with configuration.
I did not create forms app using the VS wizard.
thanks,
parth
|
|
|
|
|
You need to change the subsystem to "windows". Read here[^] for more info
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Hello,
I'm trying to create a dll in C++ with VS 2008 and creating an object MemoryStream.
So i write
MemoryStream *memStreamEncryptedData = new MemoryStream();
I included But it not work and i have a error message like this :
Error 1 error C2065: 'MemoryStream' : undeclared identifier
Error 2 error C2146: syntax error : missing ';' before identifier 'memStreamEncryptedData'
Error 3 error C2065: 'memStreamEncryptedData' : undeclared identifier
Error 4 error C2061: syntax error : identifier 'MemoryStream'
Please help me how can use it or if there is something else wich do the same work.
Thank you
|
|
|
|
|
khaliloenit wrote: Please help me how can use it or if there is something else wich do the same work.
Well you have to learn C++/CLI to use it or any other .NET classes. There are several introductory articles for C++/CLI here on CodeProject in the Articles or "CHAPTERS" part of the site.
|
|
|
|
|
So, have you please an example or some code to try it? I couldn't use C++/CLI and i had some problems with the included files.
Thank you
|
|
|
|
|
|
Well, there are several problems with the code if you are working in managed code. You should look up some tutorials.
You will have to include the namespace of Memorystream object(I have never used this class). Use gcnew instead of new and use ^ instead of *.
If you want to create unmanaged app, then I guess you have posted in wrong section.
Parth
|
|
|
|
|
Include this library System.IO.MemoryStream or System.IO
And have byte array (like: byte[] array )so to do
MemorySream^ Image = Gcnew MemoryStream(array);
Iam using Visual C++ Please.
modified on Thursday, August 20, 2009 9:17 AM
|
|
|
|
|
So I've been working on writing a C++/CLI wrapper around an unmanaged library. I've now got that working, but only on the command line, and I was hoping to get some quick help on how to get this all working in Visual Studio 2008.
I have the following files:
MyWrapper.dll
MyWrapper.dll.manifest
MyUnmanagedLibrary.lib
TestProgram.cs
MyWrapper.dll is compiled from C++/CLI code, MyUnmanagedLibrary.lib is compiled from unmanaged C code and TestProgram.cs is a C# program which calls functions defined in MyWrapper.dll
When I compile this code at the command line the following two commands are executed.
$ csc TestProgram.cs /r:MyWrapper.dll
$ mt /manifest MyWrapper.dll.manifest /outputresource:TestProgram.exe
Which produces TestProgram.exe
I'd like to know how I would go about importing this into, or creating, a Visual Studio 2008 project.
Any and all advice is very much appreciated.
|
|
|
|
|
Right click on the project and use Add reference. Browse MyWrapper.dll and you will get access to the types in that dll. If you have VS, I'd suggest to compile the C++/CLI application with it rather than command line. If you are doing this, you don't have to play with manifest tool manually. Visual studio does this for you.
Also are you not linking MyUnmanagedLibrary.lib to the MyWrapper.dll ?
|
|
|
|
|
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
|
|
|
|