winapi

How to use WMP engine without Window

I'm writing a simple audio playback application, to save the codec fee, so we are using WMP ActiveX to play all music files, but it needs to create a window for ActiveX, and the thread of creating the ActiveX should have message loop. I would like to know if there is a way for WMP without ActiveX and Window? Thanks in advance. ...

What happens if I call GlobalLock(), then fail to call GlobalUnlock()?

In Win32 in order to paste data into the clipboard I have to call GlobalAlloc(), then GlobalLock() to obtain a pointer, then copy data, then call GlobalUnlock() and SetClipboardData(). If the code is in C++ an exception might be thrown between calls to GlobalLock() and GlobalUnlock() and if I don't take care of this GlobalUnlock() will ...

How to detect the device name for a capture device?

I am writing a GStreamer application (GStreamer uses DirectShow under the hood on Windows) that captures a computer's microphone and videocamera. It works fine, but requires me to specify the device names manually. I would like to have my program detect these automatically. Does anyone know how to do that? ...

How to find out when WinInet proxy setting have changed

Is there any windows API to register a callback for when the WinInet proxy settings have changed? ...

Visual C++ Automatically Appending A or W to end of Function

In C++ I have defined a class that has this as a member static const std::basic_string<TCHAR> MyClass_; There is also a getter function for this value LPCTSTR CClass::GetMyClassName() { return MyClass_.c_str(); } When I create an instance of this class and then try and access it intellisense pops up but the name has been change...

WinAPI for Game Controllers

Hi there! I know that all windows platforms automatically detect when a game controller is connected. I also know there is a WinAPI for polling these controllers. I can't seem to find the functions I am looking for anywhere. Any help is greatly appreciated! Brendan ...

hooking on WM_SETTEXT message

I have setup a hook on WM_SETTEXT message using WH_CALLWNDPROC. In hook procedure CWPSTRUCT* info = (CWPSTRUCT*) lParam; switch(info->message) { case WM_SETTEXT: break; } Now in the above code how can I get the string that is passed along WM_SETTEXT message? I am not able to get this information anywher.. ...

API to use deault Web Cam?

I'm working on a Win32 application in C++ and would like to add the ability to output the default web cam onto the screen. I was wondering if there was a Win32 API for this, or a way to do this without coding the whole thing. Thanks ...

Changing string after hooking WM_SETTEXT

I have setup a hook on WM_SETTEXT message using WH_CALLWNDPROC. In hook procedure CWPSTRUCT* info = (CWPSTRUCT*) lParam; wchar_t *wsz = NULL; switch(info->message) { case WM_SETTEXT: wsz = (wchar_t *) info->lParam; //info->lParam = (LPARAM) L"Hello"; //SendMessage(info->hWnd,WM_SETTEXT,0,(LPARAM)L"HEllo"); //SetWindowText(info->hWnd,L"...

How to detect if an application window is set to 'always on top' / 'top most' (that is not part of my application)?

I am enumerating through all visible application windows on a system and I want to determine which ones are set to 'always on top' / 'top most'. My application needs to determine this as it positions various third party applications on a large monitor for fast data entry. I'm happy with a P/Invoke solution. ...

Calculating a gradient fill's start and end colours given a base colour

I have a WTL C++ application and I want the user to be able to select different colours for some of the UI elements and apply a gradient fill using the GradientFill API call. However, instead of letting the user pick the start and end colours for the gradient, I'd like them to be able to select a 'base' colour and for my application to ...

How do I force windows NOT to redraw anything in my dialog when the user is resizing my dialog?

When the user grabs a corner of a resizable window, and then moves it, windows first moves the contents of the window around, then issues a WM_SIZE to the window being resized. Thus, in a dialog where I want to control the movement of various child controls, and I want to eliminate flickering, the user first sees what windows OS thinks ...

Why does GetErrorMessage return "wrong password", when the user name is wrong?

GetErrorMessage (from CInternetException) gives me the following: With the incorrect ftp server name: "ERROR! The server name or address could not be resolved" With the incorrect password: ERROR! The password was not allowed With the incorrect user name: ERROR! The password was not allowed <-----? NO separate message for incorrec...

SendInput() isn't "sending" the correct shifted characters?

void WriteChar(char c) { INPUT input = {0}; input.type = INPUT_KEYBOARD; input.ki.wVk= VkKeyScanEx(c, GetKeyboardLayout(0) ) ; SendInput(1,&input, sizeof(INPUT)); } VkKeyScanEx returns different key codes for '/' and '?'(same key), however if you try using this method to write a message containing '?', it will only w...

Is it possible to use Win32 Hooks in Qt applications.

I like to know if its possible to use win32 keyboard hook function (SetWindowsHookEx , SetWindowsHookEx ) in a Qt application. If possible pls provide a sample code on using SetWindowsHookEx , SetWindowsHookEx functions in Qt. //Update as of 18 Feb 2010 // I havent figured out how to do that in QT yet. But as a workaround I have cre...

Accessing Microsoft.Win32.UnsafeNativeMethods?

Microsoft has a very nice Windows API wrapper included in .NET framework. It is stored in Microsoft.Win32.UnsafeNativeMethods , Microsoft.Win32.SafeNativeMethods and Microsoft.Win32.NativeMethods.Unfortunately they aren't accessible because they are declared as private. Is there a way of accessing them easily? ...

Setting DIFFSERV/DSCP with GQOS for specific socket in c

I need to set the DSCP field of packets sent from a specific (tcp) socket in windows XP. It seems that the GQOS API should serve this purpose (see http://blogs.msdn.com/wndp/archive/2006/07/05/657196.aspx) but I really, really, can't find any working example or figure how to use it on my own. I would be very grateful if anyone of you h...

How to use winapi functions in java?

I am doing a project in java which has the function to add files in database, and i want to use winapi functions to select files. How would i do that? ...

Simple Win32 Trackbar

I have created a simple game using Win32 and gdi. I would like to have a track bar at the bottom that tracks a global variable. I'm just not sure how to add controls. How could I add a trackbar? I can imagine it would get created in the wm_create event. ...

How Do I Create a System.Drawing.Icon with Multiple Sizes/Images?

I would like to create a single System.Drawing.Icon programmatically from 32x32, 16x16 Bitmaps. Is this possible? If I load an icon with - Icon myIcon = new Icon(@"C:\myIcon.ico"); ...it can contain multiple images. ...