Click here to Skip to main content
15,891,184 members
Everything / Interop

Interop

interop

Great Reads

by Leif Simon Goodwin
How to pass strings between managed and unmanaged code
by Christ Akkermans
An introduction to the strange world of mixed language programming with FORTRAN and C# .NET code
by Debabrata_Das
This article will talk about how a WCF service can be consumed by a Java client application.
by koolprasad2003
This article explain you How to protect word document using C# and Word automation

Latest Articles

by ToughDev
How to convert OFT to .NET Windows Form in VS
by William Damert
Console .NET application using Microsoft.Office.Interop.Word for keyword search
by Lee P Richardson
Which SPA technology should you use: Blazor WebAssembly or something more mature like Angular, and why?

All Articles

Sort by Updated

Interop 

15 Dec 2010 by #realJSOP
Maybe Excel doesn't support dates earlier than 1900... have you googled it?EDIT ==============I googled it, and found out that the earliest possible date Excel will accept is 01/01/1900. You're out of luck, Sparky. Here's the link I found the info...
27 May 2011 by #realJSOP
I found this on the first page of over 2.1 million results with a google search for "asp.net class not registered":http://forums.asp.net/p/1046003/1467497.aspx[^]
17 Aug 2011 by #realJSOP
Your best bet is to google variations of "c# interop services", and look for stuff that resembles what you unmanaged DLL does as far as return types and parameter types are concerned. You didn't mention if it was a standrad C++ dll or a MFC DLL (or what *kind* of MFC dll) it is, so you should...
9 Sep 2014 by #realJSOP
I'm using Interop Services, trying to find all child windows in a process that I run from within my app. The app being run is IE. It finds the first two (BrowserFrameGripperClass and Client Caption) and then simply quits.Relevant code:public static class WinAPI{ public delegate...
10 Sep 2014 by #realJSOP
VS2013, Win7 (32-bit)I'm writing a WPF app that utilizes MEF, and one of the modules (the one I'm testing) uses interop services. When I run the app to test the module, the app shuts down with no indication that anything is wrong. I've put try/catch blocks around the code where it stops, and...
10 Jun 2018 by #realJSOP
All exposed classes and methods have have the comvisible attribute. If textsharp classes/methods don’t have that attribute, you’ll probably have to write a wrapper assembly that does it. I’m just guessing, I don’t know anything about itextsharp, and abhor MS Access and VBA.
14 Nov 2014 by .Net Jim
Check this out...Faster MS Excel Reading using Office Interop Assemblies[^]
4 Aug 2022 by 0x01AA
One can address a specific cell directly by row/column index. E.g. like firstTable.Rows[1].Cells[1].Range.Text = "My Value for that Cell"; Note: Keep in mind that for office interop the index of a collection starts at '1' and ends at...
10 Sep 2014 by A.R.I.
I am working on a c# project (.Net 4.0) where we are extracting data from word file using microsoft's interop assembly. I have read bold, italic, underline etc. Now I want to read bullet list from word file. How can I do this using interop?
2 Feb 2011 by aaawesome
HiI am using VS 2010 Express and have ported some code proven in VS 2008 but it fails in VS 2010 and I cannot understand why.The code uses InvokeMember:.Interface.GetType().InvokeMember("", System.Reflection.BindingFlags.InvokeMethod,...
22 Apr 2016 by Aaquil88
My code isstring FileName = Path.GetFileName(FileUpload1.PostedFile.FileName); string path = FileName; oXL = new Microsoft.Office.Interop.Excel.Application(); oXL.Visible = true; oXL.DisplayAlerts = false; ...
2 Aug 2017 by abdul subhan mohammed
Dear All, I'm trying to read word file ".docx" and text file ".txt". For this i'm using this code: What I have tried: string[] linesFile = File.ReadAllLines(@"" + file, Encoding.UTF8);//word file Output "PK\u0003\u0004\u0014\0\u0006\0\b\0\0\0!\0ߤ�lZ\u0001\0\0...
9 Oct 2018 by abdul subhan mohammed
Hi Guys, I have windows application with Microsoft word interoperability c#. This application is used to Evaluate Actions done in ms-word by a user. I have to create one template to Evaluate Paragraph TabStops used in the word document. What I have tried: wordApplication.ScreenUpdating =...
26 Apr 2019 by abdul subhan mohammed
Dear All, I have created winform application which evaluates Microsoft word. Here, my application top position is 470 and I want to set Microsoft word bottom equal to the top position of my application, that is, 470. What I have tried: I tried this code: if (handle != IntPtr.Zero) ...
8 Sep 2015 by abdulwahid
My problem and the solutionI have a 32 bit third party dll which i have installed in 2008 R2 machine which is 64 bit.I have a wcf service created in .net 4.5 framework which calls the 32 bit third party dll for process. Now i have build property set to target 'any' cpu and deployed it to...
28 Aug 2011 by Abhinav S
Fairly useful link[^], should definitely help you out.
4 Jan 2013 by Abhinav S
Tryhttp://support.microsoft.com/kb/306683[^]http://objectmix.com/csharp/240730-automating-word-macro-c.html[^]
9 Feb 2014 by Abhinav S
Did you try Range.Find - http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.find.ASPX[^].Also try - Programmatically Search for Text in Worksheet Ranges[^]
20 Mar 2015 by Abhinav S
This can be tried using interop - C# Com[^].
21 Aug 2017 by ADS14
I am creating a exe to read and update a particular excel using Interop. This exe will be in share path accessed my multi users ,which means the excel will also be updated my multiple user at same time .. how to handle this programmatically in C# ? What I have tried: I am creating a exe to...
11 Nov 2013 by agent_kruger
sometimes a component has some problem. Try re-installing the particular component might fix it.
29 Feb 2016 by AjayRRathi
We are planning to migrate our application from VB6 to .NET. We want to migrate the project part by part in an iterative faction. For migrating the application we are use Microsoft interop (COM Wrapper). My question is have any one used it, 1) Do anyone came across any challenges while...
20 Jul 2011 by Albert Holguin
Your interface class implementation should probably be contained within your namespace.
5 Jun 2018 by alejandroGS
Hello everyone! I'm creating a program in WPF based on C #, which is filling rows of Excel in the same column, but the code on which I base the truth I could not make it work, so I ask a little help to guide me a bit. The example of filling in the data consists of row 15 to row 20 in the same...
14 Sep 2016 by Alex Banu
this will end any MS Word, maybe this is a start :using System.Diagnostics;...Process[] word_apps= Process.GetProcessesByName("winword");foreach(var word_app in word_apps){ word_app.Kill();}
11 Feb 2014 by alireza moghimi
PROGRAM VLMuse MSIMSLIMPLICIT NONEREAL*8,allocatable :: XB(:),A(:,:),BL(:),SOLV(:),PHI(:),PHIW(:),PHIOLD(:)REAL*8,allocatable :: CF(:)INTEGER :: I,J,NW,NB,ITREAL*8 :: UINF,ALPHA,PI,DT,CL,AINF,DX,TIME,T,T0,MACH,SUM1 OPEN (6,FILE="CLT.DAT") ...
1 Dec 2014 by Am Gayathri
How do i convert a string in to html format?To be precise, i want to convert excel cell value in to html format.For example: if excel cell values is 'am a programmer'. I want to convert it in to 'am a programmer'.Is it possible?If any values are bold then html bold tag should...
2 Dec 2014 by Am Gayathri
Loop through each character in excel then check the format.StringBuilder html = new StringBuilder(); for (int index1 = 1; index1
3 Apr 2017 by amagitech
I want to use my c# class library dll with other languages but it doesn't work well. How can I deploy it. What I have tried: I used NuGet Gallery | Unmanaged Exports (DllExport for .Net) 1.2.7[^] reference it works if I use basic operations like sum or multiply. But don't work with...
3 Apr 2017 by amagitech
It fixed itself with Regasm command.
4 Mar 2014 by Amalraj Ramesh
i think its a assembly issue make sure that Microsoft.Office.Interop.Word is there at pariticular servergoto this path and check it outC:\Windows\assembly
15 Feb 2021 by amirea
I need to keep references in unmanaged code to objects on managed side, like handles. There are going to be approx. 10,000,000 objects. I'm not familiar with interop, initially I thought it was as simple as declaring ref SomeClass on C# side...
27 Dec 2010 by Amit Kumar Tiwari
Try this:http://social.msdn.microsoft.com/Forums/en-US/worddev/thread/60315605-717c-4397-84d5-96586a8b88e7[^]
9 Feb 2015 by Amlan Sengupta
Hi All,I can connect to the Lotus Notes server using NotesSession.Initialize(password) method of interop.domino.dll. Which actually uses the last user name by which the hosted machine has logged in the Lotus Notes server. There is another method of NotesSession which is...
8 Nov 2019 by amrinde
you should use save as oDoc.SaveAs("MyFile.doc", ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
13 Aug 2014 by Anand Kumar Devendran
Hello Experts,I am currently working on office AddIn.In my active(opening) document i have many contents controls like name, Age, Address, etc., In my UI screen am listed all the contents controls(xml tags) in tree list.Here am selecting the name controls from tree list and...
7 Nov 2015 by andrewj86
Started experiencing the same error out of the blue yesterday in Outlook VBA. Finally found a workaround.Changed this:Set teamBox = objNS.CreateRecipient("Our.Shared.Mailbox@domain.tld")Set olTeamBoxItems = objNS.GetSharedDefaultFolder(teamBox, olFolderInbox).ItemsTo this:Set...
16 Jun 2013 by Andrey Dryazgov
Introduces a managed wrapper for the Interaction Context API and provides a consistent way for processing touch input in a managed desktop app for WinForms.
14 Apr 2018 by Andy Galluzzi
Join me to create the most advanced yet most simple to use full duplex MMF based IPC for Windows
27 May 2011 by Ankur\m/
This discussion talks about a possible work around for the error: http://forums.asp.net/t/1119052.aspx[^]BTW there are many other discussions here[^] :thumbsup:
28 Sep 2010 by anshudutta
Is your video overlayed on your form. You can use the following code and trypublic static void SetDoubleBuffered(System.Windows.Forms.Form c) { if (System.Windows.Forms.SystemInformation.TerminalServerSession) return; ...
27 Jul 2010 by Ant Waters
I am writing an ActiveX in C#, to be used in a legacy C++ application.It all works ok, apart from event handling.The problem is that when the event is raised in C# I get the following error: An unhandled exception of type 'System.InvalidCastException' occurred in...
17 Jul 2012 by Anumeha Shukla
I faced a similar issue like this and I could resolve it by doing the following things 1. Go to DCOM Config, find Microsoft Excel Application,go to the security tab of its properties, Select Customize, under Launch and Activation Permissions,click Edit and Add the account under which the...
26 Mar 2013 by Anurag Sinha V
Hi Folks,Have a disturbing doubt, hope mentors at CP would be able to assist.I have a simple WPF application, in which there is a button.The button is supposed to write data to an excel sheet, which ain't happening.I get an error while building the application that:'Window' is an...
11 Aug 2015 by AnvilRanger
Even with the further explanation your idea seems overly complicated to achieve very little benefit, but as also pointed out the security risk are just too high.From your description it sounds like you want to store the users credentials for said social media site on your own system and then...
26 Mar 2011 by apaka
Does anybody know any sample how to create property handler shell extension in c# or any other language? Thanks in advance.
23 May 2011 by apaka
I'm using my FILETIME structure for interop. It seems to work on my comp ,but will I have some problems on x64 architectures?[StructLayout(LayoutKind.Explicit)]public struct FILETIME{ [FieldOffset(0)] public int dwLowDateTime; [FieldOffset(4)] public int...
31 Jul 2011 by apaka
Unmanaged code calls my functions. In first function I sould pass back pointer to my managet object. Sometimes later some of my othrer functions got called with that same pointer as one of parameters . I sould dereference it use it to perform some calculations and then if it is not neaded...
14 Aug 2011 by apaka
I'm trying to convert a device name of the form"\Device\HarddiskVolumeXX" to a name of the form "\\?\Volume{GUID}. How can I do this in C# ?
16 Aug 2011 by apaka
How can I rename drive using shell api and c#? Which libraries to use ? I foud that there is some kind of ShellLib for .NET, but I could'tfind its download. My actual problem is that I am dealing with disconected network drive without UNC path so the only way to rename it is from explorer, but...
6 Sep 2010 by ARopo
.NET dlls can be loaded dynamically using LoadAssembley. You can't call a .net dll directly from C++ unless it is a mixed managed and unmanged dll using /CLR. What I would do in you situation is to create a mixed C++/.NET dll to wrap your c#.Net DLL then call the C++/.NET dll directlt...
12 Aug 2011 by ARopo
Question: Does anyone know why I can get the events to fire between a .net usercontrol and a VB6 Form hosting the user control through VBControlExtender in a reg free com environment?The VB6 end does not seem to recognise the .net user control as an event source and is consequently not...
15 Aug 2011 by ARopo
The problem was related to the type library, inserting the following lines int0 the manifest fixed the problem version="1.0" helpdir="" flags="HASDISKIMAGE">Also have to reference the typelib from the clrclass section, so the full manifest is as...
4 Oct 2012 by arshad alam
0 down vote favorite i am creating a add-ins for Microsoft Word. i have a tree-view control where i am generating Folder, files and File's bookmarks in hierarchical structure.For this i am using these code :void GetTree(string strSearchPath) { ...
8 Aug 2012 by AS01234
Help with passing structure from unmanaged c++ dll to c# ?I am struggling with passing a structure from an unmanaged third party c++ dll back into my c# application. The dll is for a spectrometer. All of the other commands to the spectrometer work fine except this one. I am pasting more...
11 Oct 2012 by AS01234
The reference from Philip Stuyck was very helpful, but I want to also acknowledge receiving help from the company that makes the spectrometers (mightexsystems.com). I still don't like the solution, because now it uses unsafe code in the wrapper, essentially c++, to de-reference the...
11 Aug 2015 by ASJ_SA
I am trying to get a excel work book created using the excel interop. I have one sheet called MonthlyBreakdowns where the values are populated from Dataset What I want now is to populate another sheet called Template with certain values from the MonthlyBreakdowns sheetI have tried these 2...
24 Sep 2010 by AspDotNetDev
Do you think you're talking to the author (or the editor)? To do that, post at the bottom of the article. Anyway, the author did not write any more articles. You can find a list of articles by an author by visiting their profile page:...
6 May 2011 by AspDotNetDev
This demonstrates how you can call a C# method in a Windows Forms application from JavaScript that is hosted in a webpage inside a WebBrowser control on your form.
23 Mar 2011 by AspDotNetDev
You can use the Interop Forms Toolkit to use VB.Net controls from your existing VB6 application. You can also use VB6 controls in your VB.Net application. It may also be of use to you to call a VB.Net DLL from VB6. Again, you can do the reverse and call VB6 code from VB.Net.Those links...
27 Sep 2010 by ASysSolvers
I am having some issue in my code which is showing video using vlc interfacing and at the same time I'm showing an overlay on the top of video full screen using Form transparency capability. But this is fine in my Windows 7 PC and it is getting flickering in XP machine.If you know the...
13 Nov 2018 by Aydin Homay
Hi, What comes to my mind is the use of office development in visual studio which allows you to embed office (word, excel, power point) inside of your wpf or winform application. See the below link for more information. Office client development | Microsoft Docs[^] Another links: Embedding MS...
6 Sep 2010 by BaptX
Hi there,I have a question about Interop between C# and C/C++. That's the situation :- I need to develop a C# dll (MS VS2010)- A c++ software (C++ Builder IDE) must call this dll in order to do some stuffThis is the code of the calling method (C++) :// Loading DLLif (enCr ==...
6 Sep 2010 by BaptX
If I understand properly, you said I need to create a DLL which will do interface between my C++ Software and the C# DLL ?Software --> Mixed DLL --> C# DLLIs that right ?I will search on google some informations about mixed DLL.
22 Sep 2011 by Bardy85
I found a solution for this.Check out this postYou will need to call your event like this.SynchronizationContext.Current.Post(o => DataReceived(sender, (int) (e.EventType)), null);
26 Jul 2010 by Bashir Magomedov
Hi. 1. Better use to create rich formatting for new documents. Not very useful for read-only purposes.2. Fast enough, but requires additional conversion and verification.3. Fast enough, but requires additional conversion and verification.4. Personally for me this is the best choice for...
10 Oct 2013 by basvo
Hello guys,I've been working on a c# project recently. It reads selected info from all sheets in a certain folder, and puts them in a access database and also makes a report in cr.Now when I run my appliction it works great and does eevrything it is supposed to do, but when it is...
9 Aug 2012 by bChen@sh
This article explores the rules of how AddRef and Release are called in RCW and COM, which addresses the issue of RCW memory leaks.
23 Aug 2012 by Belial09
Hi,I have developed an VB.NET InteropUserControl which works properly on my pc.The InteropUserControl is used in a form in an Access 2010 MDA File. If i deploy it as an MDE File to another pc, the Form won’t open with the errormessage "There is no control in this object". The Control...
29 Mar 2012 by Bernhard Hiller
The object which is not set to a reference is likely somewhere inside that Comm210.StudIO object. Since it is expected to communicate with hardware - likely some kind of hardware which is not shared - it will somehow try to get exclusive access to that hardware. If it does not get that access,...
25 Jul 2013 by bhavesh002
hi i try to draw piechart of using excel data using coding in c# i use Microsoft.Office.Interop.Exceli get chart if i try for column A and B but if if i try For A and Column C it not take column c so my problem is that how we pass range for pie chart which take nay column from excel...
2 Aug 2013 by bhavesh002
worksheet.Pictures.Add("Pengui...
21 Jun 2017 by Bhola Ram Sahu
You can get column name from the bellow code. Then you can put new column name. Excel.Application xlApp = new Excel.Application(); Excel.Workbook xlWorkbook = xlApp.Workbooks.Open("workbookname"); Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[1]; // assume it is the first sheet ...
5 Apr 2015 by Bjørn
Using ffmpeg DLLs directly in C# to extract frames and create a thumbnail sheet
6 Dec 2011 by BMT(1460
My unmanaged function signature is as follows:HRESULT extern WINAPI WFSStartUp ( DWORD dwVersionsRequired, LPWFSVERSION lpWFSVersion);Where LPWFSVERSION I is a pointer to structI declared the following struct[StructLayout(LayoutKind.Sequential)] public class WFSVERSION { ...
7 Dec 2011 by BMT(1460
I've implementated the following C# statements as you pointed out: WFSVERSION rc = new WFSVERSION(); DispatchWrapper dispArray = new DispatchWrapper((object)rc); it builds but when calling the function in my C# application I getSafeArrayTypeMismatchException
25 May 2012 by Bob_Singh
Hi I'm using ImoduleConfig Interface in C# like:[ComImport, SuppressUnmanagedCodeSecurity, Guid("486F726E-4D43-49B9-8A0C-C22A2B0524E8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IModuleConfig : IPersistStream { new void...
2 Aug 2011 by BobJanova
There are really two options here. First, you can use the PowerPoint API to iterate over all the slides, objects etc within the presentation, and create HTML elements representing each one that display how you want. And second, you can let PowerPoint generate the HTML and then post-process it...
10 Aug 2015 by Bounze
Hello guys:I need for my WCF service to remotely open the default web browser on the consumer computer and monitor its browser events in order to capture the value of one of its properties (document.title in this case). I can already open Internet Explorer and navigate on it (using the...
28 Jun 2011 by Brendon1234
Hi(Just a heads up that I have also posted this on the MSDN WCF Forum: http://social.msdn.microsoft.com/Forums/en/wcf/thread/87a254c8-e9d1-4d4c-8f62-54eae497423f)I will include quite a bit of information in this question. Basically I'm writing a WCF service and separate example .NET and...
19 Dec 2010 by Brian C Hart
You know that little "Merge and Center" button in Microsoft Excel? Here's how to 'click' it in C# with Excel Interop (and this carries over to VB etc, too).
19 Dec 2010 by Brian C Hart
Code to call Excel Interop to take a Comma-Separated-Values (.CSV) file and suck it into your Excel workbook programmatically, and then Auto-Fit the resultant columns.
26 Aug 2011 by Brian C Hart
C# code to format a certain range of Excel cells using the Format As Table button -- but from C# interop code
11 Nov 2013 by BulletVictim
Good day allI have a bit of a head scratcher on my hands.The following code runs on my server and it does work for what it is intended.public void RenderWithData(string strcaseno, string strdocpath, string strdocsp, string stramnt){ Microsoft.Office.Interop.Word.Application appWord =...
27 May 2011 by buzzluck68
I have built an ASP.NET web application (that houses a Silverlight 4 app) and it utilizes a couple of COM dlls. The dlls are registered (verified by finding the CLSIDs in the registry, and seeing the classes within the CLSIDs), and they are located in a directory that has full control for all...
27 May 2011 by buzzluck68
The solution was a stupid oversight on my part. Since I am still learing IIS, i set the application pool to have the correct settings, but I forgot to set the site to use the application pool.The application pool had to be set to allow 32-bit applications, which it was, but was not being...
25 Jul 2012 by calebboyd
I am having an issue copying clipboard data from OneNote 2010. I would like to be able to copy the clipboard, serialized it and paste it back in. But it always loses its formatting (OneNote HTML..) so the text and images are not arranged in the way that they were copied. I'm just using the .NET...
9 Jan 2012 by chandanadhikari
hi, appears like you want to show some statistics about the items in excel sheet. in case your app is writing this excel file also, why do you not put a check while writig itself to count your "Apples" or lets say put a counter where the code is changing the color to Red.
31 Mar 2013 by Chandra Kumar Gupta
Below is the piece of code written in c++, how can i convert it in c#. If you check the pams_get_msgw function , the first param is of (char*), how can i pass the same in c# . struct { short m_nStatus; short m_nReg_Id; short m_nNumber_Reg; } oRegReply;short nBufSize =...
16 May 2013 by chenduran10
How can I make the export more faster.this one is too slow..
2 Dec 2012 by CHill60
Firstly your comment "which read first worksheet (by default)" isn't quite accurate - it's simply that the first sheet was active the last time you saved the spreadsheet ... if you had left the 2nd sheet visible before saving and closing the spreadsheet then the second sheet would have been read...
3 Dec 2012 by CHill60
Can't see the comment here for some reason but I got an email asking if there was a method to read until worksheets no longer exist - I did put a clue on how to do this in solution 1 !However, here is an exampleusing xl = Microsoft.Office.Interop.Excel;// ... this code under a button...
11 Feb 2013 by CHill60
I've hit this before and got around it like this...Change your using statement to give it an alias, for example ...using xl = Microsoft.Office.Interop.Excel;Then use this alias when referring to Range, for example ...chartPage.SeriesCollection(1).XValues = xl.Range("B2:B4");
17 Apr 2013 by CHill60
Have a look at the solutions and comments to this similar problem (leave a comment to this solution if it doesn't quite fix your problem)Problem with Excel object[^]
14 May 2013 by CHill60
To improve performance you need to minimise the use of the Excel COM interface.I would suggest converting your list of objects to a datatable first and then exporting that to excel ...Here is a generic way to convert a list to a datatable Converting a List to Datatable[^]and here's how...
13 May 2014 by CHill60
Have a look at this CodeProject article Finding and Listing Processes in C#[^]On a similar question previously King_Fisher[^] also suggested this link http://stackoverflow.com/questions/4722198/checking-if-windows-application-is-running[^]. If this last link works for you then King_Fishers...
17 Jun 2015 by CHill60
Couple of things that might help sort this out.The lines //~~> Set the destination rangexlDestRange = xlWsheet2.Range["A2"];xlDestRange1 = xlWsheet2.Range["B2"];will result in an error Quote:The information cannot be pasted because the Copy area and the paste area are not the same size and...
15 Nov 2022 by CHill60
The documentation states (bold mine)Quote: All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not...
4 Jan 2013 by choudhary.sumit
i have a Word Doc in a directory and a .dotm file in the same.word doc has not any macro in it, but all macro are in .dotm file.so the question is this how can i run macros which are in .dotm file from my c# code?i have tried so far: private void btnStart_Click(object sender,...