interop

Problem with hanging interop COM objects

二次信任 提交于 2019-12-05 05:43:03
I have an application that uses COM interop to create a spreadsheet which is opened in Excel on the client's machine. It appears, however, that the EXCEL.exe process isn't always ended when Excel is closed by the user if I look at Task Manager. If I was saving the workbook and programmatically closing Excel, I would just use Marshal.ReleaseComObject() to clean up, but since I'm depending on a manual close of the program, I'm not sure what to do. Any suggestions? Excel cannot terminate until all its out-of-process objects are released. So it just hides its user interface and keeps running.

calling .NET COM object from VBScript

て烟熏妆下的殇ゞ 提交于 2019-12-05 05:38:41
I use VS 2008 and Windows 7. Got a .NET C# class which is exposed as COM object. [Guid("E5014B85-FCB2-4F0D-95EC-F741395A7923")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DSystem { [DispId(1610809354)] void setProperties(IDictionary propertymap); } COM object is called from a VBScript dim dSystem set dSystem = CreateObject("MYCOMOBJECT") Dim objDictionary Set objDictionary = CreateObject("System.Collections.Hashtable") objDictionary.Add "PROP1", "abc" objDictionary.Add "PROP2", "zyx" dSystem.setProperties(objDictionary) Everything works fine ... but, a return type

Can't access variable in C++ DLL from a C app

自作多情 提交于 2019-12-05 04:49:10
I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put extern "C" _declspec(dllexport) char* MyNewVariable = 0; which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the variable so that I can access it in a C source file. I have tried various things, including _declspec(dllimport) char* MyNewVariable; but that just gives me a linker error: unresolved external symbol "__declspec(dllimport) char * MyNewVariable" (__imp_?MyNewVariable@@3PADA) extern "C"

Is it possible to host a Microsoft Access form inside a .Net Windows form?

ぐ巨炮叔叔 提交于 2019-12-05 03:47:27
I am asking if it is possible to host a Microsoft Access form inside a .Net form. No I haven't gone mad, we are maintaining a massive system written entirely in VBA by somebody who didn't know a lot of VBA attempting to use Microsoft Access as an IDE. It's basically thousands of lines of spaghetti code and while we would love to scrap it and start from scratch, this is not an option. We are therefore trying to improve what is there, and in this particular scenario it would be really helpful if we could somehow host the Microsoft Access forms inside a .Net Windows Form as we can interact with

How do I call this c function in c# (unmarshalling return struct)?

人走茶凉 提交于 2019-12-05 02:59:32
I want to use c# interop to call a function from a dll written in c. I have the header files. Take a look at this: enum CTMBeginTransactionError { CTM_BEGIN_TRX_SUCCESS = 0, CTM_BEGIN_TRX_ERROR_ALREADY_IN_PROGRESS, CTM_BEGIN_TRX_ERROR_NOT_CONNECTED }; #pragma pack(push) #pragma pack(1) struct CTMBeginTransactionResult { char * szTransactionID; enum CTMBeginTransactionError error; }; struct CTMBeginTransactionResult ctm_begin_customer_transaction(const char * szTransactionID); How do I call ctm_begin_customer_transaction from c#. The const char * mapps well to string, but despite various

(object[,])range.get_Value(XL.XlRangeValueDataType.xlRangeValueDefault) causes a conversion error

天涯浪子 提交于 2019-12-05 02:29:37
问题 Error: Cannot convert type 'string' to 'object[*,*]' That's the error I have been getting. Can someone give me some pointers so that I can avoid it? Thanks. Note: Interestingly, (object[,])range.get_Value(XL.XlRangeValueDataType.xlRangeValueDefault) will only produce this bug when range.Count == 1 . It works fine when count is equal to and above 2. sample code: object[,] arrValue; //global variable private string[] createFormulaCollection() { ArrayList s = new ArrayList(); try { //look at the

Import WinAPI Function in *.VBS File

自作多情 提交于 2019-12-05 02:21:49
Using visual basic in say Excel, I am able to declare WinAPI functions using the DECLARE keyword - e.g. Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" ( _ ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String ) As Boolean However when using this syntax in a *.VBS file - it fails with a compile error. Can anyone tell me what I need to do to run WinAPI functions from *.VBS files? You can't run WinAPI functions from VBScript without some extra third-party support. I believe there used to be vendor of a COM component which allowed VBScript to call into a

How to call a C++ function with a struct pointer parameter from C#?

寵の児 提交于 2019-12-05 02:09:56
Okay one more function that it's not yet working. I am basically calling some C++ functions from C# by using P/Invoke. The problematic function does query a show laser device for some device related information, such as minimal and maximal scan rates and maximal points per second. The problematic function is: int GetDeviceInfo(DWORD deviceIndex, DeviceInfo* pDeviceInfo); Here's the C++ header file that I was given. That's a link to the very brief C++ SDK description . I don't have the sources to rebuild the DLL file and I also don't have the *.pdb file (the manufacturer can not supply it):

How would a php or java client authenticate if I'm using WCF w/ forms auth?

Deadly 提交于 2019-12-05 02:07:45
问题 I have a generic proof of concept WCF service that is using forms authentication to secure access. All works great when my client is .NET (vb code below) Dim client As SupplierServiceClient = New SupplierServiceClient() client.ClientCredentials.UserName.UserName = "xxxx@xxx.xx.xx" client.ClientCredentials.UserName.Password = "password" Dim SupplierList As List(Of Supplier) = client.GetSuppliers() but as I want this to interop w/ anyone who can do SOAP 1.1/1.2 - how would a PHP or Java client

Where can I find Microsoft.Office.Interop.Word.dll (2010)?

不羁岁月 提交于 2019-12-05 01:58:45
I got the sources of a .NET project that I am trying to compile. Although, the project uses the reference (namespace) Microsoft.Office.Interop.Word from Office 2010 that I cannot find anywhere. I was able to download the file microsoft.office.interop.word.dll but apparently the one from Office 2007 since it still doesn't compile because the project uses the function Document.SaveAs2 (which is from Office 2010 library). I have Office 2007 on my computer and Visual Studio 2012 Express for Desktop. Could you please explain me how this works? How come was I able to download the dll but I cannot