|
|
Hi everybody.
Is there a way to use .NET Remoting with Visual C++ .Net?
In positive case, how to build the interfaces like they're
built in C#?
Thanks,
Moises.
|
|
|
|
|
|
|
Hello.
I'm writing a managed C++ application, and I have created a __gc class that acts as a Cache between the Database and my application.
I want that this caché can be accesed from anywhere in the application.
So I tried to do this.
In stdafx.h
extern CCache* g_pCache;
In stdafx.cpp
CCache* g_pCache = new CCache ();
and I have the following error message:
error C3145: 'g_pCache' : cannot declare a global or static managed type object or a __gc pointer
Its possible to define a variable of a managed type that its global ? How ?
Thanks.
|
|
|
|
|
|
I have a combo box on a form, KeyPreview is set to true, I use page up and
page down to perform certain tasks in the form, but when the combo box is
selected the keydown event on the form doesnt even fire when i press PageUp
or PageDown, does anybody know why?
|
|
|
|
|
Hello. A problem in the following:
1. In Visual C++ .NET 2003 we create the project: New Project, Visual C++ Projects, (.NET), Windows Forms Application (.NET). Appears Form1.
2. On Form1 we place the button, and in procedure for processing click on this button we write down a code:
Process::Start(S”wmplayer.exe”, S”D:\\My Sounds\\Sound 1.mp3”);
3. At start of the program, the player appears, however file does not sound (there is a message: the file is not found). Without use VC++ .NET, the player sounds this file normally. In VB .NET 2003 this code sounds a file also normally.
Conclusion. If in a name of a folder (where there is a sound file) or in a name of a sound file there is a blank, VC++ .NET can not find this file.
How through VC++ .NET to sound a file (.mp3), in which name there is a blank?
Beforehand many thanks for your answer. Best regards, Dr. V.A. Zharkov. Address: Orekhovy bulvar, 39-2, Moscow, 115573, Russia.
|
|
|
|
|
Hi all,
I'm new to Managed C++. I'd like to set unicode string for the form's title. I tried many ways, but they just didn't work. I even set the preprocessor _UNICODE, but I think it should be default.
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
this->Text = "中文hi"; // doesn't work, it'll show ??hi
this->Text = _T("中文hi"); // doesn't work, it'll show ??hi
}
Please help. Thanks.
|
|
|
|
|
You need to use the macro "S"
like S"something".
hope this helps.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thanks, Anthony. I tried, but doesn't work.
|
|
|
|
|
Have you tried using the L prefix.
L"awetawegwa"
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi,
How do I do to convert the managed type 'System::Data::String' to the unmanaged type 'PWSTR' ?
thanks.
|
|
|
|
|
Use CStringT in ATL like the way you use it in MFC.
#include <atlstr.h>
<br />
String *strTemp;<br />
CString strConverted = strTemp;
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
|
Hello,
Can you tell me How unmanaged DLL is used in managed applications?
One programmer from our company has left project halfway and I have been assigned to same project. Unfortunately no documentation is available. I do not have experience on VC++/Managed C++. So along with reading MSDN I am doing some reverse engineering.
I could figure out that person has created Managed class library which is refrenced in other projects. Only managed keyword is "__gc classname"
In managed c++ library header file of native dll is included and in source files section lib file for same dll is placed.
Managed library is calling API's from unmanaged library. Parameters for those APIs are of type int , char, array of characters, predefined structures containing memebers with data types int , char, array of characters, pointer to array of char.
Those structure members are initialized with required values before passing them as parameters to APIs of unmanaged dll. For that variable with same stucture types are defined as that mentioned in header file for native dll.
These structure variables are not declared as managed but those are inside managed class?
And it is working just fine.
So my first doubt is are those variables treated as managed variables or value types?
And __box / __nogc is also not used then I was wondering how it is working.
Can anyone explain me how it is working?
And also looking at header file I could not figure out what type of dll it is means created using c++ or c
The function definitions are like
------------------------------------------------------------------
#include <windows.h> // in the beginning of file
#if !defined( PREANSI )
extern "C" int __stdcall MyFunction(int k)
#else
int __stdcall MyFunction(int k)
#endif
-------------------------------------------------------------------
So my second doubt is , is dll created using c/ c++ and what is type of dll?
It is not exporting any types. Because help is given for building wrapper around COM Componenents or C++
I want to know these things so that I can do further implementation with understanding.
Please help me regarding this.
Regards
Shailaja
|
|
|
|
|
First, understand that there are two types of managed C++ DLLs (assemblies, actually, which contain 0-n modules, a manifest of modules, resources, bindings, and other assembly info, and resources): mixed-mode and pure IL.
Mixed mode: Various understood types (like int , for example) are translated by the compiler to managed types (like System.Int32 ) whenver possible. Other types and functions are compiled into native code (that is, unmanaged C++) and added to the module as native blocks that are unverifiable by the CLR. DLLs are linked to the assembly using the IL instruction .module extern DLL in many cases. There is much, much more than goes on than this, and you should check out MSDN about it. This is especially good for the first step in moving legacy applications or certain components to managed applications if you have good reasons to do so (i.e., if it isn't broke - don't fix it. The .NET Show on MSDN discussed this in the Sept. 2003 interview with members of our own CP web site).
Pure IL mode: Only managed constructs are used throughout the entire project. This compiles down to IL (specifically, MSIL) like most other languages would, such as C#, VB.NET, and J#.
If you don't see __gc throughout the code, it is most likely mixed mode. The compiler, if I remember correctly, figues this out automatically based on what it can do.
As far as the preproc definitions toward the end of your question, that merely tells the compiler to use C-style decorations (rather, the lack thereof) on the function and to call it using the __stdcall calling convention.
Basically, you'd do well to read the section on MSDN about managed extensions: http://msdn.microsoft.com/library/en-us/vcmex/html/vcconMCOverview.asp[^]
It has a lot of great material that goes in depth (and presents simple concepts) about the very basic things I've touched on here.
I hope this helps.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
I'm beginner and I have a little problem.
How can I change in managed C++ member variables of a class
in other classes?
More detailed:
I have a class A which is invoked in the main Windows init procedure.
This class A has some member variables (arrays).
Class B is invoked somewhere in my program.
I would like to change this member variables of Class A within an procedure
of Class B.
As far as I know, this is not possible, nor, you can use global variables in managed C++.
My idea is to use an interface between these classes somehow.
Well, I hope you understand my problem and can help me.
If not, I can explain it better or give you some code parts of my Program.
Thank you
|
|
|
|
|
Why not simply pass the instance of class A into class B when you instantiate it (not invoke). Pass it into the constructor or as a property - it all dependends on various factors. If class A is basically a dependency of class B to do anything useful, then A should probably be passed to B's constructor because B can't function without it. It all comes down to a good OO design - making sure that your objects have good relationships defined between them. There are many great articles here on CP about various OO design patterns.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi there.
I want to write a managed c++.net wrapper for the physics engine Tokamak. The problem is i had no experience in c++ except c#.
I want to write a wrapper for tokamak so that my c# samples can reference to that dll and implement together with Directx 9.
The problem is i don't know how to start?
Should i choose c++.net at the first place or i should go to unmanaged c++ to do all this.
Can you guys tell me what are the tutorials which i need to pick up along the way to achieve that?
I had the time and willing to learn. Just no idea how to start.
Thanks.
Regards,
Chua Wen Ching :p
|
|
|
|
|
|
Thanks for the link.
But i kind of dislikes the way how msdn arrange their articles.. Very confusing. I click the links here and there and until the end i learn nothing. Any better tutorials or URLs?
This topic is definitely hard to find in google.
Regards,
Chua Wen Ching :p
|
|
|
|
|
Hello.
How I can save a high color image (16 bit) as 256 color (with .BMP Format) or fewer color with Managed C++ .
Thank you.
|
|
|
|
|
Searching the .NET SDK documentation would quickly reveal the System.Drawing.Bitmap class. It contains everything you need, from reading in the existing image to saving it as a different format (the extension isn't the only thing that needs to change) and with a different palette.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hey all (I know this is one of Nish's strong points, so I'm looking at him),
I've got this app I'm working on that uses a tlbimp-generated interop library to the Adobe Forms API. Works great, except I've got this unavoidable loop that looks something like this (C# code):
(the '...'s mean "not important or not the slow-down")
<br />
for( ... ) {<br />
AdobeInterop.Field theField = ...;<br />
theField.Value = "some rather long string value";<br />
Marshal.ReleaseCOMObject( theField );<br />
}<br />
The source of my problem is the line where I'm setting the "Value" property of that Field object (it is defined as a BSTR* in the original typelibs). The performance is absolutely horrible!
Are there any other methods I can use to inject the string values into this field? I know one option would be to custom craft a MC++ wrapper for the original COM interfaces, but this is really my last option. Are there any underground tips or tricks that we can use to help the Marshalling process along?
Ah well...thanks to all in advance,
Jeremy Kimball
[EDIT]Crud, I just realized I posted this in the MC++ board...where would be the best place for this?[/EDIT]
|
|
|
|