winapi

Getting the keyboard cursor location/coordinates in all applications.

Right now I'm using the functions GetCaretPos() and GetGUIThreadInfo() to get the current keyboard cursor/caret coordinates. These work properly in applications like Notepad and Wordpad and return the correct coordinates, but in applications such as Firefox, Thunderbird, and others, the coordinates returned are always 0, 0, no matter whe...

EnumProcesses() vs CreateToolhelp32Snapshot()

I was wondering if there are any differences - mostly performance wise - between the two Win32 API functions EnumProcesses() and CreateToolhelp32Snapshot() for enumerating all active processes and loaded modules. Or if one is better than the other to use and why. ...

How to print bold string in C++?

Hi, I got an old application which was written in a C++. I have 0 experience with it but I am suppose to make some changes in app. One of them is to change some text. Problem is that part of updated text needs to be bold, but i have no idea how to do that. I googled but with no much success. Only think I now is to go to new line with \n...

GetAltTabInfo usage?

I'm not able to use GetAltTabInfo. Probably a stupid mistake but what's wrong with this? HWND taskSwitcher = FindWindow(L"TaskSwitcherWnd", L"Task Switching"); ALTTABINFO altTabInfo = {}; altTabInfo.cbSize = sizeof(ALTTABINFO); GetAltTabInfo(taskSwitcher, -1, &altTabInfo, NULL, 0); I have verified that taskSwitcher is the task switchi...

Window manipulation using window-handle from different process on MS Windows(XP)

Hello, Is it possible to do some operations with a window from other process having it's handle? What I would like to do is: -remove window decoration -move window to any position of the screen -let window stay on top without making it modal A link to a command line tool, script or C/C++ code snippet be great. Thank you very much! ...

Capture Access-Application Window Restore/Maximize Event

Scenario: In an Access project a main form has to be positioned and rearranged depending on the size of the Access-Application window. This should be done using VBA. As far as I know there is no way in Microsoft Access VBA to capture the Restore/Maximize-Event of the Access-Application window (I refer to the Access Window itself not any...

win32: detect if start menu is auto-hidden?

I want to position a window at the bottom of the screen. If the start menu is present, I want it to lie along the top of the start menu. If it is not (or it is auto-hidden), I still want it to be in the same position as it would be if the start menu was there, meaning there will be a gap of a few pixels. Currently I get the monitor work...

Setting Up a Win32 DLL in Visual Studio 2008

Please bare with me. I am learning how to make these DLLs properly. Hopefully my questions become more intelligent as I go. I would like to make a Win32 DLL (unmanaged code) using Visual Studio 2008. After selecting New Project, in Project types -> Other Languages -> Visual C++ -> Win32 I selected Win32 Project as the project type. ...

Converting HLOCAL to LPTSTR

How is should a HLOCAL data type be converted to a LPTSTR data type? I'm trying to get a code snippet from Microsoft working, and this is the only error, of which I'm not sure how to resolve: // Create a HDEVINFO with all present devices. hDevInfo = SetupDiGetClassDevs(NULL, 0, // Enumerator 0, DIGCF_PRESENT | DIGCF_ALLCLAS...

C# SetSystemTime (WIN API) hooking

Hello. I need restriction for time changes coming from different sources. The best way, as i think, is to hook WINAPI function SetSystemTime (and maybe SetLocalTime). I tried to hook this by using EasyHook library with injection in all running processes, owned by current system user. But it had no effect. How can I do that? ...

LSA Returns STATUS_BAD_VALIDATION_CLASS

Hello, I'm building an Authentication Package for Windows and I'm now just trying to make a skeleton for the package that I'm going to build. The Package at some point in time will need to call MSV1_0 but the workflow of my authentication is forbidding me from implementing it as a SubAuthentication Package for MSV1_0. Now, please exa...

How to add a custom button to windows' minimize/maximize/close (x)

Hi, I was wondering if there is a way to add (programatically, of course) an icon/button/whatever besides plain text to a window (Microsoft Windows window...)'s title bar or next to where the minimize/maximize/close buttons are. I could draw it myself and create an illusion it is a part of the window, but I wonder if in the user32 api t...

Draw a "TPanel" in WINAPI?

Hello, I want to extend an open/save dialog with a "drop-box" which should look like a TPanel (bevel). The code is already there - I use CreateWindowEx() with WNDCLASS name "Edit". I have searched for a solution to draw a TPanel (resp. a beveled STATIC) with pure WinAPI, but did not found anything. MS Spy++ tells me that a TPanel has ...

Using SetWindowText in WIN32 GDI, and securely deleting data typed in

I wish to securely delete (not even a trace in memory) anything that user types into a textbox. I wonder if setting it to "" is secure enough. SetWindowText is a function in Win32 API, in user32.dll. In the program: SetWindowText(myHandle, "Hello"); SetWindowText(myHandle, "Goodbye"); //Was the buffer containing chars "Hello" overwrit...

how can I make window sdk's setenv.cmd work globally, instead of a single cmd window?

Greetings, I feel kinda stupid for asking this, but I want to set the windows sdk build environment so that any process (including some non MS developer tools) can access the correct setup, without me trying to inject setenv.cmd /x86 into every process's startup. I can't seem to find the right search terms for this, and I don't want t...

Extending ExplorerBrowser from the Windows API Code Pack to display non filesytem files

I'm writing a WPF program in C# that needs to render a set of files in a file browser to the end user. The ExplorerBrowser control found inside the Microsoft Windows API CodePack contains much of the functionality I need... e.g. thumbnails of different sizes, sorting, browsing, etc... The catch is that the files are not coming from t...

Why is my COM factory never released during the program lifetime?

I have a native C++ ATL in-proc COM server. A separate test program calls CoInitialize(), calls CoCreateInstance(), then calls Release() on the pointer, then calls CoUnitialize() and exits. If I run the test program under Visual C++ debugger the debug CRT reports a single memory leak and each time the allocation number is the same. ...

Customizing ExplorerBrowser from the Windows API Code Pack

Hi All, Today I ran into the ExplorerBrowser from the Windows API Code Pack... This looks like a fantastic control to use as a Explorer like control in my application.. However, I am trying to modify the Commands toolbar, which is located on the top of the ExplorerBrowser control. I have noticed I have some control..I can Hide the Comma...

How to emulate WM_KEYDOWN, WM_KEY* from a WM_INPUT handler registered with RIDEV_NOLEGACY?

I have a system with two HID keyboards (actually, one's a barcode scanner.) I registered for raw input with RIDEV_NOLEGACY to block the system from creating WM_KEY* messages for the barcode scanner, which tediously also blocks the messages from the other keyboard. My goal is to keep the WM_* messages for any keybaord device that isn't ...

win32 DialogBox app: how to make the dialog box hidden on startup?

I have a win32 app which uses DialogBox() to display its main window. I now want to start this app up with the dialog box invisible, and later set it visible with SetWindowPos(hDlg, HWND_TOPMOST, ... Unfortunately http://msdn.microsoft.com/en-us/library/ms645452(VS.85).aspx The function displays the dialog box (regardless of wh...