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


all groups > dotnet interop > august 2006

Filter by week: 1 2 3 4 5

COM & static member function
Posted by gk at 8/31/2006 11:17:09 PM
Hi, in a .NET class I wish to use from a COM client, I have a static member function "LoadFromFile" that returns an instance of that class: class Myclass : MyclassCOMinterface { static Myclass LoadFromFile(string file) {...} } since static members are not visible by COM, how can I e...more >>

C# Class using VB6 Interface incorrectly identifies parameter
Posted by Mike Sharpe at 8/31/2006 11:20:02 AM
Here's the breakdown: 1. My class is written in C# 2. It inherits an interface called AlfaBVIO._BVInput which looks like this via the Interop metadata: [Guid("B2332A7B-42C5-4828-8B2B-9D2BE8EFA3DD")] [TypeLibType(4304)] public interface _BVInput { [DispId(161080...more >>

excel NumberFormat AND localization
Posted by swayze at 8/31/2006 6:10:56 AM
Hi All, I wrote an app (c# 1.1 framework) that formats excel files generated from html. I am using numberFormat ("#,##0.00") on certain columns that display pricing. i am in Turkey but, I use XP pro with regional settings set to Canada. The computers that display these worksheets have local...more >>

Non deterministic bahaviour using PInvoke
Posted by Chucker at 8/31/2006 5:42:02 AM
Dear Community, I have a very strange error that started to occur two weeks ago. When I run an Application that worked without problems for nearly half a year now, there suddenly is one function which I am calling via PInvoke that sometimes fails. If this happens, I find one of the followi...more >>

How to effectively transfer a Structure or a collection of Structure to managed code?
Posted by dotNeter at 8/31/2006 5:32:48 AM
I mean, the only method, I wanna use to P/Invoke into unmanaged code and retrieve a pointer which point to a block of memory, is formed as below, [DllImport("stuffs.dll"), CharSet = CharSet.Ansi)]] static extern IntPtr GetData(); The returned value is just a pointer. The content of the memo...more >>

callback from C++ dll to C# function using delegate
Posted by CosminB [IXIA] at 8/31/2006 1:33:45 AM
I've posted this to MSDN forums also, but maybe I can get feedback from here too. Here it goes: --- Hi all, I've researched this matter for a couple of days now. I've seen samples of code, got them to work on small scale samples. The problem is that the final application is *critical* to our...more >>

IsWindowVisible always returns false when passed a Screensaver's preview hWnd, Why?
Posted by ThunderMusic at 8/30/2006 11:49:42 AM
Hi, I'm doing a screen saver. When it comes to display a preview, Windows sends a /p argument followed by a space and a hWnd... When I send this hWnd to IsWindowVisible((IntPtr)hWnd); I always receive false... my definition for IsWindowVisible is like this : [DllImport("user32.dll")] st...more >>

