winapi

Win32's FindWindow() can find a particular window with the exact title, but what about "try.bat - Notepad"?

Win32's FindWindow() can find a window having the title of "Untitled - Notepad", but what if I just want to find a Notepad window but don't know whether it is "try.bat - Notepad" or some other file name on the title bar? It seems that if the title is passed in a NULL value, then any window will be returned, but only one window is return...

Simulating a radio button check command

I've been trying to change the state of a radio button programatically: SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_RADIO1, BST_CHECKED), (LPARAM)(hwnd_RADIO1)); Why won't this work? ...

Handling a Struct native to C# in C++.

Here is my call in C cli::array<mercurial::fileItem>^ tmp = mercFlowCLR::merc::getFolderList(gcnew System::String(remotePath)); Here is my C# Structure: public struct fileItem { public string fileName; public bool isFolder; } My getFolderList is returning of type in C#: List<mercurial::fileItem> The C++ DL...

Shift and ctrl prevent events from happening? (Winapi)

My application redraws the screen every time the mouse moves. I have not at all handled WM_KEYDOWN and I noticed that when I press shift or ctrl, it does not redraw on mouse mouse, nor does it seem to really do anything else. What could cause such a thing? If I press any other key like Z or X it does exactly what it should. Thanks ...

utfcpp and Win32 wide API

Is it good/safe/possible to use the tiny utfcpp library for converting everything I get back from the wide Windows API (FindFirstFileW and such) to a valid UTF8 representation using utf16to8? I would like to use UTF8 internally, but am having trouble getting the correct output (via wcout after another conversion or plain cout). Normal A...

How to close windows after 5 seconds?

Hi, It's 'my' program. How to close windows after 5 seconds? //... DeleteObject (hPedzelOkna); DeleteObject (hBitmapa); Sleep(5); PostQuitMessage (0); /* The program return-value is 0 - The value that PostQuitMessage() gave */ //... and DestroyWindow(hwnd); not work (I using Dev C++) EDIT People have suggested using SetTimer...

Twitter status update from C app

Inspired by Scripting Twitter with cURL, I'm trying to make a command line app in C, used to update my Twitter status. I'm not really sure how curl works in this case... I guess by appending the newly created status to the XML. My question is: how to implement POST in C (libcurl is not used)? Maybe just by using networking functions fr...

How is the .NET event, Application.OnIdle, coded in Win32?

How is the .NET event, Application.OnIdle, coded in Win32? (i.e. What is going on behind the scenes?). ...

Capturing keyboard input on a List View control, C++

How do I capture key presses when a list view control has focus? My window creation code looks like // Window creation HWND hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_APPWINDOW, g_szClassName, "Test", WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, 209, 351, 0, 0, hInstance, 0);...

Problem with linker/joystick input

I'm trying to wrap my head around getting user input from a joystick/mouse, which doesn't seem all that complicated, but I've run across this simple showstopper: calling joyGetNumDevs() gives me an unresolved external symbol error. I've included the necessary Windows.h and MMSystem.h, so I don't have any idea what may be causing this pro...

Change wallpaper programmatically using c++ and windows api

Hi, I've been trying to write an application, using Qt and mingw32, to download images and set them as the background Wallpaper. I have read several articles online about how to do this, in VB and C#, and to some extent how to do it in c++. I am currently calling the SystemParametersInfo with what seems to be all the correct arguments (...

How to get the Time format for all the regionals

In Control Panel-> Regional and language options-> Regional Options-> Standard and formats, there is the list of all the regionals and by clicking the "Customize" button, the user can set the time format My question is how to get the current and default time format for all the regionals programmelly? ...

Send Ctrl+C to process

I have to send to send Ctrl+C to console process created from my C# application. I have found a lot of similar threads but haven't found a solutaion (tried CreateProcess, GenerateConsoleCtrlEvent, etc.). Is there any working example? ...

How do you use SECURITY_ATTRIBUTES with CreateProcess()?

Greetings! When I try to use GetThreadContext() on a thread that I've started with CreateProcess(), I receive an error of 998: ERROR_NOACCESS You can find a contrived but functional code example of this problem here: http://pastebin.com/tamDhYza Based on the MSDN article regarding "Thread Security and Access Rights", my assumption is...

Getting the handle of the currently focused control inside another application

Hi, How would one retrieve the handle of the control that currently has focus ? I am using WH_KEYBOARD_LL to capture all keypresses in, and I should be able to determine in which textbox the user is typing in. The code capturing the events has no direct access to the controls in the other application. I know the win32 function GetFocus...

How to get handles to all windows of another application

Hi, in my application i have timer, in TimerProc i want to get handles of all windows(main and child) of the another application that has focus. I have no idea how to do that because i don't understand functions like GetNextWindow or GetParent and Z-oder of windows and i can't find anywhere very detailed explanation of how this functions...

Reading Values from Windows Resource (.res) Files

Hello, all. I would like to know if there is a good way to read out values in a compiled resource (*.res) file. I am familiar with reading resources from an executable, and I'm wondering if there is a similar way to read out resources from a resource file. Thanks in advance! ...

Display PNG on Visual Studio form

I'm working on a C++ application in Visual Studio (non-MFC) and was surprised to find that I can't add a PNG image to a dialog in the designer which seems a little backward as I can in most other IDEs that I've used. So either a) there is something I'm missing or b) there is a way to do it with code. I'm hoping that it's a but b would be...

Win32 / WTL- My Checkbox imagelist state reverts to unchecked state

I'm creating a custom window in WTL to hold video controls for a DirectShow app. I've created a set of check boxes that I wish to behave in the "push like" manner (BS_PUSHLIKE). They appear defined in the .rc file for the dialog like so: CONTROL "",IDC_VID1,"Button",BS_AUTOCHECKBOX | BS_BITMAP | BS_PUSHLIKE | WS_GROUP | WS_T...

Create a window as a child of a minimized window of another process

I'm creating a window as a child of a window of another process. Everything works fine unless the parent happens to be minimized when I create the window. Then my window is never displayed. I get WM_NCCREATE, WM_NCCALCSIZE, WM_CREATE, WM_SIZE, WM_MOVE and WM_SHOWWINDOW. After that nothing except WM_DESTROY when the parent is destroyed. ...