winapi

Is there a Windows API to modify file type associations for an extension?

I'm looking for a way to programatically tweak the particulars of a file association on a Windows system. For example, the "Application User to Perform this Action" setting for the "Open" action for a particular file type. Clearly I could do this by modifying the registry directly, but if there is an API I'd prefer to use that as it wou...

Symlinks on windows?

Does anyone know of a way to make/read symbolic links across versions of win32 from Python? Ideally there should be a minimum amount of platform specific code, as I need my app to be cross platform. ...

How to set the picturebox style using SendMessage in win32

Hi, i want to set the style of picturebox using sendmessage in win32. i want a sample piece of code with enum values of setting style.. please please suggest me... i will be thank full to u guys.. please help me. ...

C++ and process memory protection

I know that WinAPI has built-in hacking functions. I even used them in C# with Pinvoke... To hack Minesweeper... It was easy... So... How i could protect my application from process memory editing, deny DLL injecting and other hacking ways. HOW?! Hope WinAPI has something like void DontTouchMeOrIWillTerminateYou(bool protect)... ...

How to detect Windows Logon event ?

How do you detect Windows logon event? And how do you initiate a user logon from a Windows service? I'm trying to write a piece of code that will detect logon events and log another one automatically. ...

Get the full name of a waveIn device

I have been using waveInGetDevCaps to get the name of waveIn devices, but the WAVEINCAPS structure only supports 31 characters plus a null, meaning that on my computer, the device names I get back are truncated: Microphone / Line In (SigmaTel Microphone Array (SigmaTel High, I am sure that there must be a way of getting the full devi...

Programably make and play a sound through speakers C++

I'm making a game in native vc++ (not .Net) I'm looking for a way to play a noise (maybe 8 bit or something) through the real speakers (not internal). I know about PlaySound, but I don't want to make my EXE big. I want to program the sound. Is there an api way (kinda like Beep() ) but that plays through the real speakers? Thanks ...

How to get error messages in English on a foreign language version of Windows?

I am using a Dutch version of Windows and I have this piece of code: ::FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastError, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL ); However, this returns the messages in Dutch. Woul...

Good books or tutorials for beginning Direct X with c++

I'm pretty familiarity with c++. I'v made a few games like tetris and solitaire with it. But what I would really like is some nice textured graphics for those games :-p GDI just isn't doing it for me anymore. Really, all I would need to know is: DX scene initialization making something simple like a round rectangle and basic shapes ab...

Retrieving the control's handle (HWND) in Microsoft Active Accessibility.

I want to get the HWND for a given control. I'm using Active Accessibility API to traverse the control hierarchy for a given window. If I call WindowFromAccessibleObject when I find the control I want, it returns a HWND to the window itself and not the control. I think this is because it is using the parent IAccessible pointer and not t...

How can I copy readonly files with deep paths and preserve the file time metadata?

The task that I'm trying to handle is to create a set of wrappers around WINAPI to handle various file modifications for files with deep paths in Windows. Currently, I copy files using WINAPI call prefixed with "\\?\" as suggested here. After copying the file, I'm using the file time metadata (created, accessed, modified) from the or...

UpdateLayeredWindow, SIZE_RESTORED and GetClientRect problem.

I have a layered window set up in my MFC application. I have set up my own derivation of CDialog to allow me to customise various parts of how the window is rendered. Everything works fine right up until I start worrying about minimise and maximise. If you click minimise or maximise then the window reacts exactly as you'd expect (ie...

Best way of validating modal dialog fields?

I often need to have modal dialogs for editing properties or application configuration settings, but I'm never really happy about how to validate these, and present the validation results to the user. Choices and tools are typically:- Design UI so that invalid choices are simply impossible - i.e. use "mask edits", range limits on spin...

How to run ShellExecute on shell object clsid ?

Shell explorer on Windows define global objects such as ::{2559a1f4-21d7-11d4-bdaf-00c04f60b9f0 which is a link to the user "internet browser". I got these value from a shortcut that is drag&dropped over my application, but I can't find how to use it to open it... I'd like to get information about what this object is too. Does someo...

How do I dump the .NET process so that Visual Studio 2008 will load it as a managed dump?

I'm trying to create a minidump of the managed process, which would be loadable into Visual Studio 2008. I'm using following code to create a minidump: ... MINIDUMP_TYPE dumpType = static_cast< MINIDUMP_TYPE >( MiniDumpWithFullMemory | MiniDumpWithDataSegs | MiniDumpWithHandleData | MiniDumpWithProcessThreadData | MiniDumpWithPriv...

Combining Bitmaps / ImageLists (Win32)

Is it possible to create an image list from multiple bitmaps, or to combine multiple image lists into one. For sake of simplicity, same element dimensions and transparent color could be assumed. Reason: I am currently dealing with a very long image list containing four groups of icons and notable "reserved" areas between them. For edi...

Bitblt blackness

I am running this following code, HDC hdc; HDC hdcMem; HBITMAP bitmap; RECT c; GetClientRect(viewHandle, &c); // instead of BeginPaint use GetDC or GetWindowDC hdc = GetDC(viewHandle); hdcMem = CreateCompatibleDC(hdc); // always create the bitmap for the memdc from the window dc bitmap = CreateCompatibleBitmap(hdc,c.right-c.left,200);...

Find out if there is enough disk space to install in a shared folder

I need to be able to install a program in a shared folder on a computer in LAN. First i must find out which folders are shared on a computer, and then check if there is enough disk space for installation to proceed. Here is my method. public static void FindShares() { try { ConnectionOptions options = n...

Global (process wide) properties in Win32

I am trying to share some data across DLLs in a project which has an extremely complicated dependency structure (numberous DLLs). I want to be able to associate a key with some data in one part of the application, and then extract that data by supplying the appropriate key in some other part of the app. In a way, one can say that I loo...

API or command to check if "Fast user switching" enabled on XP

Hello All, I am working on a installer, it should check FUS (Fast user switching) is enabled or not on the XP system. If FUS is enabled then installer should exit, otherwise perform the actual installation. My question is there any command line utility (or API) to check if FUS is enabled on XP? Thanks.. ...