winapi

How to detect programmatically whether code is running in shared DLL or exe?

A have a C# class which simplifies the handling of global hot keys. This class uses the Win32-API function RegisterHotKey() to register the hot keys. According to MSDN this function needs an ID value in the range 0x0000 through 0xBFFF when calling from an application and an ID value in the range of 0xC000 through 0xFFFF when calling fro...

Detecting glyphs occurrences in any fonts

Hi, everyone. I'm writing a small .NET application that can produce SWF files, and I need to support Unicode fonts. I don't know the things on it and font rendering well, so I understand that I've made some blunders while writing my application: many fonts installed on my Windows don't support Unicode characters so I can see hollow squa...

Does KEY_WOW64_64KEY have any effect on 32 bit Windows?

It appears that specifying the KEY_WOW64_64KEY flag (reference) when accessing a registry key under 32-bit Windows XP has no effect - that is, no error is thrown, and the key is opened as if you hadn't had the flag set. I know Windows 2000 throws an error when it encounters this flag. I want to make sure my app is compatible with as ma...

[win32] can _open() return valid negative fd ?

Is it possible that win32's _open() return valid FD that is negative ? In other words, is comparison if( (fd=_open(...)) < 0) error...; as safe as form if( (fd=_open(...)) == -1) error...; ? I am asking because all msdn examples are in form if(fd == -1 ), and never form if( fd < 0). ...

what is HWND in vc++

hai....what is the equivalent of HWND(vc++) in c#,because i want to send HWND from my c# program to the VC++ dll ...

How to make sure that a file was permanently saved on USB, when user doesn't use "Safely Remove Hardware"?

When I save a file on a USB within my delphi application, how can I make sure the file is really (permanently) saved on the USB, when "Safely Remove Hardware" is not performed (especially forgotten to use)? Telling our customer to use the windows feature "Safely Remove Hardware" doesn't work. Is there a windows API command to flush the b...

How to download the entire webpage

Hi, Is there any sample application source which download the entire web-page in windows mobile.. I mean,in desktop when i do save as,entire webpgae gets saved.Same way i want it to be in windows mobile.. Thanks. ...

Mouse hook in a specific window

I need to set a hook on mouse clicks, using C++, Win API. So that when an icon on the desktop is being clicked I get the event. How will this happen? I think the only information I get in mouse hook event are the coordinates for the mouse, right? Now how do I make sure that the thing clicked is an icon on the desktop? ...

Are Interlocked* functions useful on shared memory?

Two Windows processes have memory mapped the same shared file. If the file consists of counters, is it appropriate to use the Interlocked* functions (like InterlockedIncrement) to update those counters? Will those synchronize access across processes? Or do I need to use something heavier, like a mutex? Or perhaps the shared-memory me...

How to check which XP theme is enabled

I have a wxPython which works perfectly on window xp theme but on switching to 'classic theme' rich text cntrl comes up without border. I can enable border for classic theme but for that Q1. I need to know if classic theme is enabled. Q2.I am also not sure how many different theme could be there which may break my app appearance. so w...

show/hide desktop icons from c++ application

Right-click on desktop, uncheck view->Show Desktop icons. All icons on desktop will disappear. Is it possible to show/hide desktop icons from c++ application? Do you have an example of c++ code for it? Thanks a lot in advance for any suggestions. ...

What are the differences between Vanilla Perl and Strawberry Perl?

Strawberry Perl is "Open Source Perl for Windows that is exactly the same as Perl everywhere else". Vanilla Perl "provides a Perl distribution that is as close to the Perl core as possible." Strawberry Perl is built on Vanilla Perl. Both distributions come with a C compiler so that perl modules from CPAN that use XS can be built. What ...

Using global keyboard hook (WH_KEYBOARD_LL) in WPF / C#.

I stitched together from code I found in internet myself WH_KEYBOARD_LL helper class: Problem this had is now solved, thanks to Mattias S, following YourUtils.cs is fixed. Put the following code to some of your utils libs, let it be YourUtils.cs: using System; using System.Diagnostics; using System.Runtime.InteropServices; using Syste...

Can I put LowLevelMouseProc and LowLevelKeyboardProc in the main EXE?

Global Windows hooks must be in a DLL because the hook is going to be called in the context of a different process, so the hook procedure's code must be injected into that process. However, there are limitations: SetWindowsHookEx can be used to inject a DLL into another process. A 32-bit DLL cannot be injected into a 64-bit pro...

Web service for an Excel automation script on Windows

I am tasked to develop a very simple web layer for a very complex algorithm that is implemented as an Excel worksheet. This script would be called from a Ruby on Rails app that would be presenting the user with the forms, check validations and whatnot, and should return just a number. After perusing this site, my best shot is to auto...

C# Refresh Explorer

In my program I toggle the registry value of hidden files to tell explorer whether to hide or show them. However, since explorer doesn't refresh on it's own, I send the event SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero); to refresh everything. However, it doesn't seem to be refreshing anything unfortunately. I see t...

How to abort getchar in a console application when closing it

I've written a simple command line tool that uses getchar to wait for a termination signal (something like: 'Press enter to stop'). I however also want to handle the SC_CLOSE case (clicking the 'close' button). I did this by using SetConsoleCtrlHandler. But how do I cancel my getchar? I tried doing fputc('\n', stdin);, but that results...

How to identify more than 4 gb ram on 32-bit machine

I know that a 32-bit OS cannot see more than 4 GB of RAM. So if I were to install, say, 6 GB of RAM on a machine running 32-bit OS, is there any way to identify that? I know one way to get the installed RAM is through WMI class: win32_physicalmemory.Capacity But I don't know if it'll show the correct installed ram size rather than suppor...

How to repeat key strokes with SendInput?

I'm writing a little tool in VC++ to record key strokes to replay them later, a macro recorder. It works quite nice already, using a keyboard hook function that reads each and every key press and release event. The playback works with the SendInput() function and generally also works fine - except for repeating key strokes. Pressing a ke...

Detecting metadata-only read requests in windows filesystem

Hello, I'm developing a kind of filesystem driver. All of read requests that windows makes to my filesystem goes by the driver implementation. I would like to distinguish between "normal" read requests and those who want to get only the metadata from the file. ( Windows reads first 4K of the file and then stop reading ). Does Windows ...