winapi

In C++ Win32 app how can I determine private bytes, working set and virtual size

I'm writing some code for educational purposes and I'd like to be able to print these memory usage values out from a windows console program written in C++. ...

Serial Port Communication Issues (C code)

I recently tried to get access to a serial communication using a Bluetooth usb dongle. I used the C code below, and keep getting error 5, which is “Access denied”. I am the administrator for the system (which seemed to be the common solution to this problem on the forums) and no other application is accessing the same port I am using (al...

Switching stacks in C++

I have some old code written in C for 16-bit using Borland C++ that switches between multiple stacks, using longjmps. It creates a new stack by doing a malloc, and then setting the SS and SP registers to the segment and offset, resp., of the address of the malloc'd area, using inline Assembler. I would like to convert it to Win32, and ...

If you add extra data space to a DialogBox class be accessed by GetWindowLongPtr, should you add DLGWINDOWEXTRA to access this extra space?

When creating a window class for use with a DialogBox you need to add DLGWINDOWEXTRA to cbWndExtra. If you add extra data space to a DialogBox class be accessed by GetWindowLongPtr, should you add DLGWINDOWEXTRA to access this extra space? (I'll confess that I think I know the answer, and that way the code doesn't break. But, I want to...

Detect RPC client crash on the server side when using binding handles

A server application is using Microsoft RPC for interprocess communications. It starts an RPC server with an endpoint corresponding to a connection-oriented protocol (ncacn_np for example). Multiple clients call methods in this server using binding handles. Is it possible for the server to detect that a client that invoked any given clie...

What's the difference between RpcTestCancel and RpcServerTestCancel?

Descriptions of RpcServerTestCancel() and RpcTestCancel() look very similar. What's the difference between them? ...

How do I plot the output from a C++ Win32 console app?

I have a small Win32 console application which is essentially a test harness. I read data in, do some processing on it and currently just output some of the numbers to the console. This isn't a huge problem - I can get an idea of what the data looks like, but it would be much easier to analyse if there was a way of getting that informati...

What are Windows "USER objects"

I'm trying to track down an issue in our MFC code that looks like a resource limitation issue. Memory and CPU look fine. According to the processes tab on the Task manager our GDI objects look in line with other applications, but our USER objects appear to be a factor of 10 greater then other applications. What is a "USER object" and...

How to change the default paper size in windows programmatically?

How to change the default paper size in windows programmatically? ...

About Mutex object in Vista

My OS is Vista with UAC turned on, I create a global Mutex object in Server side, then my AP with UI want to use CreateMutex with same name to get the Mutex object which has been created in server, but the function tell me I don't have right to access it. How can I do it? ...

Video for Windows error 80044066

I'm using Video for Windows to record screen grabs to AVI files. Usually it works fine, but some users report the error: AVI error (80044066): Bad format Any explanations of what this error means and what might be causing it would be gratefully accepted. ...

How can I see what is on the Desktop Heap

I have an application that is using about 100k more of the Desktop Heap in this version then it did last version. Is there a way I can see what is on the Desktop Heap and how big the individual objects are? Using Dheapmon I was able to see what percentage of the heap I was using, but I want more details. ...

How to know child process status and resource usage on windows?

I want to write a program, which will launch a child process. The child process may be windows mode or console mode program. I want to monitor the child process status and resource usage. e.g. I want to know the child process is still running or terminated. If it terminated, I want to know the reason (is terminated normally or because o...

Rails Deployment on Win32 Best Practices: Lighty + Sgci

I've received some really great guidance from users of this site, and I'm thinking some advanced Rails people could assist me in resolving the following problem. I'm attempting to deploy a simple Rails application on a win32 server. I've been carefully working through these instructions (see http://functionalelegant.blogspot.com/2008/0...

What's the differences between VirtualAlloc and HeapAlloc?

There are lots of method to allocate memory in windows enviorment, such as VirtualAlloc/HeapAlloc/malloc/new. Thus , what's the difference among them? ...

Win32: Get message notification of other application's close/exit.

Hello , My application needs to monitor all other running applications on the system. Is there some way I could get notified on exit of every application exe? The methods I could find: 1) Use PSAPI functions to get the list of running exes at frequent intervals. At each poll compare with the previous list to find which application/pro...

What are all the differences between WH_MOUSE and WH_MOUSE_LL hooks?

I've found that WH_MOUSE is not always called. Could the problem be that I'm using WH_MOUSE and not WH_MOUSE_LL? The code: class MouseHook { public: static signal<void(UINT, const MOUSEHOOKSTRUCT&)> clickEvent; static bool install() { if (isInstalled()) return true; hook = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)&mousePr...

How can I limit resource usage of process?

In short, I want to find windows equivalent way of unix setrusage() function. Can I limit resource usage for particular process? For example, 10 seconds cpu time and 50mb memory size. If the process run more than 10 seconds or consumes more than 50mb memory, the process will be terminated by windows. ...

Watching Global Events created by a native process in a .NET process.

I have a global event created and set/reset in a native C++ process that are created like this: HANDLE hGlobalEvent = CreateEvent(NULL, TRUE, FALSE, _T("Global\\MyEvent")); Is there any way (even if it's with a library not written by MS) to register for one of these events in a .NET (C#) process so that I standard .NET events handlers...

Problem with Filtering Windows Messages in a Hook Filter Function

I am trying to retrieve messages for another application with a Windows hook. I have setup a WH_GETMESSAGE hook with SetWindowsHookEx. This is done via a DLL. In my GetMsgProc fuction (that should be called whenever the target application recieves a message) I want to take action based on the type of message. However I am having trou...