Archived Months
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008
May 2008
June 2008
all groups > dotnet interop > march 2007

Filter by week: 1 2 3 4 5

Sending chars between VB6 and C#.NET
Posted by Miro at 3/31/2007 12:06:02 AM
Hello! I'm using windows messages and the LParam parameter to send chars as ASCII numbers from VB6 to C#. How can I retrieve the right int value from the IntPtr in .NET? My code: protected override void WndProc(ref Message m) { if (m.Msg == VB6_TO_CSHARP_MessageId.ToInt32()) { ...more >>


P/invoke an array of structs with embedded char* buffers
Posted by Lionel at 3/30/2007 9:32:49 AM
Hi, I've tried several approaches for a few days now & feel its time to ask the gurus. I am making a call to a C++ dll from C# via p/invoke, the api expects an array of structs with pre-allocated buffers. The api populates the buffers with raw byte data from a device. The C++ struct defi...more >>

c# class registered as com class, default register value
Posted by Markus at 3/30/2007 7:04:09 AM
When you register a c# class as COM object with the Attribute ComVisible(true), Visual Studio, or in our case the installer program handles all the registry entries. One entry made be the installer is the default value underneath the Class GUID. Like "HKEY_CLASSES_ROOT\CLSID\{GUID of the cl...more >>

Attempted to write protected memory error when doing Excel automation
Posted by robin at 3/29/2007 8:11:13 PM
Hello Guys, It's very strange to have such problem when i want to write an excel using C#. The program is developed in XP sp2 (english), .NET framework 2.0, Office 2003(english). It just works fine. But when i put it to XP sp2 (traditional chinese), Office 2003 (traditional chinese). N...more >>

How would you marshal this?
Posted by Christoffer at 3/29/2007 3:35:52 PM
I'm trying to marshal these structs but I keep getting an access violation... typedef struct { BYTE Line; BYTE Pr; char * Name; tEXTERNAL_NUMERIC Quantity; char Vat; tEXTERNAL_NUMERIC Price; tEXTERNAL_NUMERIC Gross; tEXTERNAL_NUMERIC Discount; } ...more >>

Word Interop and Server 2003
Posted by TJHerman at 3/29/2007 2:32:03 PM
I have a problem in deploying an ASP.NET web project with Microsoft.Interop.Word on a server with Windows Server 2003. From the developing PC, my program opens a Word template, replaces bookmarks with some text from the web page and then saves and closes the file. As many others say, it wor...more >>

C# to C++ Dll with a pointer to string.
Posted by asnowfall NO[at]SPAM gmail.com at 3/28/2007 2:16:27 PM
I have a C++ DLL that accepts BSTR* and changes its value before returning. I am calling this API from C#. I get changed value in Object[] but not in actual variable. Please see my code snippet to understand. C++ DLL API:- void Fun(BSTR* data) ; C# wrapper:- [DllImport("Test.dll", EntryPo...more >>

Help with calling C# assembly from an unmanaged C++/MFC application
Posted by SJ at 3/26/2007 10:14:24 PM
Hi I have some existing unmanaged MFC/C++ application in VS2005 and VS2003. I need to modify these apps to call methods already implemented in an existing C# class library/assembly (retrofit some new functionality) and redeploy the application. From doing some reading on this I believe...more >>



Buffer Overrun when .net event fires to a c++ app
Posted by Chris Priest at 3/26/2007 12:00:00 AM
Hi, We are trying to implement COM inside our .NET c# application, that needs to be called from a C++ app. While we can get the properties and methods to work just fine, the C++ client has an issue with the events. The C++ client can see and register interest in the c# event just fine, ...more >>

DSO Framer event not firing: axFramerControl1_PreviewKeyDown
Posted by Brian at 3/25/2007 7:56:09 AM
Hi! We are using DSOFramer to host MS Word within our WinForm-based smart client app. Anywhere in our app, pressing F1 raises our context-sensitive help dialog. When our users are inside MS Word within our app and press F1, we bring up a Help dialog that explains what they should be typi...more >>

