dllimport

How to bring external application window on top? [duplicate]

别等时光非礼了梦想. 提交于 2019-12-11 09:25:40
问题 This question already has an answer here : Check process is running, then switch to it? (1 answer) Closed 2 years ago . I have Outlook express always on top and Google chrome behind Outlook. How to bring running Google chrome on top of OutLook express using visual basic? Following opens a new application but i want existing Google chrome to bring on top? Shell("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", AppWinStyle.MaximizedFocus) EDIT: Public Class Form1 Declare Auto

How to provide custom implementation for extern methods in .NET?

半世苍凉 提交于 2019-12-11 09:06:37
问题 In C# the extern modifier is used to declare a method that is implemented externally. Usually it is used with DllImport attribute to call some function in unmanaged code. I wonder if there is a way to provide custom implementation of extern method? To understand better the problem consider the following use case. I have a set of functions implemented in unmanaged code and I'd like to supply pointers to these function in run-time (during the loading of assembly). The same thing DllImport

Under what conditions will you get unresolved external symbol for __declspec(dllimport)?

℡╲_俬逩灬. 提交于 2019-12-11 07:37:51
问题 I am converting an application to use .dlls and I'm riddled with linker errors stating unersolved external symbol"__declspec(dllimport) public: void __thiscall Rail::SetNextrail(class Rail *)" There is more gibberish at the end of this error message. Why should this happen and how do you fix it? __declspec(dllimport) is being placed with a macro defined as: #ifdef LUDOAI_EXPORT #define DECLSPECAI __declspec(dllexport) #else #define DECLSPECAI __declspec(dllimport) #endif 回答1: I believe what

How to use a DLL created with C# in Delphi

允我心安 提交于 2019-12-11 07:26:27
问题 I use Delphi 2005 (yes, it's pretty old version but at the moment I that's what I have to use) and I have tried to use a DLL created with C# using Visual Studio 2017 to see if I can make it work. The idea is that as C# is much more advanced than this old Delphi I could call some methods in the DLL instead of programming those with Delphi (some of those methods are already programmed by some other people in our company). My problem is that I am not quite sure how to do this. I have understood

Unbalanced Stack Problem

◇◆丶佛笑我妖孽 提交于 2019-12-11 06:46:39
问题 Zhanks for all the help that I receifed on my "c# Problems with repeated console.writeline commands" on Friday. I found out that that all my problems are caused by a: "PInvokeStackImbalance". I use C# Express on a WIN7 64 bit machine The ftcjtag.dll that I call is a 32 bit c++ dll. I have a 64 bit version of this dll available. This dll can be downloaded at http://www.ftdichip.com/Support/SoftwareExamples/MPSSE/FTCJTAG/FTCJTAG_200.zip I just started coding c# and everything that I googled so

Suppress Console prints from imported DLL

送分小仙女□ 提交于 2019-12-11 04:19:07
问题 Inside a C# Console application, I'm importing a native C++ DLL methods. for example: [DllImport("MyDll.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] public static extern int MyMethod(IntPtr somePointer); When executed, MyMethod() is printing output to the Console, which I would like to be hidden. Assuming I can't change the DLL, how can I still suppress it's output? 回答1: Modified from http://social.msdn.microsoft.com/Forums/vstudio/en-US/31a93b8b-3289-4a7e-9acc

PInvokeStackImbalance when calling Delphi dll function

匆匆过客 提交于 2019-12-11 03:59:31
问题 A (non-COM) Delphi dll has a function being exported: function GetQuestions(Digit1, Digit2: string; CountryISO: string):string; I have added this dll as an existing item in Visual Studio 2012 and have set its Build Action to None , Copy to Output Directory to Copy Always . The class containing the DllImportAttribute : public class RefundLibrary { [DllImport("RefundLibrary.dll", EntryPoint = "GetQuestions", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] public static

Why does (incorrectly) using ref myarray[0] to pass in an array work, but only in 32bit Applications?

雨燕双飞 提交于 2019-12-11 02:38:15
问题 I did something foolish in some interop (using DllImport ) at one point, but it still worked on 32 bit machines. What is done differently (and why?) on a 64 bit application that causes Method 1 to behave differently ? Method 1 (wrong way): ref byte param //Signature of `DllImport`ed function ref myarray[0] //Parameter passed in when calling function Method 2 (right way): byte[] param //Signature of `DllImport`ed function myarray //Parameter passed in when calling function Either way, the

Process hangs pinvoking AmsiScanBuffer from managed Code

折月煮酒 提交于 2019-12-11 02:27:47
问题 I am attempting to use the AmsiScanBuffer function of the Windows Anti-Malware Service Interface from managed code, specifically C#. When attempting to call the method the program hangs on the call anytime a non-zero buffer length is provided. If a buffer length of 0 zero is provided then the method returns immediately with the HResult E_INVALIDARG. The other methods exposed by AMSI work as expected so I expect the I believe my dllimport for this function to be close but probably not

“Attempted to read or write protected memory. This is often an indication that other memory is corrupt” DllImporting C#

不问归期 提交于 2019-12-10 22:57:45
问题 I am getting this weird error while trying to marshal data to my DLL function and back to the C# code. I don't see where I am passing null or reading invalid memory and this error is so vague. Any clues?? Code below: The FeeCalculation function is exported as follows in the DLL: extern "C" __declspec(dllexport) void __stdcall FeeCalculation(char *cin, char *cout, char *flimit, char *frate, char *fwindow, char *fincrement, char *fbird, char *fparameter, char *fvalidation, char *fcoupon);