Bit of a history lesson here. I'm working on a legacy C++/MFC application and am trying to start a incremental modernization by pushing components written in C# (WinForms and later WPF).
I'm stucking using .Net/1.1 and VS/2003 for many reasons which are impossible to resolve in the near future.
Currently, as a proof of concept, someth...
I have a few p/invoked functions (but I'm rewriting my code at the moment so I'm tidying up) and I want to know how to use/pass a nullable type as one of the parameters. working with int types isn't a problem but given the following:
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern IntPtr SetupD...
I can load COM DLLs that are registered on my machine like this:
Type type = Type.GetTypeFromProgID("MYCOMDLL.ClassName");
object boxed = Activator.CreateInstance(type);
I can then poke around invoking methods etc.
How can I achieve this from a DLL file that is not registered on my machine?
Something like this magicode:
Type type =...
I'm interoping with some com objects in a web service using code shared with a windows app. The window apps has no problems interoping with the com objects but the web service throws this exception
'Type 'MapShots.FODDs.ilfFOD.fodDescriptions' in Assembly 'ilfFOD, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null' is not marked as...
I'm currently writing about dynamic typing, and I'm giving an example of Excel interop. I've hardly done any Office interop before, and it shows. The MSDN Office Interop tutorial for C# 4 uses the _Worksheet interface, but there's also a Worksheet interface. I've no idea what the difference is.
In my absurdly simple demo app (shown belo...
I'm having a WinForms application where I would like to perform some long-running operations, e.g. imagine Explorer copying 2 big files in parallel. For each of those long-running operations I'm starting a separate UI thread (which includes pumping messages/Application.Run/Application.ExitThread) where I create an instance of the IProgre...
I want to extend a large C project with some new functionality, but I really want to write it in Python. Basically, I want to call Python code from C code. However, Python->C wrappers like SWIG allow for the OPPOSITE, that is writing C modules and calling C from Python.
I'm considering an approach involving IPC or RPC (I don't mind ha...
I have a COM interface and need to add an accessor method to it. The returned value can actually be of one of 4 types: VARIANT_BOOL, long, BSTR or an IDispatch derived interface.
I therefore have a choice: either I return a VARIANT or I have 4 different access methods that return distinct types.
interface IValue1 {
HRESULT GetType...
When I try to sign the assembly I get the following error:
Error 1 Assembly generation failed -- Referenced assembly 'comlib' does not have a strong name
Is it possible to sign an assembly that reference unsigned assemblies or do I have to sign the COM interop assemblies as well?
...
This questions is a follow up on an answer by Paul Alexander to the question "Should interop assemblies be signed?".
Depending on how complex your Interop assemblies are - you can generate the proxy code into a separate .CS/.VB file and compile it directly into your assembly. Then you won't have to worry about strong name issues.
H...
I've done the other way around (Calling pure C++ code from .Net) with C++/CLI and it worked (for the most part).
How is the native->c++/cli direction done?
I really don't want to use COM interop...
...
I have a very simple WPF user control that is mixed in with a windows forms app. It has a list box that renders its scroll bar without the thumb (image below). I narrowed it down to a plugin in my app that uses Managed DirectX (MDX). If I remove the plugin, the scroll bar is just fine. I know MDX is deprecated, but I don't think toda...
I am creating some reporting software that will generate excel workbooks with charts and all related data. Besides the built in libraries and .NET Office integration features, is there any other tools or code that people found useful to creating similar projects?
EDIT: I am targeting winforms.
...
I am creating an Excel Worksheet from C# using Microsoft.Office.Interop.Excel, and I have not been able to get the footers the way the User wants them.
1) How can I put footer text in BOLD?
2) How can I put the page number in the footer? (Putting @"Page @[Page]" in as text does not work.)
Possible? Not Possible?
...
Hello,
Will using GetComInterfaceForObject and passing the returned IntPtr to unmanaged code keep the managed object from being moved in memory? Or does the clr somehow maintain that ptr? Note that the unmanaged code will use this for the lifetime of the program, and I need to make sure the managed object is not being moved by the GC.(At...
I have an application written in C# that uses Outlook Interop to open a new mail message pre-filled with details the user can edit before manually sending it.
var newMail = (Outlook.MailItem)outlookApplication.CreateItem(
Outlook.OlItemType.olMailItem);
newMail.To = "[email protected]";
newMail.Subject = "Example";
newMail.BodyFormat...
Can a .NET component be used from a COM component?
...
I have some code that implements the IReflect interface for presenting an IDispatch face onto some .NET objects without sticking all of the COM interop goo onto the classes themselves.
We used this because we had a scripting client that wanted to use these classes, but we didn't want to put all the COM interop stuff onto the classes the...
I have Office 2007 on my dev machine. I have a small app I'm building for a customer server with Office 2003 that needs to do some interop. My program will run as a scheduled task in a nightly batch process.
No matter what I do, I can't find the version 11.0 of the Access interop assembly so that will work on the server.
I've tried...
how do I successfully compile this code from the commandline, using csc.exe, in terms of which dll's I should reference. I would like this to work with Office 2007 as well as Office 2003.
I am use DotNet Framework SDK 2.0.
I get this compilation error:
(2,37): error CS0234: The type or namespace name 'Interop' does not exist
in the ...