winapi

Can I remove a digital signature from a DLL?

My installer build "signs" a DLL using a Code Signing certificate during the build process. I've noticed that if I try to build twice in succession, the second build fails because the DLL is already signed so signcode chokes. Obviously I can fix this by signing a copy of the DLL in the build, but the problem intrigued me: Is it possi...

On Windows, when should you use the "\\\\?\\" filename prefix?

I came across a c library for opening files given a Unicode filename. Before opening the file, it first converts the filename to a path by prepending "\\?\". Is there any reason to do this other than to increase the maximum number of characters allowed in the path, per this msdn article? It looks like these "\\?\" paths require the Uni...

Keyboard Hook... not getting Lower or Upper case characters

The function below is logging the "0", "z" and the "1" ok... but its not capturing the "Z" (shift-z)... any help would be appreciated... __declspec(dllexport) LRESULT CALLBACK HookProc (UINT nCode, WPARAM wParam, LPARAM lParam) { if ((nCode == HC_ACTION) && (wParam == WM_KEYUP)) { // This Struct gets infos on typed key ...

In .NET CF 2.0, will a global keyboard hook interfere with P/Invokes that require a keypress?

My details: custom mobile device running Windows CE 4.2, Compact Framework 2.0 SP1. C# app making decent use of P/Invokes with no problems until now. I've written a low-level keyboard hook (similar to, but not identical to, this CodeProject post) which works marvelously with one exception. One thing that our software does is allow acces...

Learning the WIN32 API

I have very little experience building software for windows, and zero experience using the windows API, is there a good (preferably online), free resource to learn how to use the windows API(preferably with python)? ...

How can I get started programming in C++ on Win32?

I have the need/desire to learn to program against Win32 in C++. I am a little confused as to what Win32 even is, as I have no experience on the platform. What would you recommend to get me started programming and debugging C++ programs on Win32? ...

Windows service shut down

I use VS6 and ATL with CServiceModule to implement a custom windows service. In case of a fatal error service should shut itself down. Since CServiceModule is available via _Module variable in all files I thought of something like this to cause CServiceModule::Run to stop pumping messages and shut itself down PostThreadMessage(_Module.d...

How to find the beginning and end of thread local storage?

How, under Windows and Linux, given a thread handle can I determine the beginning and end of its corresponding static thread local storage block? ...

For any new Win32 application development, are you foregoing .NET?

Are you choosing not to use managed code for any new applications for Win32? Why? Are there resources you need that aren't available from the CLR? (Note "New" - not enhancements to existing codebases.) ...

ReadProcessMemory keeps returning 0

I'm currently developing a little hobby project to display health information in a game on my G15 keyboard through VB.NET. When I use ReadProcessMemory via an API call, it keeps returning zero. The MSDN documentation referred me to use the Marshal.GetLastWin32Error() call to find out what is wrong and it returns 1400: INVALID WINDOW HAN...

IDebugControl::WaitForEvent works once then returns E_HANDLE

I'm trying to make a small tool that makes use of the Debugger Engine API, but I'm having very limited success. I can get my IDebugClient and IDebugControl instances, and from there I am able to attach into an already running user process. I then enter a main loop where I call WaitForEvent, OutputStackTrace, SetExecutionStatus(DEBUG_ST...

Simple anonymous pipes - what wrapper model you use? (WinAPI, C++)

I have two running processes in Windows, and each process has a pipe to the other. I want to serialize a complicated class and transmit it from one process to the other. I already have the serialization procedure worked out, and I understand that the pipes are sending binary streams. How should I go about sending my serialized data? I'm...

How to restore minimized window without flicker

I've made an expose-clone for Vista that sometimes need to restore a minimized window. I've managed to do this with the SetWindowPlacement function. The problem is that this also repaints the window which looks like crap after the window nicely has slided into the screen. This is the code i use to bring a window to the top and give it f...

Disabling redraw in WinForms app

I'm working on a C#.Net application which has a somewhat annoying bug in it. The main window has a number of tabs, each of which has a grid on it. When switching from one tab to another, or selecting a different row in a grid, it does some background processing, and during this the menu flickers as it's redrawn (File, Help, etc menu item...

Where can I find a list of SocketErrorCode and NativeErrorCode thrown by SocketException?

Hi, A SocketException has a SocketErrorCode and NativeErrorCode. I would like to find a list where these codes (or the common onces) are listed so I can respond in proper fasion. Does anybody know where to find such a list? ...

Getting absolute path from relative in Vista seems to fail using Win32/Shell PathCombine()

Hello all, Not sure if this is intended behavior or a bug or a wrong function that I'm using, but the problem is that PathCombine() returns a wrong path on a Vista box. The relative path is (as exported by the WMP to a playlist): ..\..\..\Public\Music\Sample Music\Amanda.wma The path it's relative to is: C:\Users\userX\Music\Playlis...

Reading from a text field in another application's window

Is there a way for a Windows application to access another applications data, more specifically a text input field in GUI, and grab the text there for processing in our own application? If it is possible, is there a way to "shield" your application to prevent it? EDIT: The three first answers seem to be about getting the another applic...

How to cancel the 'system key down' state in Windows

In Windows, when you press Alt, and release it again, the menu bar gets activated. However, when you press Alt, then click, then release, the menu bar does not get activated because presumably you wanted to Alt+click, not activate the menu bar. I want to support Alt+mouse wheel changes (which would map to horizontal scrolling). This wor...

Delphi Win API CreateTimerQueueTimer threads and thread safe FormatDateTime crashes

Hi This is a bit of a long question, but here we go. There is a version of FormatDateTime that is said to be thread safe in that you use GetLocaleFormatSettings(3081, FormatSettings); to get a value and then you can use it like so; FormatDateTime('yyyy', 0, FormatSettings); Now imagine two timers, one using TTimer (interval say ...

.NET Winforms: Can the runtime dispose a form's handle out from under me?

The current declaration of SendMessage over at PInvoke.net is: [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam); Note: The hWnd is no longer an IntPtr, and has been replaced with HandleRef. A very loose explanation fo...