winapi

Sharing some info with all DLLs pulled into a process

Hi all, We've got an Enterprise system which has many processes (EXEs, services, DCOM servers, COM+ apps, ISAPI, MMC snapins) all of which make use of many COM components. We've recently seen failures in some of the customer deployments, but are finding it hard to troubleshoot the cause. In order to track down the problem, we've augmen...

How do I get mercurial to show the diff during `hg com`?

Is there a way to configure hg com so that in the commit message file that pops up in the external editor, instead of just showing which files were changed (in the HG: lines) it actually shows the full diff? I'd rather view the output and compose my commit message simultaneously from the comfort of my text editor as opposed to doing hg ...

C++ Get Username From Process

I have a process handle with HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, THE_PROCESS_ID); How can I get the username of the user that is running the process? I am using unmanaged code (no .NET). ...

Ruby Win32Api get single character non-blocking

I'm trying to write a simple game working with two threads, one thread to get input from the user, and another thread to animate some scenes. I'm able to get characters without pressing ENTER just fine, but it blocks in the animating thread until the user presses a key. Does anyone know of a way to get a character from the keyboard non...

Win32 API prevent standby

What is the Win32 api function that prevents the system from going into standby? Some programs use it, which is pretty annoying in my opinion. I know there's a couple of WM_SYSCOMMAND messages you can trap to prevent the screensaver from coming on.. ...

Releasing an OLE IStorage file handle in C#

I'm trying to embed a PDF file into a Word document using the OLE technique described here: http://blogs.msdn.com/brian_jones/archive/2009/07/21/embedding-any-file-type-like-pdf-in-an-open-xml-file.aspx I've tried to implement the C++ code provided in C# so that the whole project's in one place and am almost there except for one roadblo...

Windows System programming

Hi i am new to windows system programming and interested in working in it completely using C and win32 api. Can you please give me suggestions on how I can start and any good books to read. Thanks in advance. ...

Close socket handle utility

Hi I need a utility to close server socket handles open by the process, on windows. I cannot use tcpview as it does not close the server socket (ESTABLISHED state). Process explorer comes close with its handle list and "close handle" option, but it only gives the handle path (like \Device\Afd) and if application has open many such socket...

Linker error with RegSetKeyValue.

Hi *, I am using "RegSetKeyValue" API in my application. I am referring to http://msdn.microsoft.com/en-us/library/ms724921(VS.85).aspx. As told in the article, I have defined _WIN32_WINNT_ as 0x0600 and have included Advapi32.lib in my linker options. But still I am getting linker error, "unresolved external symbol _RegSetKeyValue"...

Win32's PathResolve() and root folder

Win32's PathResolve is resolving \temp into c:\temp, even if I run the function from another drive. In addition, IsRelative() returns false for '\temp' - which makes me wonder what kind of resolution it actually thinks it's doing for this path. ...

GetFileAttributesW strange delay

Hello! Some of my users are experimenting a strange delay in one of my programs. The situation: I am copying some file from machine A to machine B. I use CopyFileExW. This works well. Directly after copying the file (if the operation was successfully done), I use GetFileAttributesW to get and modify the created file's attributes. Now t...

Get selected item in ListView win32 API

I try to create list view item like explorer . I want to get the selected item when I double click on it . So I can use it to get the path and find file to display . I can do it in treeview by senddlgmessage. But it looks like it doesn't work on listview . ...

How to send Event signal through Processes - C

Hello all! I have an application consisting of two windows, one communicates to the other and sends it a struct constaining two integers (In this case two rolls of a dice). I will be using events for the following circumstances: Process a sends data to process b, process b displays data Process a closes, in turn closing process b Pro...

Get the path of selected item in ListView - Win32 API

I find a way to get ListView's selected item full path. I do it in treeview by using this: temp = (HTREEITEM)SendDlgItemMessage(hWnd,ID_TREE,TVM_GETNEXTITEM,TVGN_PARENT,(LPARAM)temp); But I don't find familiar method in listview controls. THanks for reading this and I w8 for your answers :) ...

Win32: Is there a difference between Dr. Watson's full/mini dumps and writing my own?

I have an application that is occasionally crashing in the release build; unfortunately, it looks like it is crashing in a 3rd party DLL. While trying to get a handle on it I've been swimming in a sea of HOW TOs and descriptions of how Windows creates crash dumps. I was thinking about using this suggested mini-dump: http://stackover...

Qt grabWindow coordinates shifted from GetCursorPos and GetWindowRect

In Qt, when I use the QPixmap::grabWindow(hwnd,x,y,h,w) function, the coordinates are shifted slightly, when compared to the coordinates using the windows api functions GetCursorPos and GetWindowRect. i.e. (0,0) from the point of view of GetCursorPos and GetWindowRect is at the very top left of the toolbar at the top of the window. But...

Set Carret position in Text Field (Win32API)

I'v created a text box and when it gets focus it sets the caret position to 0 rather than the end. I want to set it to the end. Thanks |Text Here -> Text Here| ...

Where should I catch WM_HIBERNATE and WM_CLOSE in Windows Mobile/WinCE?

I have read about Windows Mobile's X button's behaviour and also about WM_HIBERNATE and WM_CLOSE which are sent on Low Memory Situation to all valid applications. MSDN on WM_HIBERNATE: This message is sent to an application when system resources are running low. An application should attempt to release as many resources as possible ...

How to catch exe crashes from command line

Hello I'm doing batch-testing on our win32 c++ programs. Some of them crash. What's the best way to catch those crash from the command line and report it? thanks edit: answer: 1) you can't catch another process's exception from batch / command line 2) example to do it right in c#: http://stackoverflow.com/questions/673036/how-to-ha...

Is there a way to change the maximum width of a window without using the WM_GETMINMAXINFO message?

I want to change the imposed Windows maximum width that a window can be resized to, for an external application's window (not my C#/WinForms program's window). The documentation of GetSystemMetrics for SM_CXMAXTRACK says: "The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the e...