winapi

Getting physical sector of a filesystem directory entry

Is there a way to know the sector/cluster number a directory entry in Window? If there's a separate or absent solution for NTFS/FAT32, it's ok, I can live with it. Thanks, Max ...

GetPrivateProfileInt on network file on freshly booted machine

After intensive searching why certain workstations wouldn't perform a certain action when just being started up in the morning (...) I've discovered that GetPrivateProfileInt just returns the default value and doesn't bother to set GetLastError to something non-zero when the network-subsystem hasn't activated yet (e.g. because the DHCP c...

Access violation reading location 0x0000000c.

In my application I disable the Start menu using 'LowLevelKeyboardProc'. But i get the following error when i pressing the tab key continuously. The Error.. Unhandled exception at 0x00352d58 in Timer_soosai.exe: 0xC0000005: Access violation reading location 0x0000000c. 00352D58 mov eax,dword ptr [ecx+0Ch] /*This is th...

FlushFileBuffers as good as CloseHandle then CreateFile at saving data to disk?

For a file on disk, is the Win32 function FlushFileBuffers as reliable and certain as closing the file using CloseHandle then re-opening the file using CreateFile? Are there circumstances where CloseHandle then CreateFile are better because they save the data correctly to disk when FlushFileBuffers does not? ...

Small issue with creating a process ( CreateProcess or ShellExecuteEx) with parameters (fixed)

Edit : Fixed, the issue was with the spawned EXE that did not handle the parameters properly (perl script that was byte compiles) Thanks again. Max. (probable duplicate of http://stackoverflow.com/questions/1135784/createprocess-doesnt-pass-command-line-arguments) Is there a difference between passing an argument vs. passing a par...

WH_GETMESSAGE global hook not working

I am trying to set a global GetMessage hook on all threads. This is my DLL: #include <windows.h> __declspec(dllexport) LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) { MessageBeep(0); return CallNextHookEx(NULL, nCode, wParam, lParam); } As you can see, it's not much. I just want it to call MessageBeep when...

Communication between EXE and Global Hook DLL

I have an application loading a library containing a callback function for a global GetMessage hook. I get the procedure and pass it to SetWindowsHookEx to be set for all running threads. The problem is that I want the DLL function to, under a certain circumstance like a keypress, tell the original application to exit, not all applicati...

Is registration-free activation possible for EXE (out-of-process) COM servers?

I know that we can use CoLoadLibrary and DllGetClassObject to get the IClassFactory interface and get the COM component interface without registering the DLL. But what about a COM component in an EXE? Is there a way that I can get a COM component interface from an EXE-type COM server by just providing a different file path? ...

Retrieve all the controls of any window with their types and value

My application is something like the Spy++ application: i want to be able to automatically retreive all the different controls of the active window (any application) and their children, and for each control i want to know the type, the name, and the value (caption or text). I am using a C# windows app. what is the solution to iterate ...

How to fill memory fast with a `int32_t` value?

Is there a function (SSEx intrinsics is OK) which will fill the memory with a specified int32_t value? For instance, when this value is equal to 0xAABBCC00 the result memory should look like: AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC0...

win32 DialogBox app: how to show text from callback on the DialogBox?

I'm working on a win32 DialogBox based app. This uses DialogBox() to create the dialog box, and has a dialog box procedure which does all the usual things. The dialog box has some static text controls on it, and generally I'm showing text in these via SendDlgItemMessage() from within the dialog box procedure. However at one point the ...

Windows event message viewer for viewing messages sent by PostMessage() function

Couple of years ago i used some tool to monitor what event messages were being sent to a window. I can't remember the name right now. Can someone please tell me some tool with this functionality. ...

How to Suppress task switch keys (winkey, alt-tab, alt-esc, ctrl-esc) using low-level keyboard hook in c#

Hi I'm a beginner. Can anyone please tell me how to disable the task switch keys using c# ...

ReadFile() Output to WinAPI edit Dialog

Ok, let's see if this all makes sense. Today, as I began working on a small project, I ran into an error I can't seem to get over. The function of the program I am working on is to read data from a pipe (which is the output of another program) and update an HWND ("edit") control dialog using WinAPI. Now, I've been successful at updating ...

[Win32] Adding items to a ListView?

I'm having trouble adding items onto a ListView control. When I try to add items to my ListView, nothing happens. I was using this code before, and it didn't work. I have 3 columns, with the SubItem values set to 1, 2, and 3. LVITEM item; item.mask = LVIF_TEXT; item.cchTextMax = 6; item.iSubItem = 1; item.pszText = TEXT...

Continously Read/Write Data with Pipes Win32

Hello, I am trying to write a GUI program for a command line program in Win32 using WinAPI (so please no MFC). In my current attempt, I am creating an input pipe and an output pipe to read/write data. However, my problem comes in when I attempt to continuously read from a program or to simply write after a single read due to the way I h...

Determine whether a file is in use in Perl on Windows

Hi there, I'm writing some Perl which takes TV shows recorded on Windows Media Center and moves/renames/deletes them depending on certain criteria. Since the Perl runs fairly frequently, I'd like to cleanly determine whether or not the file is in use (in other words, the show is in the process of being recorded) so I can avoid doing an...

Forcing the creation of a WPF Window's native Win32 handle

I need to access the Win32 window handles of some of my WPF windows so I can handle Win32 activation messages. I know I can use PresentationSource.FromVisual or WindowInteropHelper to get the Win32 window handle, but I am running into problems if the WPF window has not been created yet. If I use PresentationSource.FromVisual and the wi...

One time Hook DLL initialization

My program uses SetWindowsHookEx to set a global hook function in my DLL. However I want the DLL to work with a file so I need it a file to be opened once. I can't use DllMain's DLL_PROCESS_ATTACH because it's called multiple times. What is the best solution to my problem? ...

Help with Asynchronous I/O

I have been doing a lot of searching and still can't seem to figure out how to fix my issue. I am writing a GUI program (in WinAPI so no MFC please) to communicate with another program (command line based). I am using anonymous pipes since everything is local (but perhaps named pipes would be better?) which then I use CreateProcess(); to...