microsoft.public.dotnet.languages.vc Archive - July 2003
Post a message to this list
Messages
Page: 12
INTERNAL COMPILER ERROR (VS.NET 2002) (2 replies)
microsoft.public.dotnet.languages.vc
Install.cpp Install.cpp(20) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2844) Please choose the Technical Support command on the Visual C Help menu, or open the Technical Support help file for more information compliling this (I'm not sure if this code is the problem...): #pragma warning (disable: 4615) //unknown user warning type #include "install.h" #define SubKe...
65536 limit in ADO.NET SP argument ? (2 replies)
microsoft.public.dotnet.languages.vc
I used MC and trying to pass an argument to a SP of type "image" in MSSQL. It works fine until I reach 65535. Is there some kind of limit I'm running up against? Also this seems to work using VB.NET. The following exception is thrown: "System.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded. at System.Data.SqlClient.SqlCommand.Ex...
random_shuffle (second version) (2 replies)
microsoft.public.dotnet.languages.vc
Hi: In the Standard C Library Reference that comes with VS.NET 2002, they show a second template: template class RandomAccessIterator, class RandomNumberGenerator void random shuffle( RandomAccessIterator First, RandomAccessIterator Last, RandomNumberGenerator& Rand ); Yet in the example they give, they don't implement the second version nor do they use the Iter2 that they define. Q. How do you us...
Serializing an object that contains a pointer to an unmanaged object (4 replies)
microsoft.public.dotnet.languages.vc
Is it possible to serialize a managed object that contains a pointer to an unmanaged object? Thanks, Tim Rogers
C++ Inherited Exception Handling (3 replies)
microsoft.public.dotnet.languages.vc
Hi, I've hit an interesting problem with MSVC .NET's C compiler. I'm trying to handle an exception implicity using inheritance. So say there's a class A, and another class B which inherits from A. If you throw a B, you'd expect to be able to catch an A, right? Well give this a go: star of code snippet #include windows.h class A { public: virtual char* m() { return "This object is an A"; } }; class...
Serialization Custom Class (4 replies)
microsoft.public.dotnet.languages.vc
I'have a WebMethod that return an ArrayList of pointers to this class: [Serializable] public gc class MyClass { public: char S; int C; MyClass(); MyClass ( char S, int C ); }; When I execute the WebMethod I've this exception: System.InvalidOperationException: There was an error generating the XML document. System.InvalidOperationException: The type MyClass was not expected. Use the XmlInclude or S...
Does managed new operator throw exception? (6 replies)
microsoft.public.dotnet.languages.vc
If new (allocating from managed heap) fails (e.g. out of memory) will it throw an exception or will it return null? Thanks, Tim Rogers
GetMenuItemInfo not working under WinNT 4 (4 replies)
microsoft.public.dotnet.languages.vc
Using VC .NET, I've developed an application that dynamically changes the menu's. It run's fine on XP, 2000 and Win98. But when I try to run it on NT 4 with SP6, GetMenuItemInfo fails. To test it, I had VS .NET create a Windows application with the wizard. The only changes I made to this generated program were: 1. to add a global variable m hWnd to save the HWND from CreateWindow, 2. added include...
Dispose or Not Dispose, That is the question ... (7 replies)
microsoft.public.dotnet.languages.vc
I have a question about garbage collection, finalizing, and disposing. I suspect that anytime an object has a dispose method, we should call it before setting the reference to Nothing, but I am not positive. Can someone help me with that? For example, the Microsoft.Data.ODBC.OdbcConnection object has a dispose method (for those that don't have this object, it is a separate, free download from micr...
Register dll fails when tlb file not generated. (4 replies)
microsoft.public.dotnet.languages.vc
Hi, I have a 32bit ATL COM dll which is generated without the tlb(/notlb option set in midl). When i register the dll i get following error : 0x80029C4AL Winerror.h says // // MessageId: TYPE E CANTLOADLIBRARY // // MessageText: // // Error loading type library/DLL. // #define TYPE E CANTLOADLIBRARY HRESULT TYPEDEF (0x80029C4AL) But if i generate the same dll with tlb my application works fine. Th...
Marshaling of structs. (6 replies)
microsoft.public.dotnet.languages.vc
First point, just to clear up is the System.Double type blittable or non blittable? I've seen articles claiming both. Now, lets say I have a struct coded in C#: // C# struct public struct PairD { public double First; public double Second; } I also have a highly complex numerical algorithm and data structure written in native C that must be shared with legacy native C applications ( we don't want n...
Raise event from library worker thread. (2 replies)
microsoft.public.dotnet.languages.vc
Hi! I am writing a library in managed C for the .NET framework. I have problems fireing events from a worker thread. The managed event must be raised from the main thread, but I cannot find any way to pass control from the worker thread to the main thread. In the COM programming model the problem was solved by creating an invisible window which the worker thread passed win32 messages to. With what...
hiding unmanaged types in metadata (2 replies)
microsoft.public.dotnet.languages.vc
hello all i have a specific question according hiding unmanaged (native) types in metadata for assemblies generated by c with managed extensions. i understand what these types are nedeed in metadata for runtime but why to do it public? is code will run correctly if i make these types private for assembly? there is no way to do so from IDE or by some compiler option but i can edit assembly file dir...
Are Data Elements in GC Arrays automatically initialized to 0s? (2 replies)
microsoft.public.dotnet.languages.vc
Here's my code: // Allocate an array and clear the data in it. m Array new int gc[ MAX NUMBER ]; try cast IList * ( m Array ) Clear(); Not only do I find the need to cast to an IList in order to call Clear particularly annoying, but I don't want to waste the time clearing the array data if its already cleared to begin with? I believe that in C# they are, correct? So it seems reasonable to think th...
How to implement the callback? (3 replies)
microsoft.public.dotnet.languages.vc
Hi All, I am trying to write an interface for the existing C library using C managed extesions, so that I can make use of the C library in C#. The problem I am facing is with some callback functions in C library. Can anyone help me out in how to implement the callback so that the C library method can call the method in the C#. Thanks A Lot....... Phanendra
Read Only ? (4 replies)
microsoft.public.dotnet.languages.vc
I'm using VS.NET (2002) and I want to program a button to change some object (label, txtBox...) font size. When I try to do that I get the error that the property Font.Size is read only. How can I avoid this ???
I need help, please (4 replies)
microsoft.public.dotnet.languages.vc
Hi, I'm using a List Control (report view) in a dialog. This list displays 4 text items, each consisting of 3 columns. Let's consider the following example: Title of column1 Title c2 Title c3 Title c4 Item1 info12 info13 info14 Item2 info22 info23 info24 Item3 info32 info33 info34 Item4 info42 info43 info44 I want to change the text color of an item if a cetain condition is true. In the example ab...
specifying __gc or not? (2 replies)
microsoft.public.dotnet.languages.vc
Is there a difference between the following cases? using namespace System::Drawing; Pen gc *pen new Pen(Color::Black); //******************************* using namespace System::Drawing; Pen *pen new Pen(Color::Black);
rand() (3 replies)
microsoft.public.dotnet.languages.vc
Hi, With VS .NET 2003 the rand() function sometimes returns a number equal to RAND MAX. The docs say: The rand function returns a pseudorandom integer in the range 0 to RAND MAX. Does this mean that 0 & RAND MAX are included in the range? I am asking because I was using code from a book, which was developed on Linux. The program occasionally dies, because the random number is used in calculating a...
circular includes (8 replies)
microsoft.public.dotnet.languages.vc
I'm writing my first windows forms application with VC2003, but I've run into a problem which I think should work. I have a mainform defined in mainform.h and a toolform in toolform.h. The mainform has a toolform member and therefore it needs to include toolform.h. But when I want to create the toolform I want to pass the MainForm as a paremeter, so the toolform can call some mainform functions. S...
How do I copy a BSTR to an IStream (5 replies)
microsoft.public.dotnet.languages.vc
Could anyone please tell me what is wrong with the code below: STDMETHODIMP CSimpleObj::WriteUnmanagedData(BSTR pString, IStream** ppData) { HRESULT hr; hr CreateStreamOnHGlobal(0, TRUE, ppData); if (FAILED(hr)) return hr; ULONG lBytesWritten; hr (*ppData) Write(pString, SysStringLen(pString), &lBytesWritten); //hr (*ppData) Write("This is unmanaged data.", 24, &lBytesWritten); if (FAILED(hr)) ret...
CAccessToken - LogonUser method (2 replies)
microsoft.public.dotnet.languages.vc
Greeting all, I'm a VC 7 beginner. I'm trying to build a windows service, which whenever it starts, it would load a user profile up. I'm using CAccessToken class from ATL. Please take a look at the code I have below. The LogonUser method always return False. Please give me some advices on how to use this class some sample codes would be great. I really appreciate all the helps. Regards, CAccessTok...
Help! Debugger reporting System.IO.FIleLoadException. (4 replies)
microsoft.public.dotnet.languages.vc
I am trying to remote debug a C# application but the debugger is reporting the following exception: An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module. Additional information: Unverifiable assembly 'FrameGrabber' failed policy check. The FrameGrabber assembly is a C managed DLL. I cannot get a stack trace on the exception in the debugger. I have seen this occur...
Convert Interface definition to VB.NET (9 replies)
microsoft.public.dotnet.languages.vc
Can anyone convert the following C interface definition to VB.NET? I have had a go, but I cannot make the Load function work and the IsDirty function gives an error (Object not set to an instance). MIDL INTERFACE("7FD52380 4E07 101B AE2D 08002B2EC713") IPersistStreamInit : public IPersist { public: virtual HRESULT STDMETHODCALLTYPE IsDirty( void) 0; virtual HRESULT STDMETHODCALLTYPE Load(/* [in] *...
Reference to a managed class in an unmanaged one is ok? (6 replies)
microsoft.public.dotnet.languages.vc
Hi everybody, I wonder if that is intentional or a bug in the 7.0 compiler (I don't know what happens in 2003): gc class M {}; class U { M* m; public: U(): m(new M) {} }; causes compiler error but gc class M {}; class U { M& m; public: U(): m(*new M) {} }; doesn't. BTW what was the reason to forbid using pointers to managed classes in unmanaged ones? thanks, v
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