interop

Capture Screen at ScreenSaver startup

Hey All, I am creating a WPF screensaver, although this question isn't really WPF-specific. I have code to do a screen capture when the screensaver kicks in (using GDI+ and Interop). This all works fine in Preview mode, but not in normal screensaver mode (even though both call the same code). I'm guessing that Windows itself is cle...

C# - How to copy a single Excel worksheet from one workbook to another?

Hey all, I have a need to copy a worksheet from one workbook into another and I'm a bit stuck. The premise is that I have a "master" workbook that stores the templates for a number of reports and I then need to create a blank copy of a specific worksheet and add it into a new workbook. This is what I have so far: private void CreateN...

How to add attachments to mailitem using Outlook late binding

I'm trying to create a mail item and add some attachments to it using late binding. I've already managed to create the mail item, but I cannot invoke the Attachments property. object objApp; object objEmail; Type objClassType = Type.GetTypeFromProgID("Outlook.Application"); objApp = Activator.CreateInstance(objClassType); // Microsoft...

Excel - How to ignore rows with formulas that equate to nothing?

Hi all, I'm working with Microsft Office Interop API. My question pertains to Excel. I wrote a program using Interop API to format Excel documents and then send them to the printer. The problem though is that we occasionally run across files in which people have created a column that spans 65,000+ rows, and all it contains is a formula...

WPF - Resizing chromeless windows using attached behaviors,..Any suggestions?

Who fancies a challenge? I'm currently working on the ControlTemplate for a chromeless Window which will be a part of a reusable theme assembly. I want the behaviors for moving, closing, minimizing and restoring to be implicit so I've written attached behaviors for this functionality which I've then included in the template. Now,..I'v...

Manipulating a scroll bar window in another application

We're "automating" a third part application by writing a script to mimick using input. We're able to mouse click, send keystrokes etc by using win32 calls, but I'm having trouble automating manipulating a scroll bar. I've found the window who's location matches the visual location of the scrollbar, so I'm pretty sure I have the window h...

COM Interop: indexed property signature issues

I'm working on a project that's a .NET extension to a rather large classic ASP project, using a lot of C++ COM objects that have been around in our code base forever. Unfortunately, there's a lot of hack-ish code on the C++ side, and I fear that I'm not experienced enough to work out the problem I've encountered. In a nutshell, I can i...

How do I leverage a control from a C++/CLI project for use in my WPF application?

First of all, my knowledge of C++ is effectively zero. I'm a .NET developer but even my interop experience is minimal. I have found an example of a control written in C++/CLI that grabs and displays a webcam feed using DirectShow. I'd like to take this example and utilize it from my WPF application. I've tried (and butchered) several d...

WCF Serialization problems with WSDL file created by Java tools

Hi all, My team is tasked with getting several in-house developed .NET client applications to connect to some new Java web services. The Java web service is a third party, vendor supplied WSDL file that our team has a limited ability to modify/control...meaning we probably have the power to request our vendor to make slight tweaks to th...

How to use proper unmanged .dll depending on CPU Architecture?

I am using an unmanaged library in a .net application which is used on x86 and 64bit systems alike and therefore is compiled as 'Any CPU'. The unmanaged, native .dll however comes in two different .dlls for that (one for win32 and one for x64). Is there any way to still keep the 'Any CPU' / one binary way with different native .dlls reg...

How can I pass a Scala object reference around in Java?

I want to return from a Java method a reference to a Scala object. How can I do that? My Scala objects are like this: trait Environment object LocalEnvironment extends Environment {...} object ServerEnvironment extends Environment {...} ... and I want my Java method to be like this: Environment getEnvironment() { return LocalEnvir...

Fortran interface to call a C function that return a pointer

I have a C function double* foofunc() {...} I don't know how to declare the interface in Fortran to call to this C function. The second question is: if this pointer is supposed to be pointing to GPU device memory. How could I define that in the Fortran interface, i.e. do I need to use DEVICE attribute. Thanks, T. Edit: Use any featu...

WCF security in an internet scenario

I have a WCF service hosted in a Windows Service. Clients from various platforms will access the service. Now I would like to add a basic security mechanism. Ideally, the clients should use username/password for authentication. Which binding settings do I have to use in this scenario and how can I authenticate the client? Interoperabil...

When to use __gc for classes and structs?

I am updating some old c++ code and am finding that many of the classes are defined as: public __gc class NameOfClass{ } I found a little bit of information about __gc here, but it seems to only come up with information for VS 2003. The MSDN documentation that came with my copy of VS 2005 indicates that __gc may not be in use anymor...

In Scala, how can I pass null to a Java method that expects Long?

I have a Java method that accepts a Long value: (in Java) public void setValue(Long value); I understand that the Scala null does not extend any of the value types, including Long. Therefore, when I try to pass null to it, I get a compilation error: (in Scala) javaThing.setValue(null) ==> type mismatch; found : Any required: java.l...

How to access chart in PowerPoint via VSTO

I am trying to access charts in slides in PowerPoint 2007 via VSTO, and I am a bit confused. While the Interop provides a property Shape.HasChart which properly finds shapes that have/are charts, I can't figure out how to access the Chart itself. I don't see a chart property on the Shape. Am I supposed to cast the Shape to a specific typ...

C# - Recovering From Exception from Interop

I've purchased a third party library that I am using from my application. My application references a small interop dll which in turn calls into another dll (non CLI) to do its thing. Since this library communicates with hardware, I'd image that this dll talks with various device drivers. A typical method signature from the interop dl...

Is it absolutely safe to display a WPF window from a WinForms form?

I would like to display a WPF window from a windows forms application (.NET 3.5). This code seems to work without any problem in a sample project: public partial class WinFormsForm1 : Form { public WinFormsForm1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { WpfWindow1 w =...

how can we open a word file with specific page number in c sharp?

how can we open a word file with specific page number. can anybody plz help me..?? this is the the code i used to open the file: public static Application Open(string fileName) { object fileNameAsObject = (object)fileName; Application wordApplication; try { wordApp...

Help with GDI+ interop in .Net

I'm using some code to enable me to render rotated text with the TextRenderer.DrawText method. (By default, DrawText can only copy a straight forward x and y transform from a graphics object). The code (C#) is from: connect.microsoft.com. See below for a VB conversion. The code takes a graphics object, creates a device context and copi...