When managing our .NET projects with Visual SourceSafe, we encounter this problem: DeveloperA works on a .NET project. This project has a reference to a COM object. DeveloperA checks in his files into SourceSafe. Next day, DeveloperB works on the same .NET project. Although he has the same COM oject installed on his computer, the reference is invalid (indicated by a yellow triangle with an exception mark inside). DeveloperB has to delete the reference, and set a new reference to the same COM object. Is there any way to avoid this deleting and re-creating of references?
Andy Wieberneit
Posts
-
SourceSafe and References to COM Objects -
DLL integrationregsvr32.exe is a utility used to register COM objects on your computer. A COM object lives in a DLL that exports a couple of pre-defined functions, such as DllRegisterServer. If you want to install a COM (or ActiveX, which is the same) DLL on your computer, you may use regsvr32.exe to do that. If you have a simple DLL, however, which does not contain any COM objects, you do not need to run regsvr32.exe; in such a case, you can simply call the functions exported from that DLL, maybe by using the DllImport attribute (if you want to do it with C# or VB.NET).
-
Accessing C++ classes from within C# .NETIf you want to use C++ classes that are exported from a DLL, you should write a simple wrapper class library in Managed C++. You can then use that wrapper class library from your other .NET projects. For more details and a simple sample project, look at: http://www.codeguru.com/Cpp/Cpp/cpp\_managed/interop/article.php/c6867/
-
datatype check- Read one line - Parse that line for '#' - Split the line into its substrings - Analyze any substring, using String.IndexOfAny( "ABCDEFG..." ) - If index found, it is a string; else, it is an integer
-
do get_ and set_ have to be used in conjunction?The reason for this error is that your private member variable (dataSectionPtr) has the same name as your property. That's because from your get_ method, the compiler will generate a property dataSectionPtr. Just rename your private member variable, and your code will compile.
-
SerialCommLook for the article: "Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications" in the MSDN.
-
Circular dependency solution?Why not have the plugin simply implement a delegate/event? The main application would add a handler for that event. Each time the event is caught, the main app could make a call into the plugin. Hence the plugin would initiate a call from the main app.
-
Is this a pointer operation ?If your C++ code is managed C++: yes, in fact it is. If your C++ code is unmanaged C++: no, it's not the same. Pointers in managed C++ are managed by the garbage collector, as are the reference types in C#. Hence you don't have to (and you will not be able to)delete them manually. Pointers in unmanaged C++, however, are completely at your mercy, so you have to take care of them via the delete operator.
-
Returning array referencesIf you want to have an array of integers in a managed class, you would normally do something like this:
__gc class MyClass
{
private:
int myArray[];
public:
int* getArray()
{
return myArray;
}
};You don't need to specify everything as __gc. If your class is already managed, its members are managed automatically.
-
unmanaged class declaring managed member function as friendI don't think you really need that friend directive. Most probably, you could simply make your classes public and avoid inline methods. It seems that you want to call a managed method from an unmanaged class. However, this can't be done by a direct call, because managed objects are subject to garbage collection. To get a safe entry point into the managed heap, you have to use a GCHandle, which in turn is wrapped by the gcroot template. Try this:
#include <vcclr.h>
class ManagedClass;
class UnmanagedClass
{
public:
UnmanagedClass( ManagedClass* p );
private:
gcroot< ManagedClass* > m_pManaged;
}You can then make your calls into the managed class with the m_pManaged pointer. There might be another problem: Since you have both managed and unmanaged code in one project, this project needs to be linked in mixed mode. This is because for the unmanaged code, you need the C runtime, which requires an entry point as well as statics. For an instruction of how to convert your project to mixed mode, see the article: "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the MSDN.
-
how to use the dll developed in VC6Seems that your dll is delivering strings. If you want to get a string from a dll, you should use a string builder. Try something like this: StringBuilder sb = new StringBuilder( 256 ); [DllImport( "myDll.dll" )] public static extern void GetString( StringBuilder sb ); void myFunc() { GetString( sb ); Debug.WriteLine( "String = " + sb.ToString() ); }