winapi

Howto obtain Per-Interface statistics on windows

I am trying to find the most used Network card on windows 200 or XP. I planned to obtain the number of packets sent trough each NIC to determine the main NIC. I thought IP Helper might give me this information but also it looks like the functions in IP helper only give stats for all interfaces. I know this can be done. Any ideas? Ma...

How to reliably capture win32 console screen buffer changes?

Is there any way to reliably capture all changes made to the win32 console buffer, as they happen? The idea is to convert the screen updates of a text mode app to ANSI escape sequences, for a telnet/ssh server. I need to capture cursor movements, colors, window title, etc. Mouse clicks, too, if possible. The only technique I've seen ...

How do I create a Win32 DLL without a dependency on the C runtime

Using Visual Studio 2008 and its C/C++ compiler, how do I create a Win32 DLL that is dependent only on other Windows DLLs, and has no dependency on the Microsoft C runtime? I have some C code I want to place in a DLL that is entirely computation, and makes almost no use of C library functions. For those it does use (eg memcpy), I'm hap...

Black pictures when making screenshots with PrintWindow

I am doing the screen shots of IE using PrintWindow. The problem is that some times I get images with black areas. It may be a whole html content what is black, some times only certain areas are black. The content of the IE is NOT changed between taking shots. What is strange is that on some computers I get black images very oftern, on...

Forward declaration problem

I'm having a problem getting forward declaration to work (actually I'm not sure if it should work the way I intend). I have a cpp file as follows: int DialogModeless::Create(int dialogID, Presenter* pPresenter) { Ptrs* pPtrs = new Ptrs; pPtrs->pPresenter = pPresenter; pPtrs->pWnd = _derived; HINSTANCE hInstance = ::GetM...

WIN32, C++: Is it possible to animate a window without hiding it?

I Have an edit control (a text field) which I want to animate. The animation I want is that it slides out, creating an extra line for this text field. I am able to animate my text field and able to make it larger, however to show the sliding animation I first have to hide it. This means the entire text fields slides out as if being creat...

Is there a way to get notifications about windows console oput.

Hello I know I can read console buffer using ReadConsoleOutput function. Is there any way to be notified when console app is outputing text ? Currently I need to set timer and scan the console buffer all the time. Ty. ...

cannot trap VK_RETURN key for subclassed editbox control.

I subclassed an edit box control like lpfnOldWndProc = (FARPROC)SetWindowLong(hEdit,GWL_WNDPROC, (DWORD)SubClassFunc); LRESULT FAR PASCAL SubClassFunc( HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_CHAR: //Process this message to avoid messag...

is there implementation of ctypes(python) in Jruby?

I want to use windows apis in JRuby. Please suggest any api that can do the work of Ctypes(python). ...

How Do I Stop An Application From Opening

Hi Guys, I want to write a small app that sits in my tray and that allows me to select an executable and prevent it from opening. The UI of the app is easy to do using WinForms. What I want to know is how to detect if a certain exe has been lauched and then how to stop it from running. I'm pretty sure I'll have to dig down into some W...

Communication among clients in Delphi 2009

I wanna build a Win32 app of Client/Server (or 3-tier) type with follow features: When the "A" client does a modification (update,insert, etc) into a database, the rest of clients viewing the same record set can get almost "instantly" a fresh view of this data a client can be notified when a connection to database get lost could some...

How to parallelize Windows message loop and hook callback logic and the Ruby threads it creates?

I'm working on a free, simple, hopefully multi-platform hotkey launcher tool, written in Ruby. Right now I'm struggling with some threading issues of the Windows implementation. The rough proof of concept code shown below already works reliably in my day-to-day use: HotkeyProcessor#process_keypress (footnote 1) gets called by the C cod...

Bignum libraries for windows?

Are there any bignum libraries that are good for Windows use? I looked at GMP, but unfortunately it does not look like it can be compiled on Windows...I'm going to be doing some custom RSA and hashing routines, and I need something that can handle extremely large integers. Thanks. ...

CreateProcessWithLogonW and AssignProcessToJobObject

I have a Windows service (under WinXP SP2), running under the LocalSystem account, that launches processes using CreateProcessWithLogonW. In order to clean up child processes, I'm trying to use a job object and TerminateJobObject. MSDN states that the job handle must have JOB_OBJECT_ASSIGN_PROCESS access right, which it has since it's c...

How can I get the current user token for the physical session?

I have some code, with which I'm trying to get the current session user token: #include <Wtsapi32.h> DWORD activeSessionId = WTSGetActiveConsoleSessionId(); HANDLE currentToken; BOOL queryRet = WTSQueryUserToken(activeSessionId, &currentToken); if (!queryRet) { DWORD err = GetLastError(); return 0; } Value of err is 1314. Update...

Windows Mobile double bufferring does not work. Still flickers

Hi All, I am trying to implement double buffered drawing in a windows mobile application. But I still see the flickering. I am using InvalidateRect() in my rendering code(not shown here), instead of Updating the entire window. The rectangle mentioned in this API is flickering when I update/paint. Please help case WM_PAINT:...

Python Win32 - equivalent function to DriveInfo.IsReady

I'm trying to find an equivalent Python function to the Windows function DriveInfo.IsReady. I've spent a while searching through the functions provided by win32api and win32file but I can't find anything (though perhaps that's because I didn't manage to find much useful documentation online, so was simply searching through the listing o...

MessageBox returning 0 if HWND is bad

Is there a case where MessageBox can return 0 other than not enough memory? I have a case where I suspect the HWND I'm passing to MessageBox isn't valid or maybe it belongs to a window that is in the process of being destroyed. In my case the MessageBox isn't displayed and returns 0, but I seem to have enough memory available. ...

Is there any way to prevent a file from being moved in .NET?

I am loading assemblies dynamically and need to prevent being loaded files from being moved via file move or file cut and paste. Windows does prevent the loaded assemblies from being deleted. However, I can still move the files to different directories in the same volume. Do you know of any way to prevent a file from being moved? Tha...

How can I check the digital signature of an .exe or .dll in Perl?

I'm trying to find a way to script (preferably in Perl) - a check to see if an .exe or .dll is digitally signed - if anyone has an easy direction to point me, I'd appreciate it. ...