winapi

Getting in message loop of external application

Hello, I need to retrieve values from an external application but it does not provide any API to do so. The values are ever-changing and not fixed. Is there a way to retrieve the values from the application? Maybe getting into the message loop for that particular application and filtering for certain window messages which contains t...

How Can I get the recycleBin Path for each disk, for different operation System?

WinXP, Vista, Win7, there is a certain folder for recyclebin. How Can I get the recycleBin Path for each disk, for different operation System? in WinXP it is called XX:\RECYCLER, while in vista it used another name. Is there any windows C++ API for it ? Many thanks! ...

Convert UTF-16 to UTF-8

I am current using VC++ 2008 MFC. Due to PostgreSQL doesn't support UTF-16 (Encoding used by Windows for Unicode), I need to convert string from UTF-16 to UTF-8, before store it. Here is my code snippet. // demo.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "demo.h" #include "Utils.h" #incl...

What happens from the moment we press a key on the keyboard, until it appears in your word document

This question was in my job interview.. I just to see whether I gave all the details... ...

Help with WinAPI Toolbar

I'm trying to create a toolbar where my bitmaps will be 40x40 and I'm trying to make the toolbar 40 pixels in width. I want it to be a vertical toobar. I'm getting nothing but horizontal results from this code: HWND OGLTOOLBAR::create(HWND parent,HINSTANCE hInst,WNDPROC prc, int *toolWidthPtr) { if (toolhWnd != NULL) { r...

Having trouble understanding this error creating a thread...

HANDLE hThread; DWORD dwThreadId; hThread = CreateThread( NULL, // default security attributes 0, // use default stack size MyThreadFunction, // thread function name 0, // argument to thread function 0, ...

How do the variable length fields in the windows EVENTLOGRECORD structure work?

I've tried, with little success, to identify how the variable length portion of the EVENTLOGRECORD data works. Winnt.h defines the structure, and the following data, as follows: typedef struct _EVENTLOGRECORD { DWORD Length; // Length of full record DWORD Reserved; // Used by the service DWORD RecordNumber; // Absol...

How do I set the windows system clock to the right local time using C++?

Right now I do something like this: SYSTEMTIME st; st.wHour = 6; st.wMinute = 23; BOOL result = SetSystemTime(&st); The goal is to get it to show that exact time on my local machine. When I run the program it changes it to 8:23 instead of 6:23. How can I get it to show the correct local time? ...

How do I concurrently download and convert a binary file using threads?

I have a program that downloads a binary file, from another PC. I also have a another standalone program that can convert this binary file to a human readable CSV. I would like to bring the conversion tool "into" the download tool, creating a thread in the download tool that kicks off the conversion code (so it can start converting whi...

Converting mouse position to world position OpenGL

Hey, I'm working on a map editor for my game, and I'm trying to convert the mouse position to a position in the game world, the view is set up using gluPerspective ...

"Selected" style for WinAPI toolbar button?

Is there a way to make a toolbar button look different than the rest (Aside from changing bitmap or setting its state to Disable? Is there away to make it look highlighted all the time? I want the selected tool to look selected. Thanks (Sort of like the way open applications are "Selected" in Windows 7. ...

Is there a thread safe queue class for Visual Studio C++ 6.0?

I would like to implement a thread safe queue in VS 6.0 Is there a good class to use for this? This is an MFC application using the CWinApp. My former post lead me to here but I don't have the luxury to code in VS 2010, stuck in 6.0 land. o well..... Thank You. ...

Why isn't this compiling?

#include <stdio.h> #include <Windows.h> int main() { TCHAR buff[1024]; GetLogicalDriveStrings(1024, buff); int i; for(i = 0; buff[i] != 0; i += 4) printf("%S", buff+i); } When I try to compile it with MSVC, I get the following errors: Commenting out GetLogicalDriveStrings(1024, buff); causes the code to com...

Problems running a 32-bit Delphi app on a 64-bit Windows platform

I have a Windows 32 bit app written in Delphi that is giving problems when running under Windows Server 2008 64-bit. Details are sketchy ("having all kinds of printing issues" was the best report I could get so far) and the app behaves fine on all the Win64 platforms I have access to, but aside from that, I would have thought that an ap...

CombineRgn not working

I have two region say rgn1 and rgn2. I wanted to combine both of them using CombineRgn function. So I write - if CombineRgn(rgnMain,rgn1,rgn2,RGN_OR) = error then ShowMessage('error'); Its giving return value as ERROR. I have tested that rgn1 and rgn2 are correct region. Thank You. ...

Duplication in Drive letters

i get device insertion and removal notification from WM_DEVICECHANGE i get the dbcc_name from the DBT_DEVTYP_DEVICEINTERFACE i get the corresponding drive letter from the DBT_DEVTYP_VOLUME if i insert the device one by one it works correctly but if i insert two device at a time i get duplication in drive letters how can i solve it ...

How do I determine the user's language in Visual C++?

I've been searching msdn forever now without a straight answer. Is there a way to simply get the user's language? I don't want to load any resources or anything at this point, I just want to get their language. Is there ANY simple way to do this? I'm using visual C++,and I'm not using MFC or anything like that. Thanks in advance! ...

Best backwards compatible way to programmatically capture sound going to speakers

What would be the best approach to take in order to achieve a backwards compatible (Windows XP through Windows 7) way to capture sound that is being sent to the speakers on a machine, even if the audio driver doesn't expose the "Stereo Mix" recording device. For extra points, it would be great if this approach allowed for capturing soun...

MessageBox with timeout OR Closing a MessageBox from another thread

If my application crashes, I use an ExceptionFilter to catch the crash, perform some final actions, then show a message box to the user that the application has crashed. Because the application already crashed, there's not much I can (or I dare) to do, because if I do too much, the executed code might access corrupted memory and crash a...

How to get file path from NTFS index number?

I have dwVolumeSerialNumber, nFileIndexHigh, nFileIndexLow values obtained from a call to GetFileInformationByHandle. How can I get file path from these values? ...