winapi

WSCInstallProviderAndChains allways fails

Hi i am trying to use this functions with parameters at first i load the ws2_32.dll with Loadlibrary then i get the function rc = lpInstallProviderAndChains( providerGuid, //guid lpszLspPathAndFile, //filename lpszLspName, //name ( IfsProvider ? XP1_IFS_HANDLES :...

How to get the Window Class Name and Id from HWND?

How to get the Window Class Name and Id from HWND? I searched but found the opposite is more popular. Any thoughts?!?!? ...

How to detect when a device is added to the system?

Hello all. I've had this problem for a while now but I have to remedy it as I must tackle it now. I'm trying to detect when a device is connected to the system in windows 7 and I receive the WM_DEVICECHANGE just fine, however the message in wParam is always DBT_DEVNODES_CHANGED. Never a DBT_DEVICEARRIVAL or DBT_DEVICEREMOVECOMPLETE. I ha...

Can HttpReceiveHttpRequest receive a HTTP_DATA_CHUNK of type other than HttpDataChunkFromMemory

We can receive a HTTP request body in two ways: call HttpReceiveHttpRequest with HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY set; call HttpReceiveHttpRequest with HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY cleared and then call HttpReceiveRequestEntityBody. In the first case an array of HTTP_DATA_CHUNKs is filled, in the second - the raw bytes buff...

How to programmatically end editing of a CTreeCtrl?

I have a class derived from CTreeCtrl. In some circumstances the user might be editing it and I would like to programmatically cancel the edit which is currently in progress. How do I do this? There doesn't seem to be any appropriate function of the class which would do that, or if I have to send it some message it's not immediately obv...

WriteFile() with WRITE_THROUGH is slow on system disk

Hi, On Windows Server 2008 R2 the following very simple program behaves different on system disk and on any other disk. Seems that on system disk FILE_FLAG_WRITE_THROUGH makes something ... On disk C: (system disk, commodity SATA, no RAID) $ time ./test.exe real 1m8.281s user 0m0.000s sys 0m0.015s On disk E: (another phys...

What is the most efficient way to read a big text file backwards?

What is the most efficient way to read a big text file backwards, line by line, using Windows API functions? For example, if a file is: line 1 ... line 108777 line 108778 the output should be: line 108778 line 108777 ... line 1 I want to write a C program for this. You don't need to write a code (but if you want, that's great), I a...

Why are there WSA pendants for socket(), connect(), send() and so on, but not for closesocket()?

Hi, due to my lack of english skills, I'm going to try to explain what I mean using a few examples: socket() -> WSASocket() connect() -> WSAConnect() send() -> WSASend() sendto() -> WSASendTo() recv() -> WSARecv() recvfrom() -> WSARecvFrom() ... closesocket() -> WSA???() This is nothing that matters much, still something that gives ...

Is it possible to drive Flash app programmatically?

I was wondering if it is possible to drive Flash application programatically to provide some sort of automation for web Flash-based applications that demand user interactions? The naive approach would require taking screenshots and recognizing interactive areas based on some predefined patterns. Then we can emulate mouse clicks/keyboards...

Pause/Break as a Keyboard ShortCut (Win32, *Possibly* Delphi-specific)

Is it not possible to use the Pause/Break key in keyboard shortcuts? I know I can respond to the Pause/Break key, e.g. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_PAUSE then ShowMessage('VK_PAUSE pressed'); end; However, I am unable to respond to the Pause/Break key usin...

WinAPI I/O Redirection - Read as Information is Available using Anon Pipes & Threads

I am creating an application which will read the output from another application (which I did not write) which sends its output to a command prompt. I need to be able to write this information an "Edit" dialog within my GUI program. I have accomplished this using anonymous pipes and multi-threading (a worker thread for writing and anothe...

API Call for arranging icons on desktop

Are there any calls for arranging icon by name, size, etc or 'Align to grid'? ...

Hiding window from taskbar in C# with WinAPI

Believe me, I have Googled it and expected it to be a fairly easy find - turns out it isn't. I have my window handle, but no form. How do I do it? Thanks! ...

Main Window in Resource Script (.rc)

I'm not exactly sure what you can (or should) do with *.rc files. Most Win32 example code, including Visual Studio templates, creates the main window programmatically in WinMain. I could create a dialog in the resource script and just show it in WinMain, but I'm not sure if that's the best idea, since dialogs are treated differently than...

Cannot create a WPF UserControl in a Clr 4.0 self hosting application because of a stackoverflow error

Hi, I managed to host the CLR 2.0 in a Delphi win32 application that was able to create and host WPF controls inside a Delphi control, something similar to the ElementHost for WinForms applications. Now, I want to move my solution to the CLR 4.0 and everything works fine except when I try to create a UserControl that has an associated ...

WebBrowser Control in 32bit app Launches 64bit Internet Explorer on window.open() call

I have a 32bit application running on Windows 7 64bit. The application (written in C++) hosts a WebBrowser control. When the WebBrowser control is asked to popup a new windows (through a javascript window.open() call), it launches a new Internet Explorer process. In particular, this new IE process is a 64bit IE process. Since web pag...

How can i use GDI+ to save a HBITMAP

I want to save my created image as a PNG or JPEG file with the help of GDI+ but i can't find a way to do this. Seems that there is no way to create a non file based Image and fill it with a bitblit from the HBITMAP. Or do i miss something? ...

Compiling errors

Im trying to compile but im getting these errors: 1>.\item.cpp(123) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) 1>.\commands.cpp(1372) : error C2057: expected constant expression 1>.\commands.cpp(1372) : error C2466: cannot allocate an array of constant size 0 1>.\commands.cpp(1372) : error C2...

Specific program not recognizing simulated keyboard input

I'm working on a program that automates the use of this piece of software, EPIX XCAP. In Capture(), it snaps a picture, opens up the File menu, open up the save dialog, but then with it reaches the Tabs (to navigate to the file name box in the save dialog) it doesn't do them. I can tab through it manually well enough, and I tested the ...

Why is errno not found in Visual Studio 6.0?

#include <errno.h> /* compress until end of file */ do { strm.avail_in = fread(in, 1, CHUNK, source); errno; //<-----DEBUGGER "CXX0017: Error: symbol errno not found" perror("Error:"); if (ferror(source)) //<--ferror = 32 but there is no string from perror? { //error handling ...