winapi

PInvoke.net is nice but where do I get good examples and information relating to usage of Win32 in .net apps?

Stuff like this and this is very nice and to some extent is representative for the information I am generally looking for. I found that using Win32 functionality in C# winform projects is possible and, when used wisely, can provide a much enhanced user experience. Sadly, information on MSDN can be scarce at best and almost never offers d...

am trying to create class to encapsulate toolbar but the background turns black. c++ win32api

i created a simple class to hide the details of creating a toolbar in win32 api but i dont like the toolbars it is producing. (See image for clarification. I dont have reputation points so i have just posted a link) http://i35.tinypic.com/1zmfeip.jpg I have no idea now the black background is coming into my application. Here is the cl...

.NET Application that uses Tessnet2 fails

Hi, I have an app that uses Tessnet2. The application fails when I try to call its Init method. The failure is just awful - no exception (ANY), no any trace of error, not even "Send report" window. The app's process is just droped. The problematic code is: Recogniser = new Tesseract(); Recogniser.SetVariable("tessedit_char_whitelist...

Watching a folder using Win32

I'm looking for a straightforward way to watch the contents of a folder using Win32 (minimum target is XP). If possible, it would be nice to use an event-driven approach rather than a polling-type approach. To complicate things, the watched folder may be a network share. I'm really only interested in capturing "new files". I don't care ...

How do I use Win32::SqlServer to connect remotely?

I have been unable to make a successful connection to my SQL Server (2005) using Win32::SqlServer. The server is located on another machine. I am using the latest version of ActivePerl and the module. Using an ADO.NET provider (in C#), I can make a successful connection with the connection string: Data Source=1.2.3.4,1553;Initial Cata...

How to programmatically program a "Wheel Scroll" using Ruby on Windows?

Is there a way to program a "Scroll wheel" turn on the Windows platform using Ruby? Kind of similar to programming a click on Windows, or a keyboard key press, but this is to program a scroll wheel turn. thanks. ...

C++ Array initialization

Hi all, the code below gives compilation error when I try to create test t[2]; because there is no default constructor for this. But if I create Test t[2] = {test(1,2), test(2,3)}; Then it works fine. 1)But think of a situation, if we want to create more then 100 array element. We need to create 100 element in the curly braces like.....

What limits my use of the stack in terms of memory?

In windows (or any other OS for that matter) what determines how much stack I can use? The name of this very website makes me assume it's possible to run out of stack so should I avoid putting large amounts of data on the stack? ...

How can I listen to Windows events from a Java app?

I have a process written in C++ that raises a named event using CreateEvent. Is there a java implementation of the WaitForSingleObject function? Is there a better way to pass events between a C++ or .NET process and a Java process? (I am aware of the option to use JNI to wrap whatever calls I want. I am looking for a library that alrea...

Implementing Win32 FileWrite

[DllImport("kernel32.dll", SetLastError=true)] public static extern unsafe bool WriteFile(IntPtr hFile, void* lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped); I am implementing this through a Write(..) method with a signature: Write(IntPtr handleFile, void* bufferData, uint length){ ...

Avoid or remove lock from StgOpenStorage()

Greets, I found a similar question at Opening OLE Compound Documents read-only with StgOpenStorage but that solution didn't work for me. I try to open an outlook .msg file with StgOpenStorage(). My problem is, that StgOpenStorage always locks my file. So, how can I avoid/remove the lock StgOpenStorage() adds to my file? (see last met...

How to change the value of DateTime.UtcNow for a Process or Thread?

Is there a way, even a very sneaky way, to change the time that a DateTime.UtcNow returns for a process or thread? The SetSystemTime() win32 API call will change the time on the entire system. I've used this before but I would like a method that is less evil to other processes running on the system. Messing with the time is bad kungfoo ...

Guidance : I want to work at Process Information level

I couldn't find a suitable title for this. I'm going to express my query with examples. Consider following softwares: Process explorer from sysinternals (an advanced task manager) Resource Manager : resmon.exe (lists each and every fine detail about resource usage about each process). For me these softwares seems like miracles. I wo...

Access is Denied for registry

I am playing with the registry programmatically for the first time, and it's not working that well (but at least I haven't destroyed my computer). Specifically, I keep getting back Error 5 (Access is Denied) from RegCreateKeyEx and RegSetValueEx. The thing that is strangest to me is that when HKEY_CURRENT_USER\Software\dir1\Sub Directory...

LookupAccountName fails on vista with ERROR_NONE_MAPPED

Hi, I'm trying to call LookupAccountName on Vista - it always fails with the error ERROR_NONE_MAPPED. What could be the reason?? Thanks!! ...

Usage frequency of windows application

I have a homepage need to count the usage frequency of Notepad or Calc application. Is there any Windows API that I can know the usage frequency of windows application? ...

Visual Studio switches from disassembler to source each time I step

On one of my two computers I see following behaviour: Each time I press F10 (Step over) or F11 (Step Into) in the disassembler window, the focus is switched to the source view, resulting in next F10 / F11 done on the source level unless I switch focus back. Can anyone recommend me what settings to inspect, or what to try to stay in the...

CWnd::CreateDlgIndirect leaves m_hWnd==NULL

A dialog I'm working on isn't displaying, using: CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,CWnd* pParentWnd, HINSTANCE hInst) The call to CreateDlgIndirect is in a lon-used base-class, which effectively takes the IDD of the dialog template in the resource file - it works fine for many other dialogs but I can't see what's...

Does a Win32 control's control ID change with each run?

In other words, can I count on a control ID as a reliable identifier? From some reading I've done, it sounds like .NET controls can have control IDs that change with every run, is this so for Win32 apps as well, or are they something that's hardcoded in the source? The window/control in question is actually an Internet Explorer dialog ...

How to get the window handle of the desktop

The Windows API provides an API GetDesktopWindow( ) which returns the window handle But I tested with Spy++ and I find that the window handle of the desktop and the window handle of the "Windows Desktop" is not the same. As the "Windows Desktop" is a list view, do I need to do the following 1) HANDLE hWnd = GetDesktopWindow() ; 2) ...