1
голосов
1ответов
3308 просмотров

How to replace FileName in SaveFileDialog.FileOk event handler

I'd like to change the file name of the SaveFileDialog in the event handler attached to the FileOk event, in order to replace the file name typed in by the user with another file name in some cases, while keeping the dialog open: var dialog = new SaveFileDialog(); ... dialog.FileOk += delega...

8
голосов
6ответов
740 просмотров

Is there a more painless way to call Win32 from C#?

Every few months I find myself needing to call Win32 from C#. Though I've done it a dozen times, I've usually forgotten the exact machinations, so I poke around the web or old code and figure out what DllImport statements I need, etc. Am I alone? Is there a sanctioned "Win32" class that has the...

3
голосов
1ответов
1044 просмотров

Send Authenticated User To WCF Application

I have 2 applications; one is a ASP.NET 3.5 Ajax Application (Client) and the other is a WCF Web Application (BackEnd). The applications are deployed in a separate Windows Server 2008 over IIS 7. The backend application has the net.tcp and http bindings enabled; some services are exposed under ...

2
голосов
1ответов
252 просмотров

What is the AppDomainSetup.SandboxInterop Property for?

I am using reading the documentation for app domains in .net 3.5 and came across SandboxInterop. The docs says Gets or sets a value that indicates whether interface caching is disabled for interop calls in the application domain, so that a QueryInterface is performed on each call. But why woul...

10
голосов
9ответов
32330 просмотров

Position cursor at start/end of Word document

We are manipulating our Word 2007 documents from .Net using Word Interop. Mostly doing stuff with fields as in: For Each f In d.Fields f.Select() //do stuff with fields here Next This leaves the last field in the document selected. So, for the sake of neatness we would li...

4
голосов
2ответов
738 просмотров

Objective-C and C interoperability

We're going to have to write a C library and this library has to be accessible from Objective-C. Now I don't know anything about Objective-C so I wonder how simple Objective-C C interoperability is. Is that as simple as including the C header in the Objective-C code and linking to the library? I...

1
голосов
1ответов
427 просмотров

Java/C# Kerberos inter-op possible?

I have implemented a Kerberos server/client using sockets in Java, where the client sends his service-TGT to the server, and the server knows the client is authentic. My main concern is the snooping 'man-in-the-middle' attack. Someone could capture the TGT, and pretend to be the client. In...

1
голосов
2ответов
1885 просмотров

Using SetWindowTheme() on controls in WindowsFormsHost in WPF?

I have an application I'm developing which closely mirrors Windows 7's Device Stage. In Device Stage, beneath the main banner there is a ListView containing actions embodied as ListViewItems. In my WPF application, I used WindowsFormsHost to host a WinForms ListView so that I could use SetWindow...

3
голосов
1ответов
1172 просмотров

How to disable conversion message when opening Office 2007 doc using Office 2003?

I am working on a C# application which opens Excel workbooks using Interop. It works fine except for one annoyance: when opening an Excel 2007 document on a machine using Excel 2003, a small message pops up saying "File conversion in progress". Does anyone know of a way to prevent that message fr...

10
голосов
2ответов
6531 просмотров

Marshalling .NET generic types

Here is a C# program that tries Marshal.SizeOf on a few different types: using System; using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential)] class AClass { } [StructLayout(LayoutKind.Sequential)] struct AStruct { } [StructLayout(LayoutKind.Sequential)] class B { AClass ...

5
голосов
4ответов
15136 просмотров

How can I pass a pointer to an integer in C#

I have a C API with the signature: int GetBuffer(char* buffer, int* maxSize) In C, I will call it this way: char buffer[4096]; int maxSize = 4096; GetBuffer(buffer, &maxSize); maxSize is set to the buffer size, and set with the actual size filled. I need to call it from C#. How do I do...

1
голосов
2ответов
1462 просмотров

Handling a VB6 event in C# - why does it only work sometimes?

I have a VB6 application implemented as an ActiveX exe. I also have a C# application that interacts with the VB6 app via COM. This all works fine except in one scenario. If the VB6 app is kicked off from the C# app, everything is fine. If, however, the VB6 app is already running stand-alone, t...

53
голосов
2ответов
69745 просмотров

COM object that has been separated from its underlying RCW cannot be used

I am trying to use the OpcRcw.da.dll. If I interop this dll inside a test console project everything works, but if I build dll project to do my interop gymnastic and ref my library into my console project I am getting this error: COM object that has been separated from its underlying RCW can...

4
голосов
4ответов
372 просмотров

How Should an OS X Drawing Programs Store Custom Data in its PDF PasteBoard Flavor?

A little history. In the days when the pre-eminent Mac vectored clipboard flavor was PICT, a program could insert its own data into the PICT. The PICT could be pasted into another application. At some later date, the same drawing could be selected and put on the clipboard, and pasted back into th...

4
голосов
4ответов
3059 просмотров

C# - Hook into existing COM object

Say we have an existing process (or application) that calls a COM object from an ocx file such as "MyCOMLibrary.ocx". Is there a way to write a C# library to exactly replicate the ocx file? So that the original application can call your C# code rather than the original COM object? You would, o...

