winapi

How to know a certain disk's format(is FAT32 or NTFS)

I am programing under windows, c++, mfc How can I know disk's format by path such as "c:\". Does windows provide such APIs? ...

log4cxx time based rolling on Windows

Has anyone had any success getting log4cxx to roll files based upon time on Windows? It seems from the unit test cases and the behavior I can observe that this does not work at all on win32 platforms. My config is below in case I've made a mistake there: log4j.rootLogger=DEBUG, A1 log4j.appender.A1=org.apache.log4j.RollingFileAppender...

System-wide focus

Is it possible to get HWND of currently focused window? For the whole windows station, not the current application. Target application is Win32. I can get current window using :GetForegroundWindow() however, this is the main window only. I can enumerate child windows, but how do I determine if it's focused? ...

Reliability of file locking on network files

I read that file locking on network files isn't very reliable. I'm using those LockFile/LockFileEx/UnlockFile win32-api functions for range-locks. Does anyone have some experience of using those functions on files living on a network-share? ...

c++ strange c0000005 error

Hello, I am working on a project that can start a program on the winlogon desktop. The program works perfectly while debugging but when I start it outside the ide it fails strangly with the infamous c0000005 error. The weirdest thing though is it doesn't seem to occur on any particular line. Here is the code: #include "stdafx.h" #includ...

Connect to a virtual terminal

I need my application to connect to a network virtual terminal. In other words I need my app to talk via tcp/ip to a server and exchange data & initiate commands. What does my application require for this? Any native windows api I can use for this. Thanx in advance. ...

If MessageBox()/related are synchronous, why doesn't my message loop freeze?

Why is it that if I call a seemingly synchronous Windows function like MessageBox() inside of my message loop, the loop itself doesn't freeze as if I called Sleep() (or a similar function) instead? To illustrate my point, take the following skeletal WndProc: int counter = 0; LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, ...

Check if service is running?

I need to check if 'Event Log' services in running or not. How to do that? ...

Win32 API in VC++ platform

Can anyone help me in getting the video training for Win32(Windows programming) in VC++ platform ... ...

Sending WM_COMMAND to a TMenuItem

In my Delphi form's OnShow method, I determine that a dialog must be opened automatically once the form is opened - and I should be able to do this by simulating a click on a menuitem. However, calling menuitem.Click brings up the dialog before the main form has opened - which is not what I want. I expect that should do what I want, bu...

How to get real text dimensions when ClearType is on?

I have a Win32 GUI application that uses GDI havily. It needs to draw text over a bitmap at specified coordinates and later erase it and substitute with the original bitmap. I proceed as follows: select font (GetStockObject( DEFAULT_GUI_FONT)), brush, other stuff into the device context call GetTextExtentPoint32() to compute the size ...

Switch input language on remote application

Is it possible to switch input language for another application? Having application's process ID, thread ID, window handle etc. ...

When does Microsoft.Win32.OpenFileDialog.ShowDialog() return null?

OpenFileDialog's ShowDialog method returns a nullable boolean, set to true if the user clicked OK or false if he clicked Cancel. When does it return null? The documentation does not say. ...

Access Motherboard information without using WMI

I need to access motheroard identification (serial, manufacture, etc) in my application on multiple processes. I have been able to successfully query this using WMI, but I'm looking for an alternative. If you care to know situation: I have some application behavior that is different depending on the hardware configuration, or if a par...

CB_GETLBTEXT notification to a program

I'm trying to modify the selection of a particular combobox. I have already retrieved the handle successfully. However, when I call the function as below, I cannot modify the combobox selection properly: r = SendMessage(cbox, CBN_SELCHANGE, 2, 0); What would be the easiest method to accomplish what I want to do? Thanks in advance. ...

How widespread are fonts with non-zero escapement or orientation?

I had serious problems with using GetTextExtentPoint32() and TextOut() in my Win32 GDI program when ClearType antialiasing was on. The problem seems to be solved by using DrawText(). The problem is MSDN states that DrawText() only supports fonts with zero escapement and orientation. What are the chances that I encounter a font violating...

What Windows API function should I use to mark/unmark files/folders as protected operating system file?

What Windows API function should I use to mark/unmark files/folders as protected operating system file? ...

How to find if an document can be OPENed via ShellExecute?

I want to check if a particular file can be successfully "OPEN"ed via ShellExecute, so I'm attempting to use AssocQueryString to discover this. Example: DWORD size = 1024; TCHAR buff[1024]; // fixed size as dirty hack for testing int err = AssocQueryString(0, ASSOCSTR_EXECUTABLE, ".mxf", NULL ,buff , &size); openAction->Enabled = ((...

Standard keyboard shortcut for moving items in a list?

For my Windows application I'm currently looking for a standard (or at least widely used) keyboard shortcut for moving items in a Win32 listview. I've looked at MSDN's recommendations Guidelines for Keyboard User Interface Design but unfortunately, the topic isn't addressed there. I'm thinking about Alt+<Arrow Down> and Alt+<Arrow Up> (...

How do I filter FindFirstUrlCacheEntry()?

I have studied the documentation on MSDN, but it doesn't work for me, I am wondering what I'm doing wrong? My code is as follows, I am trying to filter my IE cache, for example, to get only the cookies: #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <wininet.h> int main(void) { DWORD dwEntrySize; DWORD dw...