interop

Use a .OCX Control in Java

喜欢而已 提交于 2019-12-04 19:12:08
IS there a way to use a ocx control ( VB6) from Java? Here are some links of Java/COM bridges. http://sourceforge.net/projects/jacob-project/ http://javacombridge.com/ http://sourceforge.net/projects/j-interop/ http://java2com.com/ http://j-integra.intrinsyc.com/ The last one has a lot of samples using their bridge, you might be able to either use their product or get ideas on how to do the Java part if you are going to roll your own. You can also wrap your own using JNI. The only approach I know of is through JNI, which is a bumpy road. Commercial offerings like http://www.ezjcom.com/ provide

what's wrong in my code related to COM?

不羁的心 提交于 2019-12-04 19:09:15
*****BLOCK_1**** if( strcmpi(appName.c_str(),MSSQL)==0 ||strcmpi(appName.c_str(),MSSQL2005)==0 ) { if (FAILED(CoCreateInstance (CLSID_SQLDMOServer, NULL, CLSCTX_INPROC_SERVER, IID_ISQLDMOServer, (LPVOID*)&m_pSQLServer))) { DMOAvailable=false; IDiscoverPtr pICalc; HRESULT hRes=CoCreateInstance(Test::CLSID_SqlClass, NULL, CLSCTX_INPROC_SERVER,Test::IID_IDiscover, reinterpret_cast<void**> (&pICalc)); if(FAILED(hRes)) { cout << "CoCreateInstance Failed on CLSID_SQLDMOServer\n"; return FALSE; } ***BLOCK_2*** if((strcmpi(appName.c_str(),MSSQL2008)==0 || strcmpi(appName.c_str(),MSSQL2005)==0 ) &&

How to pin a pointer to managed object in C#?

北慕城南 提交于 2019-12-04 18:52:43
问题 Unmanaged code calls my functions. In first function I should pass back pointer to my managed object. Sometimes later some of my other functions get called with that same pointer as one of parameters . I should dereference it and use it to perform some calculations and then if it is not needed dispose of it. To cut the story short I need to pin that object so that GC won't move it til I dispose of it. How to do that in C# ? Thanks in advance. 回答1: To pin an object in C#, you can use GCHandle

From VB6 to .net via COM and Remoting…What a mess!

若如初见. 提交于 2019-12-04 18:50:01
I have some legacy vb6 applications that need to talk to my .Net engine application. The engine provides an interface that can be connected to via .net Remoting. Now I have a stub class library that wraps all of the types that the interface exposes. The purpose of this stub is to translate my .net types into COM-friendly types. When I run this class library as a console application, it is able to connect to the engine, call various methods, and successfully return the wrapped types. The next step in the chain is to allow my VB6 application to call this COM enabled stub. This works fine for my

Accessing .NET Collection in VB6

放肆的年华 提交于 2019-12-04 18:47:19
I have a .NET assembly that has routines that need to be called from a VB6 dll. The .NET assembly's routines, for other .NET code will return Lists of objects. However that won't work for VB6. So I am using Interop to create a "vb6 class" that will return the data needed. I had read that the VB.NET Collection is compatible with the VB6 Collection, but I've found that to be untrue. My simple test consists of: .NET Code: <ClassInterface(ClassInterfaceType.AutoDual)> _ Public Class MyCOMClass Public Function TestMe() As Microsoft.VisualBasic.Collection Dim ret As New Microsoft.VisualBasic

C# to C++ process with WM_COPYDATA passing struct with strings

倖福魔咒の 提交于 2019-12-04 18:39:30
问题 From a c# program I want to use WM_COPYDATA with SendMessage to communicate with a legacy c++/cli MFC application. I want to pass a managed struct containing string objects. I can find the handle to the c++ application for use with SendMessage fine. The bit I don't know about is how the struct and it's strings can be marshalled and read at the other end. Especially as it contains non-blittables. Do people think this is feasible? I'll continue to work on it, but would apprecite someone who's

C# How do you get an instance of a COM interface

和自甴很熟 提交于 2019-12-04 17:18:19
I've been doing quite a bit of googling trying to find the standard way to get an instance of a COM interface. Microsoft provides an example of this in their article COM Interop Part 1: Client Tutorial : // Create an instance of a COM coclass: FilgraphManager graphManager = new FilgraphManager(); // See if it supports the IMediaControl COM interface. // Note that this will throw a System.InvalidCastException if // the cast fails. This is equivalent to QueryInterface for // COM objects: IMediaControl mc = (IMediaControl) graphManager; // Now you call a method on a COM interface: mc.Run();

What is the difference between AxInterop and Interop?

 ̄綄美尐妖づ 提交于 2019-12-04 16:58:13
问题 I've added an .ocx to the toolbox in VS. Two .dll's were created: Interop.NNN.dll, AxInterop.NNN.dll. What is each one? Are they both required? 回答1: The AxFoo.dll assembly contains an automatically generated class that's derived from the System.Windows.Forms.AxHost control. It is pretty simple, it has methods, properties and events, the same ones you have available in the .ocx, that simply call the Foo.dll interop library. So, yes, you definitely need to deploy both assemblies. 回答2: Interop

Why am I getting an Out of Memory Error doing ASP .NET Excel Interop?

徘徊边缘 提交于 2019-12-04 16:47:34
This was working..and I moved the disposal code to the finally block, and now it fails every time. I have a test spreadsheet with 4 records, 6 columns long. Here is the code I'm using to bring it in. This is ASP .Net 3.5 on IIS 5 (my pc) and on IIS 6 (web server). It blows up on the line right before the catch: "values = (object[,])range.Value2;" with the following error: 11/2/2009 8:47:43 AM :: Not enough storage is available to complete this operation. (Exception from HRESULT: 0x8007000E (E_OUTOFMEMORY)) Any ideas? Suggestions? I got most of this code off codeproject, so I have no idea if

Java ANSI X923 Padding

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 16:45:44
I have a new application written in java that needs to read encrypted values out of a db. The problem is that all the values in the db were encrypted by .NET code that uses the ANSI x923 padding scheme. I have done some research and it doesn't look like the Java TripleDes libraries have a way to specify this padding scheme. I was wondering if anyone knows if I am correct and the ANSI x923 isn't supported in java, or if there is a way to get this working. If you use Bouncy Castle JCE, it supports X923 padding. You can get cipher like this (assuming you use CBC mode), cipher = Cipher.getInstance