I have a question related to managing OLE objects in a RichTextBox.
What I've found so far is lots of info, but not exactly what I need, so I will make a quick introduction first (I also hope someone might find this helpful).
1. What I know so far
First of all, I am using OLE to insert images (or any ActiveX) into the RichTextBox. Thi...
I have some VB code which makes use of a COM api and results in a certain dialog box popping up on the screen. My program is a console application, that needs to run in a batch file, but I haven't found any other way to do things other than finding a way to automatically manipulate the dialog box.
Here is the api call (omitting setup co...
I am using SendInput to send some keyboard commands to a dialog box. It is already the active foreground window when I call SendInput.
I first send "Return" and then a bunch of other stuff. The dialog box opens with a button selected by default, and when manually selecting Enter, the button is clicked on the dialog progresses to the ne...
I keep getting DllNotFoundExceptions when trying to call my native library from C# (using Mono). I have a native library, for which I'm adding bindings.
This is what I'm seeing:
$ grep DllImport generated/NativeLibrawLoader.cs | head -n 1
[DllImport("libfspotraw.dll")]
$ cat libfspotraw-sharp.dll.config
<configuration>
<dllmap dll...
Hi,
I am new to C# and visual studio. I have a C# GUI that passes parameters to functions exported from a C++ DLL. The platform in Visual Studio 2005.
I have a function in the c++ DLL that take parameters of the following types:
UINT8
UINT16
LPCWSTR
someword (the following has been defined in the c+= dll : typedef void* someword..so ba...
This happens sometimes with Windows XP installations. Unless the display drivers are installed, power saving actions such as standby and hibernate are not supported.
Whether the system supports hibernate can be checked - http://pinvoke.net/default.aspx/powrprof/IsPwrHibernateAllowed.html
Is there something similar for checking standby ...
In a .Net application that flashes the title bar and the corresponding taskbar button for a window, to attract the users' attention, P/Invoke code something like this is used:
[DllImport("user32.dll")]
private static extern bool FlashWindow(IntPtr hwnd, bool bInvert);
public static void FlashWindow(System.Windows.Forms.Form window)
{
...
I have a C++ DLL that interacts with a card reader. It requires a pointer to a data struct, which isn't a problem to do. However, when trying to interact with the DLL in C# I'm getting all kinds of problems. Errors writing to protected memory, the application just shutting down after executing the getData command, etc. Here's what we...
BACKGROUND
I need to write a tool using .NET version 2.0 at highest (using something off the shelf is not an option for this client for political, commercial, and confidentiality/trust reasons) to migrate files from one server to another over the network. The servers are file servers for local teams, and certain team folders need to be ...
I have the following C++ structs
struct InnerStruct
{
int A;
int B;
};
struct OuterStruct
{
int numberStructs;
InnerStruct* innerStructs;
};
And a C++ function
OuterStruct getStructs();
How can I marshal this to C#? Where the C# definitions is
struct OuterStruct {
InnerStruct[] innerStructs;
};
...
What is the best way to dynamically P/Invoke unmanaged code from .NET?
For example, I have a number of unmanaged DLL's with common C-style exports between them. I would like to take the path to a DLL and then P/Invoke a function based on the exported name. I would not know the DLL name until runtime.
Basically, what is the equivalent...
I have a C++ struct
struct UnmanagedStruct
{
char* s;
};
and a C# struct
struct ManagedStruct {
[MarshalAs(UnmanagedType.LPStr)]
string s;
}
the C++ library exposes
extern "C" UnmanagedStruct __declspec(dllexport) foo( char* input );
And it is imported like
[DllImport("SomeDLL.dll", CharSet = CharSet.Ansi)]
static ex...
I have a C++ struct
struct UnmanagedStruct
{
char* s;
// Other members
};
and a C# struct
struct ManagedStruct {
[MarshalAs(UnmanagedType.LPStr)]
string s;
// Other members
}
the C++ library exposes
extern "C" UnmanagedStruct __declspec(dllexport) foo( char* input );
And it is imported like
[DllImport("SomeDLL.dl...
A confusing title I know. Let me explain.
I have to marshal an array of structs, which then get converted to an array of classes (legacy compatibility). For instance
public class InnerClass {}
public class OuterClass { private InnerClass[] innerClasses; }
public struct InnerStruct {
// Data
}
private static buildInnerClass( Inne...
Is it possible to use native Win API functions in Mono through Wine? Are there some additional libraries for interactions between Mono and Wine?
...
I have a C# program that is calling into a native C++ dll.
The C# has a the following struct:
[StructLayout(LayoutKind.Sequential)]
public struct Phenomenon
{
[MarshalAs(UnmanagedType.U1)] public char Type;
[MarshalAs(UnmanagedType.R8)] public double Jd;
[MarshalAs(UnmanagedType.R8)] public double Loc_jd;
[MarshalAs(Un...
I use in .Net version of my program three native WinApi functions through P/Invoke:
ReadConsoleOutput, WriteConsoleOutput, ReadConsoleInput.
How to implement this functionality in Mono counterpart under Linux?
I know about standart System.Console class. But this class for some strange reason does not support functionality of previously ...
I'm trying to call NtGetContextThread from C# on AMD64. The problem is that the CONTEXT structure for AMD64 needs to be aligned on a 16-byte boundary, and when I call NtGetContextThread I always get STATUS_DATATYPE_MISALIGNMENT. I'm aware that C# can align individual members of a struct using the Pack attribute, but it doesn't seem to be...
I ran into this example for locking Windows workstation:
using System.Runtime.InteropServices;
...
[DllImport("user32.dll", SetLastError = true)]
static extern bool LockWorkStation();
...
if (!LockWorkStation())
throw new Win32Exception(Marshal.GetLastWin32Error()); // or any other thing
Is there a pure managed alternative to thi...
From a Windows Service running on a Terminal Server (in global space), we would like to be able to start up a process running a windows application in a specific user's Terminal Server sessions.
How does one go about doing this?
The Scenerio: the windows service starts at boot time. After the user has logged into a Terminal Server user...