0
голосов
3ответов
3465 просмотров

Formatting Excel cell with Microsoft Interop

I generate some Excel file with Microsoft Interop, no problem, I can create files, sheet, file, password protect. But I'd like : for a specific range allow only numbers for an another specific range allow only numbers but only 0 or 1 Do you have an idea how to do this ? Thanks,

9
голосов
4ответов
10291 просмотров

.NET and Lotus Notes Interop

I've Lotus Notes database file (.nsf) at some location, let's say: http://intranet.mycompany.com/somewhere/data.nsf Is it possible in any way to read from that location using any .NET language?

1
голосов
4ответов
608 просмотров

How to add SAN storage support to your application?

I want to add San Storage support in my application. Is there a standard protocol that I can use to communicate with all san storage devices like EMC Centera, Hitachi, NetApp or do I have to use library specific to each vendor? In a nutshell i'd like to save data on device and read it back. I kn...

1
голосов
2ответов
1391 просмотров

Handling a SAFEARRAY returned from C# server

I need to return an array of structure (classes) from a C# library to an unmanaged C++ client. This is the function in the C# library: [ComVisible(true)] [Serializable] public sealed class RetrieverProxy : IRetrieverProxy { public IMyRecord[] RetrieveMyRecords(long[] ids) { IList...

1
голосов
1ответов
1512 просмотров

Log4net .Does it work in vb6 Interop to .net?

I have some legacy application in vb6 and I am interoping into .net It all works fine in net alone but in vb6 it does not create the log. I cannot see what I am doing wrong. I have using log4net using config file and I have added the log4net configsection into C:\Program Files\Microsoft Visual ...

2
голосов
3ответов
1236 просмотров

Writing a float value to unmanaged memory?

I'm building a .NET client and I referenced a RCW supplied by OPC Foundation. One of the functions has this parameter: [IN] IntPtr pPercentDeadBand The documentation mention that I should pass a pointer to a float value. This is where I struggle. I found Marshall..WriteByte, .WriteInt16 and ...

4
голосов
1ответов
2402 просмотров

.NET 3.5 ActiveX dll InteropServices.COMException

Using vs2008 .NET 3.5 SP1 I am trying to use an ActiveX dll in my c# console application project and I am getting this runtime exception: System.Runtime.InteropServices.COMException (0x800702E4): Retrieving the COM class factory for component with CLSID {4E58088E-7275-4EAA-8958-A9CCC971DDE9} fa...

1
голосов
1ответов
2993 просмотров

How to marshal .NET string to variant for COM call

I'm using a third-party COM library from C#. There are get/set methods that take a parameter of type VARIANT (type VT_BSTR). In the .NET wrapper, these parameters appear as type object, i.e. object getValue(); void setValue( object val ); The getValue method works ok, I perform a simple cast ...

0
голосов
2ответов
457 просмотров

How to make C++ code draw on Java components

We are designing physics app, and we would like to have it written in Java, and also we want to use root (root is writen in C++). Root has some nice graphical features -- it is able to draw very nice 3D charts, and I'm thinking whether it's possible to embedd those charts in Java app. Is there ...

3
голосов
9ответов
511 просмотров

Fast (in means of developer time) way to use a lot of C++ code from Java

Background: We are designing a physics app, that will do a lot of data analysis, but our focus is integrating physical electronic equipement. Basically I would like to be able to call root (it's a big data analysis library from CERN written in C++) library written in C++ library from Java. Bas...

0
голосов
2ответов
514 просмотров

.NET CF, Interop & GPS_DEVICE structure

I am trying to use the GPS_DEVICE structure from within .NET CF 3.5 and I keep getting an error (87) returned from the call to GPSGetDeviceState. As far as I know, 87 means invalid parameter, but I do not know which parameter is invalid! Can anybody please advise to what I have done wrong with m...

2
голосов
2ответов
3175 просмотров

How to Pass an Array from C# (VSTO) project to VBA Macro

I'm having performance issues with my VSTO solution, I believe the reason is mainly the way the cellColor is set cell by cell. This depends on data from a recordSet and is thus different everytime. (I can't use a copyFormats from another row/column) it's similar to filling a Range of values, on...

3
голосов
2ответов
1532 просмотров

Absolute COM Confusion - C# interop with early-binding

I've been battling with VStudio, Google and various other tools and websites all day and found no solution - HELP!! I have two COM interfaces (pure COM, no ATL): IMyClassFactory and IMyClass with corresponding implementations I want to use them from C# BUT without registering the COM server wi...

10
голосов
6ответов
23345 просмотров

How can I write to an Excel spreadsheet using Linq?

I'm writing an app where I need to retrieve some rows from a DB and dump them into an Excel spreadsheet. I'm using Linq to retrieve these rows. Is it possible to dump these rows directly into their counterparts in the Excel sheet (where one cell in Excel corresponds to one cell from the DB)?

1
голосов
1ответов
578 просмотров

Avoid loading .Net Dlls in a C++/CLI project?

I have a project written in C++/CLI. Some of the types there are in managed code, and some are in completely native code. Let's say I have the produced DLL on a machine that dosen't have any version of the .Net framework installed, is there a way that another, native application will link with my...