winapi

Looking for Win32 precompiled PCRECPP

I am having trouble finding a precompiled Win32 distribution of PCRE that also includes PCRECPP. The two archives I could find only include "pcre.h". http://gnuwin32.sourceforge.net/packages/pcre.htm http://www.psyon.org/projects/pcre-win32/ ...

Unloading DLL from all processes after unhooking global CBT hook

How do you properly unload a DLL from all processes when the system-wide hook that loaded them gets unloaded? From MSDN: You can release a global hook procedure by using UnhookWindowsHookEx, but this function does not free the DLL containing the hook procedure. This is because global hook procedures are called in the pr...

How do I read stdout/stderr output of a child process correctly?

I have written a program a.exe which launches another program I wrote, b.exe, using the CreateProcess function. The caller creates two pipes and passes the writing ends of both pipes to the CreateProcess as the stdout/stderr handles to use for the child process. This is virtually the same as the Creating a Child Process with Redirected I...

WCHAR to LPCWSTR

when i use CreateFile function like below ...it gives me valid handle HANDLE hDevice = CreateFile (TEXT("\\\\.\\G:"), 0,FILE_SHARE_READ | FILE_SHARE_WRITE, // share mode NULL, OPEN_EXISTING, 0, NULL); if( hDevice == INVALID_HANDLE_VALUE ) { qDebug()<<"In valid handle"; } else { qDebug()<<"valid han...

Help on LPCWSTR...

How can i convet QString to LPCWSTR... QString a = QString("\\.\%1:").arg( "G" ); i have to use it for the below function HANDLE hDevice = CreateFile ( a ,0,FILE_SHARE_READ | FILE_SHARE_WRITE, // share mode // NULL, OPEN_EXISTING, 0, NULL); Thank you ...

Windows CE 5.0 full screen window with Windows API only

I'm trying to write a full screen application for Windows CE 5.0. I'm using CEGCC under Linux to compile my application, so I'm restricted to Windows API - i.e. no fancy GUI designer stuff, no Visual Studio, no MFC, no .NET. So far, I tried Microsoft's example using SHFullScreen, but no luck. I do not want to hide the taskbar globally (...

How do you tell if a window is modal or mdi window?

Given an window handle, is it possible to tell if the window is modal, or maybe an mdi child window? ...

download a file using windows IStream

I'm implementing dragging a virtual file out of a website and onto the desktop with an activex control. How do I create an IStream on my http url, so Windows can execute the drop? The example I'm looking at uses SHCreateStreamOnFile to copy a local file; there must be an analogous function for other types of streams like http file dow...

LockFileEx read/write upgrade/downgrade

I have the need to open a file, read-lock it, then attempt to get a write lock but keep the read lock if it fails. This works great in POSIX using fcntl locking. In Windows I can use LockFileEx to get file locks. I can get both read and write locks (shared and exclusive). However, it seems that in Windows I must take the exclusive wri...

Layered windows, UpdateLayeredWindow and performance

I am using Layered windows and they seem to impose quite the performance penalty (one of my cores is used completely). Is there any way to tweak performance with layered windows? Is Direct2D a viable alternative? (my layered window needs to have per-pixel alpha). thanks, H ...

Winsock and other network possibilities in Windows

Hi, on windows, is there any other option when programming network communication then using Winsock? There are many socket libraries for c++, are they all just winsock based? ...

how to call winmain function through a main function

I am using dev c++ and i need to call a function which has some butons and edit boxes created using windows.h through another program which uses graphics functions and both files exist in a project and i am unable to do it..can any one help me please... ...

Detecting user from winsock data?

Hi. For example i create socket using winsock under account named Admin. Is there any possibility to detect which user created that socket? I would like to write in my program: This socket was created by "Admin". i am using c++ ...

Extend an external application's menu

Hello, I am currently writing a plugin for a third party application. As the plugin framework does not provide any way to access the UI I am now trying to do this manually via the WinAPI. More specifically, I want to add a custom menu item for my plugin in the "File" menu. My first attempt using FindWindow to retrieve the handle of t...

Detecting user name from process ID

Ho can i get user account name, that ran the process with specified id. Is there any api function for this? I am using windows,c++. ...

Inplace Win32 listview editing is always canceled

I have a listview in small icon mode on a modeless Win32 dialog with LVS_EDITLABELS set. Regardless of whether editing was begun by a mouse click or programmatically by calling ListView_LabelEdit() and regardless of whether ESC or RETURN was hit upon finishing editing, when LVN_ENDLABELEDIT notification is received pszText of NMLVDISPINF...

Wait cursor on thread control

I have created three checkbox controls for three threads and each would start by checking a checkbox control. When a user unchecks a checkbox, I want to turn on the Wait Cursor on the other thread controls rather than completely disabling them for an instance of time, letting a particular thread to stop. How would you set a IDC_WAIT cur...

How to eject CD using WMI and Python?

Using Windows' WMI library, how can I eject CD rom mounted in a specific CD/DVD drive? I am asking for sources from WMI docs or examples since I am using wmi.py library on Python. It would be great if solution satisfies Windows computer newer than Windows 2000 and having multi CD-ROMs. (i.e. I have D: F: drives and both are CD-ROM dri...

Good way of debugging "application configuration is incorrect" problems on end-user systems?

I build an executable which is dynamically linked to several DLLs. Most of these are installed by default on Windows, but maybe with slightly different versions. Others I distribute with the app, but they in turn may depend on other DLLs. If I run the executable locally and get the Windows error message saying that "Failed to load [what...

Is it safe to "double-close" a handle using CloseHandle?

What are the implications of calling CloseHandle more than once? The docs say "you shouldn't" but I think I have a realistic case with named pipes where a handle might be closed externally (See end of post). CloseHandle throws an exception in debug mode in this case, which suggests to me the developers think this is serious, but the do...