winapi

Outlook + Perl + Win32::Ole: How do you select calendar entries sorted by date?

Current code opens up an Outlook Calendar database as follow: my $outlook = Win32::OLE->GetActiveObject('Outlook.Application') || Win32::OLE->new('Outlook.Application', 'Quit'); my $namespace = $outlook->GetNamespace("MAPI"); ## only fetch entries from Jan 1, 2007 onwards my $restrictDates = "[Start] >= '01/01/2007'"; ...

Frameworks simplify coding at the cost of speed and obfuscation of the OS. With the passing of Moore's law do you thing that there might be a shift away from Frameworks?

Frameworks simplify coding at the cost of speed and obfuscation of the OS. With the passing of Moore's law do you thing that there might be a shift away from Frameworks? I suspect that one of the reasons for Vista not being an outstanding success was that it ran much slower than XP, and, because computers had not improved as greatly i...

Why can't I single-step Clipboard-code within the VS.NET debugger ?

Ideally the reader has upgraded a native C++ program to Visual Studio 2008, which contains an OpenClipboard() block. Why not try setting a breakpoint just after getting a successful return-code from OpenClipboard() and step through your code. According to the Internet it may work on your system, but of course, not on mine, thanks for t...

Cleanest way to stop a process on Win32 ?

While implementing an applicative server and its client-side libraries in C++, I am having trouble finding a clean and reliable way to stop client processes on server shutdown on Windows. Assuming the server and its clients run under the same user, the requirements are: the solution should work in the following cases: clients may...

Consequences of changing USERPostMessageLimit

One of our legacy applications relies heavily on PostThreadMessage() for inter-thread communication, so we increased USERPostMessageLimit in the registry (way) beyond the normal 10.000. However, documentation on MSDN states that "This limit should be sufficiently large. If your application exceeds the limit, it should be redesigned to a...

How to implement in-process full text search engine

In one of our commercial applications (Win32, written in Delphi) we'd like to implement full text search. The application is storing user data in some kind of binary format that is not directly recognizable as a text. Ideally, I'd like to find either an in-process solution (DLL would be OK) or a local server that I could access via TCP ...

Sleep Less Than One Millisecond

On windows you have a problem you typically never encounter on Unix. That is how to get a thread to sleep for less than one millisecond. On Unix you typically have a number of choices (sleep, usleep and nanosleep) to fit your needs. On windows however there is only Sleep with millisecond granularity. You can however use the select system...

Rich Edit Control in raw Win32

Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls. It talks about calling InitComm...

Safe remove USB-Drive using Win32 API?

Anyone knows how to remove a USB drive using the win32 API? I do a lot of work on embedded systems and on one of these I have to copy my programs on a usb-stick an insert it into the target hardware. Since I mostly work on the console I don't like to use the mouse and click on the small task-bar icon hundret times a day. I'd love to w...

Asynchronous file IO in .Net

I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology. I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in .NET. Here are some options and the problems I've come across with ea...

Diagnosing Deadlocks in Win32 Program

What are the steps and techniques to debug an apparent hang due to a deadlock in a Win32 production process. I heard that WinDbg can be used for this purpose but could you please provide clear hints on how this can be accomplished? ...

AssignProcessToJobObject fails with "Access Denied" error when running under the debugger

You do AssignProcessToJobObject and it fails with "access denied" but only when you are running in the debugger. Why is this? ...

What is a Privileged instruction?

I have added some code which compiles cleanly and have just received this Windows error: --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location 0x00486752. I am about to go on a ...

How can I programmatically determine the capabilities of an optical drive in Win32

I'm trying to create a deployment tool that will install software based on the hardware found on a system. I'd like the tool to be able to determine if the optical drive is a writer (to determine if burning software sould be installed) or can read DVDs (to determine if a player should be installed). I tried uing the following code strC...

How can I make a systray (notification area) icon receive WM_MOUSEWHEEL messages?

I want to extend an existing application I made to make it set mixer volume by wheel-scrolling over it's notification area icon. As far as I know, the notification area doesn't receive any WM_MOUSEWHEEL messages, but still I found an application that does exactly what I want to achieve (http://www.actualsolution.com/power_mixer). Using ...

How can I report to users what is consuming the process address space of a windows application while they're running it?

I'm writing the memory manager for an application, as part of a team of twenty-odd coders. We're running out of memory quota and we need to be able to see what's going on, since we only appear to be using about 700Mb. I need to be able to report where it's all going - fragmentation etc. Any ideas? ...

Multiple keyboards and low-level hooks

I have a system where I have multiple keyboards and really need to know which keyboard the key stroke is coming from. To explain the set up: I have a normal PC and USB keyboard I have an external VGA screen with some hard-keys The hard keys are mapped as a standard USB keyboard, sending a limited number of key-codes (F1, F2, Return, +...

Windows API spying/hijacking techniques

I'm interested in using API spying/hijacking to implement some core features of a project I'm working on. It's been mentioned in this question as well, but that wasn't really on topic so I figured it'd be better with a question of its own for this., I'd like to gather as much information as possible on this, different techniques/librari...

How to protect yourself against shell DLLs loaded into your process?

When you use a standard Windows "file open" dialog using GetOpenFileName(), the shell will load various DLLs that it requires to display the file list, including custom ones. In my application, I found that the DLL that TortoiseCVS uses to draw overlays on the icons was calling GdiPlusShutdown(), and so some time after displaying a "fil...

Why is my programmatically created user missing from the Welcome screen?

I have a program that creates a Windows user account using the NetUserAdd() API which is suggested by Microsoft. The user is created successfully, and I can log in as that user. However, on Windows XP, the newly-created user is missing from the Welcome screen. If I disable the Welcome screen, I can log in as the new user by typing the...