interop

Why cudaGLSetGLDevice failed, even though it's called in the first line of main function

守給你的承諾、 提交于 2019-12-20 07:08:16
问题 I want to use interoperability between OpenGL and CUDA. I know, as some tutorials said, the first step is to choose device. However, when I called the cudaGLSetGLDevice(0) in the first line of the main function, the program exited with the information "cudaSafeCall() Runtime API error 36: cannot set while device is active in this process." Actually, even though I use cudaDeviceProp and cudaChooseDevice before calling cudaGLSetDevice, the error still exists. Believe me, my computer just has

Getting IP Address using UPnP InvokeAction not returning anything, help?

流过昼夜 提交于 2019-12-20 05:50:46
问题 Basically, when i use vb.net or c#.net to do this, it works perfectly, but when i use vb6, it doesn't work, in my for loop where the relevant service in the relevant device is captured, here is the code that returns no result... ' serv is properly declared and instantiated by the for loop. Dim xins(0) Dim xouts(0) MsgBox ("Starting..." & serv.ServiceTypeIdentifier & vbCrLf & serv.id & vbCrLf & serv.LastTransportStatus) ' all this shows correctly. serv.InvokeAction "GetExternalIPAddress", xins

Check if a file is a valid SQLite database

一曲冷凌霜 提交于 2019-12-20 05:42:19
问题 I need to check whether a file (with unknown extension) is a valid SQLite database. My function works fine, but when it fails, the file is still locked after exiting the function: Public Function IsSqliteDB(ByVal uPath As String) As Boolean 'Workaround for my problem: Make a copy and work on this because this function is going to lock the file unfortunately Dim sNewPath As String sNewPath = Settings.Locations.Folder_LocalAppData_Temp & "\temp_" & Replace(Now.ToString, ":", "_") & ".db" modIO

Appending data to existing Excel file using C#

痞子三分冷 提交于 2019-12-20 04:34:34
问题 I'm fairly new with C# and I am trying to export some data from a DataGridView in C# into an Excel file. The inputs from the datagridview are filled in by the user. Currently, my program can create an excel file along with the values from the datagridview with the given date as its file name. My problem is I can't seem to find a way to append the data from the gridview IF the excel file already exists, it overwrites the current excel file instead. Any help/tips/suggestion is highly

How do you call a Scala singleton method from Java?

﹥>﹥吖頭↗ 提交于 2019-12-20 04:24:28
问题 I'm trying to inject some Scala code into my existing Java app. (So, being said, I want some more fun). I create a singleton stuff in Scala ScalaPower.scala package org.fun class ScalaPower object ScalaPower{ def showMyPower(time:Int) = { (0 to time-1).mkString(", ") } } Now, inside OldJava.java class OldJava { public void demo(){ System.out.println(?) } } What should I fill in ? so that Java will call the showMyPower method? I tried both org.fun.ScalaPower.showMyPower(10) and org.fun

Simple Interop Test; Stack Unbalanced by a simple call

a 夏天 提交于 2019-12-20 04:23:46
问题 I am currently looking into an interop related issue and have written a small test program in order to help me figure out what is going on (the issue in question involves a call into a more complicated native function and would be difficult to post here). Anyways, I have a very simple native dll which includes only the following code: extern "C" __declspec(dllexport) void Foo( int* arr, int size ); void Foo( int* arr, int size ) { for( int i = 0; i < size; ++i ) { *arr++ = i; } } I am calling

Powerpoint issue when quitting

蹲街弑〆低调 提交于 2019-12-20 04:06:25
问题 I have some c# code which opens a Powerpoint slide, refreshes the graphs, and then quits. This works fine, unless the user already has a Powerpoint slide open, in which case it will close down their existing session (losing any changes they may have made!) once the exe has run. So, the issue is if you have PPT’s open in the background, run my EXE which runs the below code (opening up a template, refreshing some graphs, saving and closing), upon application exit it disposes of the variable

Runtime error referencing VBA assembly from C#

自闭症网瘾萝莉.ら 提交于 2019-12-20 03:09:21
问题 I have a C# .NET 3.5 project that unfortunately relies on a couple of VB6 ActiveX controls. Up until now I have been able to happily access the data containers and methods defined in the ActiveX controls by simply adding a reference to the controls in my project and referencing them as normal. However I hit a snag today when I had to call a method that returns a VBA.Collection. My code will compile with no problem, but at runtime I get the following error: Could not load file or assembly

Call a C# method/function from a C++ DLL (which is loaded from C# with “Dllimport”)

你离开我真会死。 提交于 2019-12-20 03:03:25
问题 It's a little hard to resume it in a single title, so here my situation. I'm building a C# application that loads a C++ library. I call functions from that C++ DLL. But I'd also like my C++ DLL to call functions from the C# application (that is importing/running it)... Here a piece of code to make it a little more comprehensive : // I'm importing functions from my native code [DllImport(dllFilePath, CallingConvention = CallingConvention.Cdecl)] public static extern int returnIntValue(int

Is there a way to programmatically add a digital signature to a VBA Macro in a word document?

爱⌒轻易说出口 提交于 2019-12-20 02:42:17
问题 Is there a way to programmatically add a digital signature to a VBA Macro in a word document using C# or VB.Net? There are some similar questions asked already; however, none that I could find answer my question: How to programmatically remove the digital signature from VBA macros in Excel? Digital Signature for Excel Macro 回答1: Unfortunately, there isn't an automation API for this in the VBA environment. I got it working 100% unattended (so I could use it in automated builds) by P/Invoking