microsoft.public.dotnet.languages.vc Archive - February 2003
Post a message to this list
Messages
Page: 1
System::String to CString (6 replies)
microsoft.public.dotnet.languages.vc
All, Can somebody show me a way to copy a CString into a System::String and visa versa? I need to go in both directions, there isn't any immediate conversion in either direction, and I'm thinking that the ATL macros are a bit of overkill. Any easy way to do this two way conversion? And on a related note, does anybody know which header file the ATL conversion macros are hiding in? As usual the docu...
C++ dll GetLastInputInfo (2 replies)
microsoft.public.dotnet.languages.vc
I'm having trouble with using the GetLastInputInfo() function. I would like to make a dll in C , then use the dll in managed C#. Here is the code for my dll: #define WIN32 WINNT 0x501 #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul reason for call, LPVOID lpReserved ) { return TRUE; } int stdcall getTickCount() { int timer GetTickCount(); return timer; } DWORD stdcall getIdleTi...
Byte buffer cast in Managed C++ (2 replies)
microsoft.public.dotnet.languages.vc
See code and questions below: 1/ Is there any better way to declare the method of ITF interface ? Can I simply remove the first parameter (size) ? 2/ How can I cast the C unsigned char buffer into a byte[] buffer for calling into the C# component interface Thanks in advance Gilles C unsigned char *pbuffer a byte buffer ; C# interface using a byte array public interface ITF { void Method(int size, ...
Service and Attributes (2 replies)
microsoft.public.dotnet.languages.vc
Anybody knows how to use the ServiceProcessDescriptionAttribute ? I read some lines from Jason Bock on it but I couldn't figure how to use it. The lines below don't make it. [ServiceProcessDescription("Description")] public class Service : System.ServiceProcess.ServiceBase { ... } Any clues ? Thanks in advance
BlockCopy from unmanaged to managed? (3 replies)
microsoft.public.dotnet.languages.vc
All, I'd like to block copy a large array of unsigned shorts from unmanaged C to managed C . To get the job done I coded a for loop: System::Object* MyClass::MakeManaged{int array size, unsigned short* ua) System::UInt16 ma[] new System::UInt16[array size]; for (System::Int32 i 0; i array size; i) { ma[i] ua[i]; } return ma; } Questions: 1) Is there a block copy that can go from unmanaged to manag...
gcroot questions (4 replies)
microsoft.public.dotnet.languages.vc
Questions about gcroot.h . 1) Doesn't the copy constructor leak GCHandles? Doesn't the old handle have to be GCHandle::Free'd? gcroot(const gcroot& r) { // don't copy a handle, copy what it points to (see above) handle GCHandle::op Explicit( GCHandle::Alloc( GCHandle::op Explicit(r. handle).Target ) ) #ifdef WIN32 .ToInt32() #elif defined( WIN64) .ToInt64() #else #error ERROR: either WIN64 or WIN3...
need help serializing to registry (4 replies)
microsoft.public.dotnet.languages.vc
I'm evaluating C version 7 and .NET, great ! but.... I'm trying to save some information in a "binary key" in the registry (currently my application position, but it is only a test ). I gave the errors generated, I wasted some hours trying to understand, may be some one can see the errors easily ? Regards, Jean Davy System::Void Form1::Form1 Closing( System::Object * sender, System::ComponentModel...
Help! How do I pass a char * to a functon that expects char __gc? (9 replies)
microsoft.public.dotnet.languages.vc
I have an unmanaged char * buffer that I want to pass to a .NET function that accepts a char gc[]. Could someone please tell me how to pass my pointer in so that it is accepted by the function? I would prefer to not have to allocate another gc[] array and copy the data buffer into it. Ken Varn Senior Software Engineer Diebold Inc. varnk@diebold.com
void func( double& modval ) causes 'unsafe' code generation? (3 replies)
microsoft.public.dotnet.languages.vc
I'm trying to make a function as written in the subject line. It doesn't work. It works fine for value classes, but not for the primitive types such as double, bool, etc. This is what ILDASM gives me for that function: func(float64* modopt([Microsoft.VisualC]Microsoft.VisualC.IsCXXReferenceModifier) v) cil managed And this is what ILDASM gives me for a similar function that modifies a value class:...
How to make a method on a managed C++ class visible to COM (3 replies)
microsoft.public.dotnet.languages.vc
I thought I was going to get through this easy, but I'm having problems. I have a managed C assembly, where I've defined a public gc class that I want to be available as a com object to VBA clients. I added a [Guid(" insert uuid here ")] attribute to the public gc class, and used regasm to register the com types from the assembly into the registry. At that point I can see the class as a com type i...
Presenting a managed collection to an unmanaged method. (4 replies)
microsoft.public.dotnet.languages.vc
I have a couple of classes, a Profile, and a TwoDPoint. public class Profile : CollectionBase { // Some code to strongly type the collection to work with TwoDPoints } [StructLayout( LayoutKind Explicit )] public class TwoDPoint { [FieldOffset( 0 )] public double X 0.0; [FieldOffset( 8 )] public double Y 0.0; } What I need to be able to do, is pass a profile object into an unmanaged method that is ...
Need help with syntax to resolve compiler error. (6 replies)
microsoft.public.dotnet.languages.vc
I am trying to get the following GDI managed code to work, but I keep getting a compiler error. Can someone please help? I know that this can be done in standard GDI , but I need it to work using the .NET GDI namespace. { // This line produces Compiler error C2691: 'unsigned char gc[]' : invalid type for gc array element ImageCodecInfo ImageCodecs gc[] ImageCodecInfo::GetImageEncoders(); } I have ...
Managed Object Scoping in DLL (7 replies)
microsoft.public.dotnet.languages.vc
Below is some code that doesn't compile due to C3145. How can I create a managed object with global scope in a C dll with /clr ? Any hints or tricks ? #include "stdafx.h" #using mscorlib.dll using namespace System; using namespace System::Diagnostics; //////////////////////////////////////////////////////////////////////////// // // DllMain BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul reason fo...
Runtime load/unload of assembly (7 replies)
microsoft.public.dotnet.languages.vc
Hi all, We are trying to figure out a way to dynamically load/unload a .NET assembly at runtime. For instance, we have a dll that we want to be able to "refresh" (changes have been made to its code), but without stopping and restarting (or worse, recompiling) the client app. So, I assume #using "libname.dll" is bad :) What's the recommended way to do this? We're all a bit new with managed code her...
Ad
Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification