winapi

DeviceIOControl() failing with error 50! HELP please.

Hi I'm very new to communication with Windows Device Drivers. :) I'm new to the forum too, I will be helpful if someone help me. A) I need to communicate with a third-party driver. I see that CreateFile() accept both the device name (such as \\.\DeviceName) and also I can call the full file name (such as \\.\C:\MyPath\DriverName.sys)....

MsgWaitForMultipleObjects sometimes returns WAIT_FAILED with no GetLastError value

I have a thread that creates COM objects that require a single threaded apartment. Originally, this thread's main function put it into a WaitForMultipleObjects loop. Evidently this is a problem, because it prevents the COM message pump from doing it's job. I replaced this with MsgWaitForMultipleObjects as a solution, but now I'm runnin...

Win32: Why does ReleaseDC() say my DC is not found?

I call getDC(hwnd) and then later on close call ReleaseDC(hwnd,dc). This is for an OpenGL engine and after i call WGLMakeCurrent(Null,Null) and WGLDeleteContext. ReleaseDC returns error code 1425 which is 1425L ERROR_DC_NOT_FOUND Invalid HDC passed to ReleaseDC. I don't und...

Win32 Edit Control - GetText does not return final \n

I have a Win32 Edit window (i.e. CreateWindow with classname "EDIT"). Every time I add a line to the control I append '\r\n' (i.e new line). However, when I call WM_GETTEXT to get the text of the EDIT window, it is always missing the last '\n'. If I add 1 to the result of WM_GETTEXTLENGTH, it returns the correct character count, thus ...

Resizable Side Window

Is there any way to create a child window that is resizable only on the right edge and covers up a part of the left side of the parent window? Similar to that of Firefox's History panel. ...

Where does Microsoft hide the TraceDmp tool/source?

This link on MSDN says it's stored in the samples directory of the Windows SDK: http://msdn.microsoft.com/en-us/library/aa363805(VS.85).aspx Except it isn't, and I have the latest version. Where can one go to find this code, if not the distributable tool itself? ...

Check if windows shell has finished loading startup programs

How can i programatically check if the windows shell (explorer) has loaded all startup programs & the user login process is over ? ...

How to wait forever for at least one byte using COMMTIMEOUTS?

How can I configure COMMTIMEOUTS to wait forever for at least one byte to be read? ...

Problems with 'cross process subclassing'

Two questions. 1) I understand this must be an expected outcome but maybe someone can tell me what I'm doing wrong; I'm trying to subclass all window classes in a global hook and it works except that I'm not able to close shop as I should and when the program initially registering the hook unregisters the hook and exits, subclassed appl...

WinApi ShellExecuteEx - using verb 'copy' on a file list

Hello, is it possible to use ShellExecuteEx to copy or cut a group of files in a given directory ? The Windows function works fine on a single file but I can't find anywhere any tips over the subject (with a file list). I don't expect any alternative method ( such as xcopy) because I need the windows shell function undo/redo after perfo...

What if CancelIo fails?

There are a number of reasons to call CancelIo, but in my particular case I'm calling it in order to know that the system is no longer writing into a buffer. Once I know that, I can safely free the buffer. But what if CancelIo fails? What I do now is explicitly leak the buffer and throw an exception. Are there better ways to deal with t...

I'm having troubles understanding msdn's documentation about _beginthreadex and _endthreadex

I'm reading the documentation about _beginthreadex and _endthreadex but there are a few things I don't understand. Note that the documentation keeps documenting the "extended" and normal functions at the same time, but I'm not using _beginthread and _endthread; only their extended versions. You can call _endthread or _endthreade...

Send click to custom control in applet window

Would it be possible send a click message using SendMessage to a control in parent window? Apparently, the following doesn't seem to be working SendMessage(hParent, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(x, y)); SendMessage(hParent, WM_LBUTTONUP, 0, MAKELPARAM(x, y)); //x and y are location of child control on parent applet window. ...

How can one ensure that an application starts after Windows startup always at the same time?

In other words, Windows starts up, and my application xyz.exe, is started at exactly 5 minutes after boot up. Is this possible to guarantee, within a margin of error of say 10-15 seconds? ...

Convert errno.h error values to Win32 GetLastError() equivalents

I'm writing a layer between a POSIX filesystem, and Windows using Dokan, and need to convert error values of the errno kind (EINVAL, ENOENT, etc.), to the Win32 equivalents you'd receive when calling GetLastError() (such as ERROR_INVALID_PARAMETER). Is there an existing function, library, or reference I can use to perform these conversi...

C++ WINAPI: Client area parent dragging with obscuring child tab windows

Attempting to simulate client area based window dragging by returning HTCAPTION under a WM_NCHITTEST (excluding HTCLIENT & appropriate areas) works flawlessly when used with a parent window - however presence of child windows such as tabs placeholder windows, even when set to the extended style WS_EX_TRANSPARENT, cause clicks to fail to ...

Draw Thick Line with Border

I am trying to draw a thick line using c++, and add a border to this line from all side. I am using moveto, lineto functions, but not sure how to track the line width to draw borders. this is require for generic line. ...

WM_PAINT not being called after window is created.

I've been playing around with the Windows api for uni, but I cant get the window messages to call WM_PAINT after the inital creation. It calls it when the window is created but not after. All Other messages get called! Just cant get the WM_PAINT to be called. This is part of a game lib we have to make using the Windows api, (the goal i...

in ESE (JetBlue) is there a way to limit a search with multiple keys?

In Extensbile Strage Engine (ESE/JetBlue) I've got a table that contains data I'd like to locate using two indexes assuming that each row has three integers X, Y, and Z. I'd like to quickly locate all the rows where X=10 and Y=20 (for example) the resulting set would contain all the entries where X=10, Y=20, and Z= whever Z happened t...

C++ Win32 API offline documentation?

I'm learning win32 apps with C++. I've got a pretty good API reference, but it's from 1997. Is there a more modern version available for download? My connection is horrendous so I'd like it to be fully accessible offline. Something akin to a chm or hlp file...searchable and up to date-ish. ...