interop

WinMM Library Issues

一笑奈何 提交于 2020-01-03 05:41:08
问题 I wrote a WinMM library wrapper library that exposes WaveOut and WaveIn classes for the purpose of recording and playing raw audio streams. Everything works great, but in order to follow the operating system specs on how to handle the finished buffers, I added a thread that unprepares the buffers and frees the memory. I also got all of the synchronization down, so that the classes are solid and thread-safe. However, there seems to be a rare issue where I add a buffer to the WaveOut device and

How to open a file when file handle number is known?

試著忘記壹切 提交于 2020-01-03 05:19:35
问题 I open a file in C# with FileStream, and I got the file handle number with this line: IntPtr file_handle = fs.SafeFileHandle.DangerousGetHandle(); Now I want to pass this handle to C++ code and use this handle value to access the file. Is this possible? How to open a file with merely a file handle in C++? Thanks. Update I use C# to P/Invoke into a C++ Win32 DLL(not a COM DLL). I open the file in C# as FileStream, and pass the handle to the C++. Here is some of my code in the C++ DLL: extern

How do I use a COM component from VB.NET?

ⅰ亾dé卋堺 提交于 2020-01-03 05:11:11
问题 How do I access a COM component from an ASP.NET page. I added reference to my ASP.NET project. The actual dll I got from the 3rd party is ePadIIu.dll but when I added it to the ASP.NET project it shows as ePadIIu.interop . I want to access all the methods and properties in the component. The sample I received from the 3rd party software uses vbscript to access all the methods. How do I use those methods in the code behind from default.aspx.vb . 回答1: When you added the reference to the COM

VB6 Automation Error on Calls to .NET 3.5 Assemblies After the First Calls

。_饼干妹妹 提交于 2020-01-03 05:04:18
问题 Some of the sources I've checked already: http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23359339.html http://mygreenpaste.blogspot.com/2006/03/net-framework-20-configuration-tool.html http://support.microsoft.com/kb/186063 I'm busy developing .NET modules that will hook into our existing VB6 code. I've created a test VB6 project from which to launch the new code which comprises of a form with a button, and on the button's click event is Dim launcher As New

JAX WS with com.sun.net.HttpServer and .net

…衆ロ難τιáo~ 提交于 2020-01-03 04:49:06
问题 I have a very frustrating problem. I have a web service created with JAX WS annotations and Endpoint.publish(...) trick. Of course, it uses com.sun.net.HttpServer. When I try to add a service reference in Visual studio, it won't budge. The server says: unsupportent content-type: accepted only text/xml But .net asks with application/soap+xml content-type. How do i change the content-type in jax ws? Or, how do i change the content type of visual studio add reference thingy. Thank you. It's very

array<Byte>^ TO unsigned char* :: Marshall class - Interop Issue

这一生的挚爱 提交于 2020-01-03 03:37:17
问题 I wanted to convert array< Byte>^ to unsigned char*. I have tried to explain what i have done. I donot know how to proceed further. Please show me the right approach. I am using MS VC 2005. //Managed array array<Byte>^ vPublicKey = vX509->GetPublicKey(); //Unmanaged array unsigned char vUnmanagedPublicKey[MAX_PUBLIC_KEY_SIZE]; ZeroMemory(vUnmanagedPublicKey,MAX_PUBLIC_KEY_SIZE); //MANAGED ARRAY to UNMANAGED ARRAY // Initialize unmanged memory to hold the array. vPublicKeySize = Marshal:

IntPtr addition

♀尐吖头ヾ 提交于 2020-01-03 03:04:13
问题 So from what I can tell, every managed example of IntPtr addition I have found is WRONG . For example: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2006/10/16/10987.aspx My thought being, that if IntPtr is at (or near) int32.MaxValue on a 32-bit system, and you add an offset which overflows int32, isn't that still a valid memory address (as it would be valid in uint32, and would be represented by a negative number in IntPtr)?! I believe the code should be something like: public

COM Interop hang freezes entire COM system. How to cancel COM call

情到浓时终转凉″ 提交于 2020-01-03 02:33:05
问题 I am using a third party dll that is exposed via a COM Interop wrapper. However, one of the COM calls often freezes (never returns at least). To try to at least make my code a little more robust, I wrapped the call asynchronously ( _getDeviceInfoWaiter is a ManualResetEvent ) var backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += (sender, eventArgs) => { var deviceInfo = _myCom.get_DeviceInfo(0); _serialNumber = deviceInfo.SerialNumber; _getDeviceInfoWaiter.Set(); };

c-fortran interoperability - derived types with pointers

ぐ巨炮叔叔 提交于 2020-01-02 15:26:30
问题 I have long fortran code that has to be made usable from python. I decided to do Fortran->C->Python interface. I got a problem: I have derived types within Fortran modules that contain double precision, allocatable type as members. When trying to compile with ifort I get (with gfortran something similar): Each component of a derived type with the BIND attribute shall be a nonpointer, nonallocatable data component with interoperable type and type parameters This is actually with agreement with

Loading all COM types of Excel dynamically?

爱⌒轻易说出口 提交于 2020-01-02 07:40:13
问题 I want to explore this path of working with Excel dynamically. I want to use Excel in my C# application without including dlls and stuff. I would just check first if the required Excel version is installed and run it. First I want to get all the types I need but I can't get hold of them: // works Type typeExcel = Type.GetTypeFromProgID("Excel.Application"); object excel = Activator.CreateInstance(typeExcel); object workbooks = typeExcel.InvokeMember("Workbooks", BindingFlags.GetProperty, null