winapi

Getting the file handles of given process

Hi, I need a way for getting all of the file handles of a given process. for example, given a the winword.exe process handle, i would like to get the list of the file handles of that process (doc files etc). i'm using the Win32 api via C#/pInvoke. Thanks! ...

How can I control a Windows GUI application from Perl?

I have a Win32 GUI proccess. Is there any way to control the GUI proccess input within another process (application built in Perl)? the user have a scanning system i want to identify when the keys dispatched by the scanning system check them if they are digits and then suffix them with \n character then send them to the GUI application? ...

How do I remove the icon and title from a WPF Window but display it in the taskbar?

I'm trying to create a WPF window, which has no icon and no title displayed in the titlebar. I already found some examples how the icon can be removed (for example here), but all these solutions work if I'm debugging the application in Visual Studio but they don't work when I'm just running the executable. I would also like the title n...

How to program a mouse click on Mac OS X and on Linux?

I know how to program a click on Win32 (click on the screen programmatically) using C or Ruby. Does anyone know how to do it on Mac OS X and Linux just as a comparison? thanks. ...

C# - Determine if user is moving a window

I am going to be checking if the user is moving any window around (my application does not have an interface) and respond accordingly. What do you think is the best way to do this? Can I determine if the user is clicking on a titlebar? Can I determine if a window is being moved? I then need to grab the hWnd of the window after I know it'...

What Windows message is sent to repaint a partially occluded window?

I know that WM_PAINT tells a window that it needs to repaint itself entirely, but apparently that's not the message that gets sent when it's been covered partially and then the window that was in front of it is no longer in the way and it needs to repaint the dirty portion. Does anyone know what message is sent in this case? EDIT: Foun...

Win32 API FindFirstFile and FindNextFile performance vs command line

We have encountered an unexpected performance issue when traversing directories looking for files using a wildcard pattern. We have 180 folders each containing 10,000 files. A command line search using dir <pattern> /s completes almost instantly (<0.25 second). However, from our application the same search takes between 3-4 seconds. We...

Intermittent issues with Win32 named events

Hi all, Experiencing intermittent issues, related to named events when processes are running in different user contexts: WaitForSingleObject (and WaitForMultipleObjects too) for such event handle fails with WAIT_FAILED (GetLastError returns 6 - Invalid handle value). We have an application to schedule tasks on Windows machines under us...

How can I intercept keyboard events with Perl?

Is there any way on Perl to identify if a keyboard event is triggered on Win32 before the key itself reach its GUI application ? ...

Using Windows named pipes from inside activeX control - Possible?

Hi All, I am starting to design a DMO to run from inside a windows media player activeX control in Internet Explorer. is there any reason why using windows named pipes from inside the DMO wouldn't work? user permissions/privilages/ kernel mode stuff? Thanks :) Roey ...

Sending message to different thread

Is there any API to send message to a thread? Basically I have only threadId available and I want to send a custom message to that thread. ...

not able to install hooks for all threads in a process

I am hooking keyboard in application . Requirement is to hook keyboard in all threads in the process. I used SetWindowsHookEx API SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC)::KeyboardHookProc, hInst, 0); The hook is created for all the threads in process. This works fine until calling thread exists .As soon as calling thread terminat...

How to find out if a thread has message queue?

Is there any way to find out from threadId , if a thread has message queue or not? Basically there are some windows api which only work if a thread has message queue.window ...

How to call NetUserModalsGet() from C#.NET?

EDIT: followup at http://stackoverflow.com/questions/1791377/netusermodalsget-returns-strings-incorrectly-for-c-net I'm struggling with the DLL declarations for this function: NET_API_STATUS NetUserModalsGet( __in LPCWSTR servername, __in DWORD level, __out LPBYTE *bufptr ); (Reference: http://msdn.microsoft.com/en-us/libr...

Win32.: How to scrape HTML without regular expressions?

A recent blog entry by a Jeff Atwood says that you should never parse HTML using regular expressions - yet doesn't give an alternative. i want to scrape search search results, extracting values: <div class="used_result_container"> ... ... <div class="vehicleInfo"> ... ... ...

NetUserModalsGet() returns strings incorrectly for C#.NET

EDIT: Yet another followup at http://stackoverflow.com/questions/1799742/shouldnt-netusermodalsget-tell-me-what-domain-a-machine-is-part-of-and-where Thanks to Gonzalo's help, I'm able to use the NetUserModalsGet() from C#. But there's still some kinks: the string members (usrmod1_primary and usrmod2_domain_name) come out messed up. Her...

What does explorer use to open a file?

I'm attempting to hook into whatever explorer calls when a file is opened (double-click, context menu open, etc.), however I can't figure out which function that is. Originally, I thought it was ShellExecute, as that does the same thing as far as I can tell, but after hooking into it I learned that it's only used when a new explorer win...

Variable item height in TreeView gives broken lines

Wee. So I finally figured out how the iIntegral member of TVITEMEX works. The MSDN docs didn't think to mention that setting it while inserting an item has no effect, but setting it after the item is inserted works. Yay! However, when using the TVS_HASLINES style with items of variable height, the lines are only drawn for the top part ...

Difference between WinMain and wWinMain

The only difference is that Winmain takes char* for lpCmdLine parameter, while wWinMain takes wchar_t*. On Windows XP, if an application entry is WinMain, does Windows convert the command line from Unicode to Ansi and pass to the application? If the command line parameter must be in Unicode (for example, Unicode file name, conversion...

EncryptMessage returns SEC_E_INVALID_TOKEN

Hi When using the EncryptMessage (SChannel) from the win32 API with a valid context, I am supplying the four buffers in the correct order I get the SEC_E_INVALID_TOKEN response which according to the documentation is No SECBUFFER_DATA type buffer was found. I know that the set of pvBuffers should be allocated from contiguous memory for ...