I would like to be able to hide another application's window from the taskbar, without hiding the window itself. Specifically, I want to have several different Web browsers running, visible, available in the Alt+Tab list, but not taking up space on the taskbar.
(If anyone's curious why: I've written a dashboard app that uses Vista's Dwm...
Hello,
How do I call WSAGetLastError() from WinAPI so I get the valid text error?
...
I have a piece of .NET code which I want to port to 64-bit. The codes basically is a set of P/Invoke calls to some other C dll. One of the functions in the C dll has a parameter 'size_t'. What datatype should I use in my P/Invoke signature so that the marshalling works fine. I was thinking of using a IntPtr or a UIntPtr but some say that...
I have the following C code:
const BYTE* Items[3];
Items[0] = item1;
Items[1] = item2;
Items[2] = item3;
int result = Generalize(3, Items);
with Generalize having a signature of
int __stdcall Generalize(INT count, const BYTE * const * items);
What is the best way to make that call with PInvoke?
...
How do I declare in C# a C function that returns a pointer to a structure?
I believe following is one way to do that, followed by Marshal.PtrToStructure to get actual structure value.
// C-function
SimpleStruct * Function(void);
// C# import
[DllImport("MyDll.dll")]
public static extern IntPtr Function();
Am I correct about that?
A...
How to lock the screen (most important), change the sound, lock the keyboard and etc using VB.NNET?
I know it's quite easy to do it using C++ .Net
...
This question is along the same lines as Retrieving Device Context from .NET print API...
I have a Datacard 295 embosser / mag stripe encoder. In order to write to the Mag Stripe or Embosser wheel, you must write your text in a special "pseudo-font", which the printer driver will recognize and handle appropriately. There are multiple ...
I have a c++ dll which exposes the following function
long func(struct name * myname)
{
strcpy(myname->firstname,"rakesh");
strcpy(myname->lastname,"agarwal");
return S_OK;
}
struct name
{
char firstname[100];
char lastname[100];
}
I want to call this function from a C# application , so I do the following :
[S...
I have a function in unmanaged C/C++ code (dll) that returns a structure containing a char array. I created C# struct to receive this return value uppon calling the function. And uppon calling this function i get 'System.Runtime.InteropServices.MarshalDirectiveException'
This is C declaration:
typedef struct T_SAMPLE_STRUCT {
int num;
...
I'm working on a PInvoke wrapper for a library that does not support Unicode strings, but does support multi-byte ANSI strings. While investigating FxCop reports on the library, I noticed that the string marshaling being used had some interesting side effects. The PInvoke method was using "best fit" mapping to create a single-byte ANSI...
** MAJOR UPDATE **
I made a minor mistake but I'm still curious about exactly what is happening.
The function I am calling is actually "fooV", a function with this signature:
foo(const char *, const char *, EnumType, va_list)
This clears up the AccessViolationExceptions I was getting, but doesn't explain why params parameters work fo...
I am trying to pass a structure from C# into C++ library. I pass structure as an object, and C++ function expects it as a pointer (void *).
I am having problem passing the structure.
[DllImport("MockVadavLib.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr TheFunction([MarshalAs(UnmanagedType.LPStruct)] UserRec userRec);
...
Good afternoon,
i am currently wrestling with an old .dll which functionality I have to re-use in a .Net application & I came so far to import the basic/easy functions/methods that return bool etc, but some do in fact also expect (or return) an type that is declared within the .dll.
How would I handle this? How would I map/create that ...
Hey all,
I'm trying to call the HtmlTidy library dll from C#. There's a few examples floating around on the net but nothing definitive... and I'm having no end of trouble. I'm pretty certain the problem is with the p/invoke declaration... but danged if I know where I'm going wrong.
I got the libtidy.dll from http://www.paehl.com/open_s...
Recently I tried to use p/invoke in mono (.NET for Linux platform) to write a simple OpenGL application to find out how it works on C# (I've already sucessfully done it on windows). I heard about the tao framework, but I don't want everything for a simple "hello world" like program.
I just stucked at the start. I p/invoked some GL funct...
Due to a limitation in the .NET EventLog class, I have some code using PInvoke that logs to the Application log. The code works without a problem.
But now, I'd like to log to a custom event log. So, I tried changing the 2nd parameter of the RegisterEventSource to "companyX" (my custom log). It correctly wrote to "companyX" (instead of t...
I am about to begin reading tons of binary files, each with 1000 or more records. New files are added constantly so I'm writing a Windows service to monitor the directories and process new files as they are received. The files were created with a c++ program. I've recreated the struct definitions in c# and can read the data fine, but I'm...
I have been working on this for a few days and this is doing my head in:
Our application is built using the .NET Compact Framework 2.0 and running on Windows Mobile 5 & 6 devices.
We can set the WLAN connection of the device programmatically using the Wireless Zero Config functions (described here: msdn.microsoft.com/en-us/library/ms89...
I'd like to change the BackgroundColor of a ListViewSubItem in a ListView in Windows Mobile. I'm using the Compact Framework ListView, whose ListViewItems only allow setting the BackColor on the entire row, which I don't want.
I have two questions:
Is this possible?
If this is possible, I know I have to P/Invoke to get this to work (...
***Platform: in Vista(ultimate or home/premium) it does not work, other OS(xp, windows7) it works******
I'm emptying recycle bin using c++.net(or c#.net) inside a thread. When i do this straight (without thread) it works. But if thread used it doesn't. Please watch the code snippet below:
namespace EmptyRecycleBin_C{
enum RecycleFlags
...