winapi

Does The Dialog ID change?

Hi, Does the Dialog ID change from one machine to another? ...

Draw formatted rich text

Given a custom control CCustomWnd which has its own OnPaint method, what's the simplest way that CCustomWnd::OnPaint can render the contents of a CRichEditCtrl, with the same formatting? To clarify, elsewhere in my dialog/window is a CRichEditCtrl. I have my custom control which does a bunch of custom-drawing, including drawing the cont...

Hang trying to read installed Windows apps & components using MsiEnumComponents

We have a software agent that attempts to get details about the installed applications on Windows machines. We use a few different methods to do it, including reading registry. But part of our method is to read the MSI database using Windows system calls MsiEnumProducts and MsiEnumComponents. We are having a problem -- when the execut...

Linking FriendlyNames from the Registry to drive letters for USB storage devices

I am writing an application that allows Syncing to USB storage devices and I would like to display the FriendlyName for the devices that can be found in the registry at HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR\ I am using GetLogicalDrives to get the list of available devices, GetDriveType to filter by DRIVE_REMOVABLE and GetVolumeInfo...

Creating context menu for win32 API

I am trying to create context menu for win32 application using case WM_RBUTTONDOWN: { HMENU hPopupMenu = CreatePopupMenu(); InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, ID_CLOSE, (LPCWSTR)"Exit"); InsertMenu(hPopupMenu, 0, MF_BYPOSITION | MF_STRING, ID_EXIT, (LPCWSTR)"Play"); SetForegroundWindow(hWnd); Track...

Manage Z-Orders of windows in different threads/message loops?

I've got a C# SCSF application using Telerik WinForms UI conrols that has some long running UI operations that lock up the main UI thread for a few seconds. I do as much background processing on background threads as I can, However some of the databinding and list loading operations cause up to a 5 second halt on the UI Thread. In orde...

Monitor files accessed by windows

Is there a way to hook into the windows API to view all files accessed by the operating system? ...

Calling a second dialog from a dialog window fails to make either one active

Sorry for stupid questions, I'm doing everything as described in this tutorial: http://www.functionx.com/visualc/howto/calldlgfromdlg.htm I create the dialog window and try to call another dialog in response to a button press using the following code: CSecondDlg Dlg; Dlg.DoModal(); Modal window appears but isn't active, and main wind...

How to immediately exit a Windows Form .Net application?

In our app, we have a quite extensive exception handling mechanism. At some point in our error handling logic, we want to terminate the application -- right at this point with no further code execution. Our current code use Environment.Exit() to do that. After a call to Environment.Exit(), some code is still executed. For instance, the G...

WINAPI question (about flickering)

I am painting an jpeg image using IPicture. At first I load it, then if some conditions are met I draw it in the WM_Paint using IPicture::Render function. The problem is that it doesn't draw image if the window is closed by another window, and when I remove the closing window, only that image shows where the window was closing it. I used...

how do i send keystrokes to only one program?

i have been having a hard time to find anything that is usefull but i found someone asked how to do that,(http://stackoverflow.com/questions/2113950/how-to-send-keystrokes-to-a-window) if used the code and i can set notepad's text but i want to send keys but sets the text, i want to send keys like keybd_event i have been using it but i ...

Using SetKeyboardState along with GetKeyboardState in C++

I don't know how to write a good question here, but, basically, does anyone know where I can possibly find some C++ source code using these to actually set keyboard state? For some reason using it the way MSDN does on Windows 7 doesn't do...anything at all. Basic code: PBYTE keyState; GetKeyboardState(keyState); ... // Later on whe...

How to convert UNC to local path

I'm looking for a method to get corresponding local path for a given UNC path. Microsoft provides a small library CheckLCL for this purpose. This library is not supported on all Windows versions. Does anybody know any open source method for this? There is also MAPI function ScLocalPathFromUNC, but am not sure if it works on all platfor...

Get all windows which overlap my window

I want to find all windows which entirely or partly overlap my window (are on top of it). As a special case, if I have two window handles (hWnd1 and hWnd2), I want to find if hWnd2 partly or completely overlaps hWnd1. The windows in question are desktop windows (not children/siblings in the same process). ...

strange result when calling SHFileOperation to delete file after install MS office2003

I use following code to delete a file. it wroks well. SHFILEOPSTRUCT FileOp; ZeroMemory(&FileOp, sizeof(SHFILEOPSTRUCT)); FileOp.hwnd = m_hAppHandle; FileOp.wFunc = FO_DELETE; //delete FileOp.pFrom = szPath; FileOp.pTo = NULL; FileOp.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI; FileOp.fAnyOperationsAborted = FALSE; FileOp.hNameMappin...

Custom MFC control contains another control - messages not getting through

I have a custom CWnd-derived MFC control, which works like this: the control has its own OnPaint, and a black background clicking anywhere on the control causes an edit control to appear at that location, borderless and with black-background, so it blends in the user types in this box and hits enter, the box disappears and the control'...

A single MFC/Win32 control seems to be making my whole desktop repaint

I have a custom control, which owns an edit box and moves it around, etc. The edit-box is typically modified with a wodge of code like this: edit.MoveWindow( &rc ); edit.SetWindowText( text ); edit.SetLimitText( N ); edit.ShowWindow(SW_SHOW); edit.SetFocus(); edit.SetSel(0, CB_ERR); RECT rc is in coordinates local to the custom contro...

where are windows API functions defined?

when you need to use a function you include a header file but wheres the function code is defined? ...

Why is EnumUILanguages returning only one language?

I'm using the Win API function EnumUILanguages on a Windows XP Embedded build that has Chinese and French shell language packs (MUI) installed, however the API call only returns one language code: 0409 (the base en-US installed language). If I look in the registry under HKLM\SYSTEM\CurrentControlSet\Control\Nls\MUILanguages\ then I can ...

DsMakeSpn Always Fails on Windows Server 2008

What could be the reason for consistent failure when calling DsMakeSpn? The error code is 87. Thanks in advance!! ...