winapi

change minimize effect in C#

I'm trying to change the default windows minimize effect with a C# winforms app. I have no idea where to start. Maybe I should set some kind of hook or something? I just need to know, when a window likes to be minimized, the minimizing itself is no problem. Anyone having any ideas?? ...

Access denied while getting process path

Hello, I am trying to get process path by pid but I'm getting Win32Exception (access id denied). The code looks like this: string path = Process.GetProcessById(pid).MainModule.FileName I have tried using OpenProcess with GetModuleFileNameEx but OpenProcess is returning 0. I even tried enabling SeDebugPrivilege according to C# – How ...

DuplicateHandle: need to OpenProcess, but the access is denied

Using windows hooks I send messages to my application, which is notified about Windows events by every application on the system. To execute marshal of the message parameters, I use shared memories. The external process calls DuplicateHandle, but for sharing the handle with my application instance, it shall call OpenProcess with PROCESS...

Call StrFormatByteSize64 function from within C#

Hi!, how can I call the StrFormatByteSize64 function from the Win API from within C#? I'm trying the following code, but without success: [DllImport("shlwapi.dll")] static extern void StrFormatByteSize64(ulong qdw, char[] pszBuf, uint cchBuf); char[] temp = new char[128]; ulong size = 2000; StrFormatByteSize64(size, temp, 128); Console...

How can I find the typelib identifier of the DirectShow interfaces for use with COM4j

I'm trying to interact with a webcam from Java on Windows (without going through the FMJ or JMF frameworks) by using COM4j. However, I'm unable to find the typelib identifier for Direct Show in order to build the interfaces. The COM4j site recommends using OleView to find the typelib, but I've gone through the list of typelibs there an...

How do I retrieve an error string from WSAGetLastError()?

I'm porting some sockets code from Linux to Windows. In Linux, I could use strerror() to convert an errno code into a human-readable string. MSDN documentation shows equivalent strings for each error code returned from WSAGetLastError(), but I don't see anything about how to retrieve those strings. Will strerror() work here too? How ...

How do you create an application with a unique GUI like Valve's Steam?

Valve's game manager application, Steam, has a very unique user interface, with custom buttons and windows. How would you create a Win32 application that has such a look? ...

What can cause SysFreeString to hit an Int 3 breakpoint?

I've got some code that worked fine under Delphi 2007 but breaks under D2010. It involves passing in a string, converting it to a PWideChar (specifically, a WideString pointer, not a UnicodeString pointer), doing some processing, and then calling SysFreeString on it. It works fine until a blank string is passed in, then SysFreeString b...

Handle in a console app

I have a console app in .net that I'm doing some processing of fonts. I'm using Win32APIs for this and one of them requires a device context for loading a font - actually a IntPtr hdc = GetDC(handle of screen element). Obviously, my app doesn't have these handles as it's a console app. Is there a way to get around this? ...

ICMP win32 api declaration in vb6

Hello guys, Can anybody help me with the declaration of these fucntions Icmp6CreateFile, Icmp6SendEcho2, and Icmp6ParseReplies or an offline tool that list the declaration for the windows api up to windows vista or win7 ...

Why the DrawItem method of my owner draw listbox can't be called

I try to write a owner draw listbox with WTL. My code looks like this template class ATL_NO_VTABLE CMyListBoxImpl : public CWindowImpl, public COwnerDraw { ... BEGIN_MSG_MAP(CMyListBoxImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) ...

How do I request admin privs

1) is it possible to gain admin privs (i.e. "Run as administrator") during runtime, or must the EXE launch this way from the start? 2) how do I request admin privs, so the user is given the prompt to allow or disallow it? Thank you -Carl ...

How do I put a checkmark on a menu item that has submenu items. (Visual studio 2008 C++/MFC)

I have a menu that contains submenus. eg: Item1 Item2 Item3 item A Item B Item3 has items under it. At any given time 1, 2, or the items under 3 should be checked. Since I don't have an ID for Item3 I have to use the MF_BYPOSITION indicator when I try to set a check on Item3 to indicate one of its children has a checkmark. Item...

Can someone decipher whether timeGetTime() or QueryPerformanceCounter/QueryPerformanceFrequency has lower overhead or/and accuracy?

The idea is that an existing project uses timeGetTime() (for windows targets) quite frequently. milliseconds = timeGetTime(); Now, this could be replaced with double tmp = (double) lpPerformanceCount.QuadPart/ lpFrequency.QuadPart; milliseconds = rint(tmp * 1000); with lpPerformanceCount.QuadPart and lpFrequency.QuadPart being...

Spying while dragging the windows title bar

Let's suppose a click on a normal WS_OVERLAPPEDWINDOW window's title bar, followed by a few mouse drags and a button release. Summary of messages obtained from Spy : WM_SYSCOMMAND (SC_MOVE) WM_MOUSEMOVE (*) WM_CAPTURECHANGED WM_ENTERSIZEMOVE WM_MOUSEMOVE (*) . . . WM_MOUSEMOVE (*) WM_LBUTTONUP (*) WM_CAPTURECHANGED WM_EXITSI...

Linking the Windows API

Hello, I was using a ITK library. When I wrote a sample program using this library, I've got following linker errors. As we can see these all "unresolved" symbols are Windows API functions and these windows API functions were used by ITK library and not my program. Error 1 error LNK2019: unresolved external symbol _SnmpUtilVarBind...

Best way to handle dialog population?

In my application, I have a large structure of many objects and children. I'm designing a set of property sheets that you can open to inspect a specific object (and it's base classes) so you can modify them directly. What's the best strategy for populating these dialogs? The current design is to test the current object on dialog open,...

Why can't I see WM_VSCROLL messages in my wndproc when using WS_VSCROLL style?

I'm creating a message loop in plain C that interfaces to my Harbour-based project. So far, everything works just fine, except for scrollbars in dialogs which have the WS_VSCROLL style. My message loop doesn't seem to see the WM_VSCROLL message, but it does see the WM_NCLBUTTONDOWN message with the HTVSCROLL value in Msg.wParam. Anybody ...

Sending Keyboard Commands

How would I send a keyboard command, so that they press "Y", then hit enter. Thanks ...

ISynchronize->Reset() fails with error result 0x80010120

When I run the following code: ISynchronize *sync_p; res = CoCreateInstance(CLSID_StdEvent, NULL, CLSCTX_INPROC, IID_ISynchronize, (LPVOID *)&sync_p); if (!SUCCEEDED(res)) _com_issue_error(res); res = sync_p->Reset(); The final line fails with error code 0x80010120 - "There are no synchronize objects to wait on...