Mind Boggling Behavior
Posted by Shea at 8/30/2006 8:49:22 AM
[STAThread] static void Main() { ApartmentState x = Thread.CurrentThread.GetApartmentState(); MessageBox.Show(x.ToString()); // etc. } Brings up a most annoying dialog box with my current three least favorite letters in ...more >>



Struct vs. Class Performance
Posted by MLM450 NO[at]SPAM hotmail.com at 8/29/2006 11:09:54 AM
When passing data to an unmanaged DLL, is there much of a performance difference between passing a structure versus an object that is marshalled as a structure? Is there another option I have not thought of? Below is an example... Thanks! // Structure option internal struct MY_RECT { ...more >>

Will SysAllocString allocation be GC'ed
Posted by Peggy at 8/29/2006 2:10:15 AM
Hi I have an unmanaged dll which returns a BSTR* allocated using a SysAllocString on the unmanaged code. Now when this BSTR is returned to the Managed world, will the memory allocated to the BSTR be freed by GC or do I need to take care of clearing off the Allocated memory? Regards Pawa...more >>

Array Marshalling different between VB6 & Script to an interop C#
Posted by KirkViehland at 8/28/2006 10:36:01 PM
I have a very simple C# library that demonstrates a problem that I am trying to figure out right now. I could post a full example, if this forum allowed posting attachments. Anyway, like I said, I have a very simple C# class... namespace ScriptMarshalTester { using System; usin...more >>

How to access C# indexer in Jscript?????
Posted by sunilce10 NO[at]SPAM gmail.com at 8/25/2006 12:29:57 AM
Hi, I have one Pages collection class, in which i have defined inexer. My collection class is COM enabled, and i am using its object in my scripting engine. Now, when i using Jscript in my scripting engine, i think the C# objects indexer is not supported in JScript. I can't make access...more >>

regasm and tlbexp error in 2.0 runtime
Posted by eppyjerk at 8/24/2006 12:48:15 PM
I am having an issue creating a type library for one of my assemblies. I recompiled a 1.1 assembly into the 2.0 framework and now when I run regasm, the types do not get exported properly. The 1.1 regasm tool properly exports the 1.1 assembly, but the 2.0 regasm tool errors on both the 1.1 asse...more >>

VB2005 Referance Problem
Posted by Steve954 at 8/24/2006 12:46:02 PM
The project I am developing uses a third party COM component which references both the Microsoft ActiveX Data Objects 2.7 Library and the Visual Basic for Applications COM objects. When I add the third party component to my project the other two get added automatically as expected. Up until re...more >>

String array in c++ dll to vb.net
Posted by Jeremy at 8/24/2006 11:24:32 AM
Hello, I have an unmanaged c++ dll which exports the function: long GetAllFormationNames(long LithSchemeID, long LevelID, int & numData, long ** Ids, char *** Names); it's the final argument that I am having trouble converting/calling from VB.NET - everything I have tried has resulted ...more >>

Image problem in converting HTML to MS Word doc
Posted by s.danyal.k NO[at]SPAM gmail.com at 8/24/2006 5:52:31 AM
Hi All, I have created an application in C# that converts HTML file to MS word documents. The HTML file may also have images , for e.g "<img src='http://www.google.com.pk/images/hp0.gif'></img>". The HTML file saved into .doc file. Now the problem is that whenever the .doc file is opened it goe...more >>

Account permissions needed for deployment of IE Toolbar (C#)
Posted by Jim Meyer at 8/23/2006 3:55:29 PM
I'm trying to deploy a toolbar for Internet Explorer, which according to the documentation requires COM-registration that adds entries to HKEY_CLASSES_ROOT and HKEY_LOCAL_MACHINE, setting up sub keys in {CLSID}\"Implemented Categories" etc. So it seems that you need to have administrator cr...more >>

The current .NET policy does not permit the customization to run.
Posted by PolarBears at 8/23/2006 8:28:02 AM
I am used to developing ASP.NET apps, but have begun to test creating a Word App with an Actions Pane, using Visual Studio Tools for Office 2005. On the development machine, no problem. Deployment is another matter however. I continue to get the message listed in the Subject above - "The cu...more >>

DllImport - C Function
Posted by Alessandro at 8/23/2006 7:04:50 AM
Hi all, Please, anyone can help me? I need a invoke a C function from a unsafe DLL. How to make a Dllimport call in C#? There=B4s the function: CLASS_DECLSPEC void WINAPI RCAL1901(const char *entrada,char *saida) { int codigo_veiculo; char descricao_veiculo[TAMMAX_DESCRICAO_VEICULO+1...more >>

No Office projects appear in VS2005 new project dialog
Posted by Nik Coughlin at 8/23/2006 12:00:00 AM
I have the VSTO PIAs installed, but when I go to File->New->Project the Office node is missing from the Visual C# node. Any ideas? ...more >>

Regasm
Posted by James at 8/21/2006 3:34:52 PM
I notice that anytime I run Regasm to register a managed library for COM-interop that it registers it with a threadingmodel of "Both". I have a particular library that can display forms, and therefore, I believe, must run in an STA. Is there control over this? I do note that the registratio...more >>

Can not find Microsoft.office.introp VERSION=12
Posted by Pat at 8/21/2006 6:56:03 AM
I try to test the new version of VSTO (for office 2007), but I didn't have the PIA for the office 2007 version. Did anybody knows where I can find them? Thanks ...more >>

Error when calling .net dll com in ASP page by setting SoapDocumentMethodAttribute
Posted by paul at 8/18/2006 1:57:06 PM
I found a very interesting issue that may draw you pro's attention: I built a COM class using VS 2005 with Framework 2.0,and the code is as below: //----------------------Code Begin---------------------------------- using System; using System.Runtime.InteropServices; namespace Test99 { ...more >>

value from C# to c++/MFC
Posted by vishnu.baroda NO[at]SPAM gmail.com at 8/18/2006 5:44:34 AM
Hi, I have application in c#, which store data buffer of 256, I have other application running on same computer which is in c++/MFC. I wanted data buffer of C# in c++/MFC software, this buffer changes frequently, what is best approch ?? how ?? Thanks in advance ...more >>

Native code unloads before Managed code
Posted by jornfa at 8/18/2006 1:11:01 AM
I have a project where I use the MFC support for interop: <afxwinforms.h>, CWinFormsControl<Ctrl> etc. This works fine exept for some problems when the application closes down. Now and then I get an ASSERT in wincore.cpp l .2870 (WalkPreTranslateTree). Further I can see in the output window th...more >>

C macro traslation in C# wrapper
Posted by Giorgio Tino at 8/17/2006 11:08:14 AM
Hello everyone, I'm writing a C# wrapper for a C library, and I needed some 'design' help. What's the best way to translate to C# something like: #define RECEIVED_ON_PORT_0 ( a ) (((a) & 0x00008000) == 0) #define RECEIVED_ON_PORT_1 ( a ) (((a) & 0x00008000) != 0) The...more >>

Error -2146233037 (0x80131533) when calling CCW for C# assembly
Posted by davidcjmack NO[at]SPAM googlemail.com at 8/17/2006 7:05:38 AM
Hi there! I have a C# assembly which I have checked in the Visual Studio solution to 'Register for COM Interop', registering the types in the registry and generates a TLB file - which I am then importing into a C++ program. My problem seems to be with Arrays - all of the methods in the C#...more >>

Interface pointers replaced with concrete classes when importing a type library
Posted by catharticmomentusenet NO[at]SPAM yahoo.co.uk at 8/16/2006 8:13:04 AM
Hi, I am currently trying to build some re-usable libraries. At the moment my code is split into two COM DLLs, one of which only contains interface definitions, whilst the other contains default implementations of these interfaces. Importing the interfaces library into .NET seems to work co...more >>

MODI - Cannot delete file after document closed
Posted by tbirdsall NO[at]SPAM gmail.com at 8/16/2006 7:08:05 AM
I am using Microsoft Office Document Imaging (MODI) with great success. However, when execute the following code, I get the error "The process cannot access the file 'myFile.tif'" (File name has been shortened). Here is the code I am using: -- BEGIN CODE -- public class OCRUtil : IDisposabl...more >>

Calling managed code from unmanaged code not using COM?
Posted by Bjarnek at 8/14/2006 3:55:33 AM
Hi I have a program not written in .net (Clarion), and I want to call functions written .net (C#) from this program. I know that I can use COM technology to do that. But I want to know if there is another way to do this with out using COM? bjarne ...more >>

Oulook Addin in C# / VS2003 Crashes before Getting to IDTExtensibility2 interface
Posted by TCook at 8/12/2006 11:32:39 AM
Hey All, I have a C# / VS2003 Outlook Addin that used to run fine. I now have both the 1.1 and 2.0 Frameworks installed on my machine. In a file located in the Outlook.exe folder, I have a file named "Outlook.exe.config" with the following in it: <configuration> <startup> <s...more >>

Help! ... VS2005 Error with Outlook AddIn when Using Redemption
Posted by TCook at 8/12/2006 9:49:25 AM
Hey All, I am trying to use the Redemption library within a VS2005 Outlook addin solution. I have used the same approach within VS2003 without incident. When trying to create a SafeMailItem object, I receive the following error message: "Retrieving the COM class factory for component wi...more >>

Lifetime of object created in C# used in unmanaged C++
Posted by stevil1234 NO[at]SPAM comcast.net at 8/11/2006 1:49:33 PM
Hoping someone can answer the questions in the comments below. I'm wondering how lifetime and ownership is typically handled between an unmanged C++ exe that uses a set of COM classes created from a C# assembly. // unmanaged C++ exe #import <mscorlib.tlb> rename("ReportEvent", "Report_Even...more >>

Getting a date from a cell ( C# )
Posted by Shea Martin at 8/11/2006 12:05:22 PM
I am reading data in from an XLS file use Excel interop. I currently get cell data like this: lRange = lSheet.get_Range( lTopLeftCellName, lBotRightCellName ); Object[,] lValues = (Object[,])lRange.Value2; The problem is that columns which contain dates (formatted as m/d/y) come across ...more >>

Returning COM Interface from Unmanaged DLL Function via PInvoke
Posted by jorfei at 8/11/2006 2:54:02 AM
What is the marshaling behavior for a COM interface returned with an output parameter from a function in an unmanaged DLL called via the Platform Invoke? An example of this is the function HRESULT CoGetMalloc(DWORD dwMemContext, LPMALLOC * ppMalloc); or its declaration in C# [System.Run...more >>

Using PInvoke to import unmanaged C++ class library to C# app
Posted by Hank at 8/10/2006 3:59:04 PM
Hi expert, I am writing a C# app which will access a 3rd party unmanaged C++ class library. the library contains one class with constructor, destructor and many methods. I search through the web find people talking about DllImport C type function, that's easy, you just do following: [DllImpo...more >>

vb6 nt service dot net interop error 429
Posted by stevenb at 8/10/2006 9:20:59 AM
Greetings... I currently have a vb6 application running as an NT service. I am referencing a dot net dll and all works fine if I run the vb6 application as a normal executable. As soon as I try to run it as a service, I get runtime error 429 activex component cannot create object. The me...more >>

structure size calculation problem
Posted by ps at 8/10/2006 7:36:02 AM
Hi all, I'm trying to make a pinvoke call to a legacy c dll. One method has a structure as input. The managed structure looks like this: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct Info { public Version cryptokiVersion; [MarshalAs(UnmanagedType.ByValTStr, S...more >>

AccessViolationException openning Excel WorkBook
Posted by hSiplu at 8/9/2006 1:41:18 AM
hi, can anyone tell me why the folowing statement throws an AccessViolationException ? my developing pc is WinXP Pro with MSOffice2003 and the release version runs on Windows 2000 Pro with Office2000 while my client can't change his configuration. The Debug version does not throw the except...more >>

COM Surrogate error
Posted by Sean at 8/8/2006 5:19:28 PM
HI, We have a WinForms App written in C#. It's all 100% manged code. This app monitor 4 Windows services that uses MSMQ to get and send messages from another WinForms App. One of the services interact with a CD printer API; Another is dowloading files from a server using HTTP; and another is...more >>

tlbimp problem
Posted by Gareth Lambert at 8/8/2006 3:32:42 AM
Hi, First of all, I am new to VB.net and programming in general. So my apologies if I don't explain myself clearly. I am trying to use a DLL within my code. It is not activeX so I can't add it as a reference. I believe that I must run it through tlbimp.exe and then declare it from my code. Wh...more >>

Server fails (80080005) when running client in debug mode
Posted by Anders Eriksson at 8/8/2006 12:00:00 AM
Hello! I have an COM Server which I Automate using a C# client. When I run the client in Release mode then it starts but if I switch to Debug then the server will not start and I get this error: "Retrieving the COM class factory for component with CLSID {DE821291-EB26-11D5-B6A6-0048545CA8...more >>

ATL COM client can't understand arrays of structs exposed by .NET
Posted by krzys at 8/7/2006 8:10:02 PM
I have a client written in C++ as a ATL COM application and a server in C# that lives inside a CLR hosted by this client. The C# server defines a COM-visible structure and an interface with a method that returns an array of such structures, such as below. When the C++ host calls the method, I ...more >>

.NET COM object propertys not visible in VB
Posted by Peri at 8/7/2006 12:00:00 AM
I have [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] public class A : IInterfaceA { // ... } [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] public class B : IInterfaceB { // ... } and other classes defined like thi...more >>

Writing a BHO and SetSite isn't firing
Posted by bajohns1 NO[at]SPAM gmail.com at 8/5/2006 12:45:23 PM
hello, After reading many groups and checking tons of pages I still can't figure out why my code is not working. I have implemented a BHO to catch the BeforeNavigate2 event. I attach my code to a running instance of IE6 (using VS2005) and open a new window. The code is registered in IE (S...more >>

Create DLL in Visual Studio 2005 accessible by Excel 2002
Posted by Steve at 8/4/2006 10:26:01 AM
I am trying to create a DLL in Visual Studio 2005-Visual Basic that contains custom functions. I believe I need to use COM interop to allow VBA code in Excel 2002 to access it. I've studied everything I can find on COM Interop and .NET. I've also tried many of the 'Walkthroughs' on the MSDN...more >>

Create COM component via late binding
Posted by jwang at 8/3/2006 10:36:55 PM
I am trying to instantiate a COM component in C# via late binding. The component appears to be launched, then it automatically gets unloaded. That is, the instance is unloaded after the CreateInstance returns. Any idea of what could be the problem? Thanks a lot. Here is the code segment...more >>

Licensed COM Object
Posted by juan NO[at]SPAM msdnCompany.com at 8/3/2006 3:00:02 PM
Is there a way to create a COM object that is licensed using the .NET COM wrapper? I want to supply the COM object with a run time key and do not understand how I go about doing it after adding the COM library as reference in my C# project. I see a lot of discussion when using an ActiveX Con...more >>

Possible to deploy COM tlb's using side-by-side deployment
Posted by KimD at 8/3/2006 7:50:06 AM
Hi, I have built a dll in C# and exposed it as a COM object and registered the tlb (by running regasm) for calling from a Delphi 6 (unmanaged code). Delphi can access the tlb and methods no problem but I'm wondering would it be possible to deploy the exported COM interface using side-by-side ...more >>

Excel process not getting terminated from memory.
Posted by Sarang Bapat at 8/3/2006 12:00:00 AM
Hi All, I am automating excel using C#. I have created a .Net Class library = which launches excel, and hooks to some of its events, and connects to = an excel COM addin.=20 There are 2 scenarios in which excel is launched: 1. Excel is launched(through the above DLL), and an existing workbook i...more >>


DevelopmentNow Blog