Problem with using created COM object with C#.NET 2005 under Excel2003 (Framework 2.0)
Posted by =?ISO-8859-2?B?UmFmYbMgR2llemdhs2E=?= at 3/23/2007 4:42:42 PM
This is part of my assembly: [assembly: ComVisible(true)] [assembly: ClassInterfaceAttribute(ClassInterfaceType.None)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("cd099def-f9fb-407f-b793-9db68f6b8a0b")] This is my code: u...more >>

How to marshal a variable length array in a callback function from unmanaged to managed code?
Posted by gernot at 3/23/2007 4:24:25 PM
Hi, I want to marshal the following C++ struct to a managed callback function: struct CALLBACK_DATA { LPBYTE pArray; // byte array UINT uArrayLen; // byte count }; The C++ function expects the following callback type: typedef BOOL (CALLBACK *CALLBACK_FUNC)(...more >>

Marshal.GetTypedObjectForIUnknown and reference counts
Posted by Steve at 3/23/2007 12:30:00 PM
Hello, Say I have an interface from IUnknown::QueryInterface that I want available in my .Net program. When QueryInterface returns, I am responsible for Release()ing it, but depending on whether GetTypedObjcetForIUnknown has already wrapped that object, it may or may not increase the refe...more >>

nothing published to COM after tlbexp
Posted by ptheate NO[at]SPAM gmail.com at 3/23/2007 9:08:13 AM
Hi, I try to create a COM Dll in C# 2005 Express that implement a COM interface (Wealth-Lab real time data adapter API). I succeeded in creating a dll for the Wealth-Lab COM interface to implement. Though, after tlbexp is run with following code, nothing is published in the tlb file (see it'...more >>

Can an RCW be shared in same directory by two .Net apps?
Posted by bobahop NO[at]SPAM gmail.com at 3/23/2007 5:51:32 AM
I have two small apps which are deployed to the same directory. They each reference IWshRunttimeLibrary (Windows Script Host Object Model.) The problem is that the Interop.IWshRuntimeLibrary.dll generated by one project errors when used by the compiled assembly from the other project. I compile ...more >>

Problem with deployment of C# COM Interop dll
Posted by DirkG at 3/23/2007 3:03:03 AM
I have a library written in C# that raises events that are consumed by a VB6 client. The library is registered on my development machine using the /tlb option on regasm.exe to allow me to create a reference in VB6, and the events raised are picked up by VB6. I've discovered through a long,...more >>

COM / CLR timeout error when debugging a project that hosts a WebBrowser
Posted by Jon Davis at 3/22/2007 5:30:58 PM
"The CLR has been unable to transition from COM context 0x1b78c0 to = COM context 0x1b7a30 for 60 seconds. The thread that owns the = destination context/apartment is most likely either doing a non pumping = wait or processing a very long running operation without pumping Windows = messages. T...more >>

AzMan PIA for .Net 2.0
Posted by Phil Sharp at 3/22/2007 8:36:38 AM
Hi I want to call Authorization Manager (AzMan) in my .Net 2.0 application. The PIA that is available in the Windows 2000 Authorization Manager Runtime is a .Net 1.0 assembly. Is there a new PIA for .Net 2.0? If not should I use the .Net 1.0 PIA or should I create my own interop assemb...more >>

Referencing COM DLL's from VS 2003 & 2005
Posted by Monty at 3/22/2007 12:00:00 AM
I have a legacy COM application that has PIA's for it's DLL's that are registered in the GAC. In VS 2003, I would add a reference to my project by browsing to the DLL file in the install directory of my legacy app, and it would automatically refer to the version in the GAC (this is good). In 2...more >>

HELP! C# calling C++ dll calling back to C# with struct data
Posted by Joel at 3/20/2007 12:01:22 PM
Hello. I am writing a C# application to generate a PowerBuilder PBL library. This is done by making calls to "ORCA", a vendor-provided pborc100.dll (which was written in C or C++.) I have successfully called pborc100 to open and close a session, and create an empty library. Now I want to...more >>

struct alignment problems in native/managed interop code
Posted by brad at 3/19/2007 11:45:31 AM
This problem has been baffling me for a few days now, and I really need to get some help. I've used tlbimp to create a interop dll for a COM component. the assembly which is output by tlbimp includes some struct definitions. My problem is that the native code and managed code don't agree on t...more >>

CreateInstance() on .Net assembly fails on Vista.
Posted by Magnus at 3/19/2007 9:46:34 AM
I have a .net assembly that is COM visible which works fine to call CreateInstance() on in XP. In Vista however CreateInstance() fails with class not registered for some reason. I register it with RegAsm /codebase and if i look in the registry it is there. Still CreateInstance() fails and i ha...more >>

Getting events from an ActiveX control in a C# winform..
Posted by Jessica at 3/18/2007 9:42:00 PM
Hi All, I am having trouble getting events from an ActiveX control in my C# winform. The activeX control is just a sample one developed by myself, and it fires two stock events:- KeyPress and Double click. I did not do anything with the IConnectionPoint interface or whatecer as I cou...more >>

How to include header file used by DLL
Posted by Dv at 3/16/2007 7:09:49 AM
I have a API lib (written in C/C++) that can be used by C/C++ project. Now, I'm adding support to C# project. I changed the Lib to DLL. This is easy. However, I have no idea how to deal with the structures and constants that used to be defined in the header file of the lib. Where should I d...more >>

Debug VB6 exe and VB Net 2005 DLL
Posted by hoffes at 3/16/2007 5:47:39 AM
We have a large vb6 project and it is impossible to move it to vbnet2005 with our man power. But we thought, that new things should be developed in vbnet. To debug everything i can start the vb6 ide and debug the hole code there. but i have found no possibility to debug the calls to the vbnet d...more >>

InterOp wrapper names for .ocx files
Posted by Steve G at 3/14/2007 10:17:00 AM
I'm trying to generate Windows 2005 controls from VB6 controls using AXImp.exe. I can generate the two files but only control one of the names. I need to generate the files with a strong key so cant use the auto generated files. How can I generate the 2 files required that match the names that...more >>

EntryPointNotFoundException
Posted by Tkachenko Aleksey at 3/14/2007 12:00:00 AM
Hi All, I am using the unmanaged C++ dll from C# by the DllImport. There are two functions with similar names and parameters which differ by case only, for example testit and TestIt, they have different entry addresses. I am trying to use testit from background thread and then from main thre...more >>

Exposing "Count" in a custom class
Posted by Dave Young at 3/9/2007 1:32:23 PM
C#, VS2003, 1.1 Framework I have a custom class implementation thats based on System.Collections.CollectionBase. I've implemented the Add, Remove, Contains, CopyTo etc... all the normal stuff. This also has to be registered for COM Interop so classic ASP pages can access it's properties...more >>

Call C/C++ library DLL from C# with CALLBACK and messages
Posted by judy at 3/9/2007 6:41:21 AM
Hi, I have an old C++ GUI Application CPPAPP.exe that calls a C DLL library RULE.DLL through a C++ class wrapper LoadRule.CPP. Now I need to call the C DLL RULE.DLL from C# GUI application CSAPP.exe. I need help to convert LoadRule.CPP to a C++ BridgeDLL or a C# wrapper class so that I can ...more >>

How to capture VB.NET Event From VB6????
Posted by Vanessa at 3/9/2007 12:00:00 AM
I have a class library developed in VB.NET. Inside there is a form with a button1. I add this class library to a VB6 Project. I do a Dim a as new classlibrary.form1 SetParent a.GetHwnd, Me.hWnd a.show But now I have a question, if the user click on the Button1 in the ClassLibrary, I...more >>

Excel Chart black and white (Clipboard Copy)
Posted by Jörgen Ahrens at 3/8/2007 12:00:00 AM
Hi all We are creating a chart in an excel app that we then copy to clipboard using CopyPicture(Screen, xlBitmap, Screen) (interop). Everything works fine when we set the excelApp.Visible = true; The chart is created and copied into the clipboard. When we get it from the clipboard its color...more >>

Variant array of Structs by Ref
Posted by sbparsons at 3/7/2007 1:57:07 AM
I'm using interop between .Net and C++ (COM) and am attempting to retrieve an array of structs from the COM server. I realise that having VT_RECORD type data in variants is not supported. Is the only way to accessing these types of returns via custom marshalling? A book that I am reading (pr...more >>

Using GetOutlineTextMetrics GDI API from C#
Posted by Kristofor at 3/6/2007 1:29:25 PM
Hi, I am working on a project that includes creating a PDF file by hand using a predefined font. The PDF reference requires certain font metrics be included. Using the FontFamily class, I have access to a few, but the majority of them aren't available. Therefore I'm attempting to use PIn...more >>

Native DLL and callback in C++
Posted by Erik_Wikstr=F6m at 3/6/2007 7:40:04 AM
I'm trying to figure out how some stuff can be done when calling functions in a native DLL from managed C++ and the called functions have callbacks. What I want is to be able to use an opaque type as a handle for the user of the DLL, in this case it's called Test and the user can create/delete i...more >>

Help me - ATL dll in vb.net
Posted by Nicol at 3/6/2007 7:01:35 AM
Hi, I created ATL dll in vc++. One of the function has datatype as WCHAR*. I am rferring this dll in .net, .net automatically converts this to interop dll and the signature for the method WCHAR* is changed to ushort. I actually have a string in WCHAR* variable. since it is ushort in .net ...more >>

Creating Journal Record Hook gives error 1400 (Invalid Window Hand
Posted by mihi at 3/3/2007 5:37:00 AM
I am trying to create a journal record hook in C#. According to http://www.codeproject.com/tools/winmacro.asp I do not need a DLL for it. Creating a Journal Playback hook works (although I don't have anything to play back yet), and creating the Local Message Hook for getting the WM_CANCELJOUR...more >>

Equivalent of void*
Posted by Bumbala at 3/2/2007 7:42:06 AM
Hello, What is the equivalent of "void*" in managed C++ ? Thanks. ...more >>

P/Invoke OutOfMemoryException in .NET Compact Framework 2.0
Posted by Pedro Mota at 3/1/2007 9:35:22 AM
Hello, I'm getting an OutOfMemoryException when calling a native method. The same program and library are working on the big .NET Framework 2.0 but not on the Windows CE 4.2 that I have. The exception is thrown at the level of P/Invoke because it's when I call the function in managed code...more >>

GetWindowTextLength hangs in .NET
Posted by ME at 3/1/2007 9:11:17 AM
I have a application that reads another application's text box. I use GetWindowText and GetWindowTextLength to read the text into my C# application. From time to time the call to GetWindowTextLength 'stalls' and never returns. It is not that it does not return a value, but rather the call...more >>

Marshalling CComBstr to System.String
Posted by akumaramar NO[at]SPAM gmail.com at 3/1/2007 5:32:25 AM
Hi, I have below declaration in C# void UpdateSpousePayrollDetails([MarshalAs(UnmanagedType.IUnknown)]Object termlf, [MarshalAs(UnmanagedType.IUnknown)]Object dpyCdh, [MarshalAs(UnmanagedType.BStr)]String SD04); and want to call this function from C++. The code to call this function is ...more >>

Marshalling complex types between a .NET CCW and VBScript
Posted by GregB at 3/1/2007 3:44:14 AM
We want to determine whether it's possible to develop a .NET COM- callable wrapper (CCW) which exposes complex types that are accessible to a VBScript client. We have found that VBS has no problem accessing 'simple' types like integer, String, Boolean. On the other hand, we are seeking advice ...more >>


DevelopmentNow Blog