dllimport

How do I call the DialogBox() function in the user32.dll?

耗尽温柔 提交于 2019-12-11 23:59:21
问题 I'm trying to call the WinAPI function DialogBox() . On the Microsoft website this function is specified to be in the user32.dll. However, when tried to import this function by declaring it as function to import from a dll, the linker told me it isn't there. Then I tried to find the function with the dependency walker in C:\Windows\System32\user32.dll, but the function wasn't there. (I could see all the other fancy function literals there though.) What can be reasons for that and how can I

The value of ESP was not properly saved across a function call error

心已入冬 提交于 2019-12-11 14:56:15
问题 I made a .dll file with QT and I load it in my application. When it's about to return from one function, I receive: The value of ESP was not properly saved across a function call I start with the DLL project: This is my device_manager_interface.hpp: #ifndef __DEVICE_MANAGER_INTERFACE_HPP__ #define __DEVICE_MANAGER_INTERFACE_HPP__ #include <QtCore> class DeviceManagerInterface { public: virtual BCR * getDeviceBCR() = 0 ; . . . }; QT_BEGIN_NAMESPACE Q_DECLARE_INTERFACE(DeviceManagerInterface,

DLLImport c++ functions with char* input as and output parameters

╄→尐↘猪︶ㄣ 提交于 2019-12-11 14:48:22
问题 There are a lot of articles about some specific problem using DllImport. Alas quite often I see different replies to the same question. For instance some say if a c++ function returns a a char* and an int* strLen, then some people say I should use a StringBuilder in my dllImport statement and others say return byte[], some have a marshall statement in the dllImport, some don't. Some answers seem needed because of old C# / .net versions. So the question is: If the dll call from c++ is fairly

What is the Maximum Size Of An Icon Returned From SHGetFileInfo()?

自闭症网瘾萝莉.ら 提交于 2019-12-11 14:48:19
问题 Using the SHGetFileInfo() function what is the maximum size of an icon that I can get back? As far as the function states I can get back a 32x32 pixel icon (AKA SHGFI_LARGEICON). But I was trying to figure out if there was a way to get something larger like a 48x48 pixel icon. I found that there are constants like... public const uint SHGFI_LARGEICON = 0x000000000; // get large icon public const uint SHGFI_SMALLICON = 0x000000001; // get small icon public const uint SHIL_JUMBO = 0x000000004;

WOW64 Redirection and LoadLibrary

为君一笑 提交于 2019-12-11 14:45:03
问题 I'm trying to build a 32-bit program that can run correctly on 64-bit Windows; that is, if it needs to open a text file for the user, the file needs to not be redirected from C:\Program Files to C:\Program Files (x86) . However, if I just call Wow64DisableWow64FsRedirection , then my program fails to load at all because some system libraries call LoadLibrary when portions of the GUI are loading, which tries to load a 64-bit version of a system DLL into my program. How do I solve this problem?

Problem at marshalling a standard C++ string to a C# string

假如想象 提交于 2019-12-11 13:25:32
问题 I'm writing a wrapper for a DLL that manages an OCR device. The DLL has a method whose signature resembles the following: unsigned long aMethod(char **firstParameter, char **secondParameter); aMethod returns string pointers to all parameters. I wrote this signature in C# ... it is almost functional: [DllImport(aDll.dll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] static unsafe extern ulong aMethod(ref IntPtr firstParameter, ref IntPtr secondParameter); I do the

C# - How to make a StatusStrip resize a borderless Form

▼魔方 西西 提交于 2019-12-11 10:36:53
问题 I am trying to resize a borderless form with a StatusStrip (I'm using a tool strip for many reasons). I have successfully moved a form with a MenuStrip, but never resized, so I do have a little understanding on sending messages and EventHandling. However, the StatusStrip doesn't move when clicked. Below is what I have so far. Custom StatusStrip Class: public class PassThroughStatusStrip : StatusStrip{ protected override void WndProc(ref Message m){ const int WM_NCHITTEST = 0x0084; const int

Load Bitmap file from unmanaged DLL in managed code

允我心安 提交于 2019-12-11 10:22:04
问题 I'm trying to load a image from a unmanaged resource dll and have not been able to get past a error when converting the btye array retrieved from the dll to a bitmap image. The test.dll file contains the following structure when viewed in visual studio: test.dll Bitmap +411 Icon +1002[English (United States] and when I double click the ID 411 (Bimap node) I can see the bmp file in the bitmap editor and when I double click the ID 1002 (Icon node) I can see the differnt icons in the icon editor

Unresolved external symbol

ぃ、小莉子 提交于 2019-12-11 09:52:19
问题 I have two WIN32 DLL projects in the solution, main.dll should call a function in mgn.dll. mgn.dll has mgn.h header file: #ifdef MGN_EXPORTS #define MGN_API __declspec(dllexport) #else #define MGN_API __declspec(dllimport) #endif extern "C" bool MGN_API AttachMGN(void); and mgn.cpp source file: #include "stdafx.h" #include "mgn.h" MGN_API bool AttachMGN(void) { ... } main.dll calls AttachMGN function from one of the source file: #include "stdafx.h" #include "..\mgn\mgn.h" bool CreateClient()

Load TLB at runtime in C# .net 4.0

你离开我真会死。 提交于 2019-12-11 09:33:54
问题 I have a tlb file from a third party library. There are many versions of this library, however the functions that I use within the tlb are constant i.e. do not change from one version to the next. I have added the tlb file to the project as a COM Reference. I can successfully build and call the functions from the third party library. When I deploy my application, I cannot guarantee that the user will have the same version of the third party installed on their PC as me. When this scenario