winapi

How to check how many bytes my application wrote and read from Disk?

夙愿已清 提交于 2021-02-07 06:50:15
问题 I don't know if I didn't use the right words to search on web but I didn't find the solution to watch how much my application already read and wrote on disk. Some one can help me with this ? tks [Resolved] If some one need the function sign. type _IO_COUNTERS = record ReadOperationCount : LONGLONG; WriteOperationCount : LONGLONG; OtherOperationCount : LONGLONG; ReadTransferCount : LONGLONG; WriteTransferCount : LONGLONG; OtherTransferCount : LONGLONG; end; TIoCounters = _IO_COUNTERS; function

How can I validate if a file is name valid in Windows?

余生颓废 提交于 2021-02-07 05:39:23
问题 Is there a Windows API function that I can pass a string value to that will return a value indicating whether a file name is valid or not? I need to verify that a file name is valid, and I'm looking for an easy way to do it without re-inventing the wheel. I'm working in straight C, but targeting the Win32 API. If there's no such function built-in, how would I go about writing my own? Is there a general algorithm or pattern that Windows follows for determining file name validity? 回答1: The

SetWindowsHookEx hook stops working

冷暖自知 提交于 2021-02-07 04:32:26
问题 Keyboard hook not firing events and throws win32 exception on dispose My c# application creates keyboard hook for processing of keyboard events(many card readers, scanners and other POS equipment emulates keyboard). Sometimes my application creates keyboard hook without errors, but it's not firings events and on dispose throws exception: System.ComponentModel.Win32Exception (0x80004005): Failed to remove keyboard hooks for 'app'. Error 1404: Invalid hook handle Other log entry is same error,

Programmatically set Graphics Performance for an app

丶灬走出姿态 提交于 2021-02-07 04:20:57
问题 There is an option in Windows control panel that allows to set a app to "high performance". Control Panel -> System -> Display -> Graphics Settings. On adding my application there, I noticed that, when encoding with Media Foundation and H.265 it uses the NVIDIA gfx adapter for encoding. Before that, it used to use the embedded Intel graphics which would only do H.264 encoding, so H.265 encoding was slowly done in CPU. How can I add my application there programmatically? It's crucial for my

Programmatically set Graphics Performance for an app

谁说胖子不能爱 提交于 2021-02-07 04:17:57
问题 There is an option in Windows control panel that allows to set a app to "high performance". Control Panel -> System -> Display -> Graphics Settings. On adding my application there, I noticed that, when encoding with Media Foundation and H.265 it uses the NVIDIA gfx adapter for encoding. Before that, it used to use the embedded Intel graphics which would only do H.264 encoding, so H.265 encoding was slowly done in CPU. How can I add my application there programmatically? It's crucial for my

Programmatically set Graphics Performance for an app

做~自己de王妃 提交于 2021-02-07 04:16:24
问题 There is an option in Windows control panel that allows to set a app to "high performance". Control Panel -> System -> Display -> Graphics Settings. On adding my application there, I noticed that, when encoding with Media Foundation and H.265 it uses the NVIDIA gfx adapter for encoding. Before that, it used to use the embedded Intel graphics which would only do H.264 encoding, so H.265 encoding was slowly done in CPU. How can I add my application there programmatically? It's crucial for my

What happens if you release an unclean device context?

送分小仙女□ 提交于 2021-02-07 04:08:03
问题 Normally, if a program selects an object into a device context, or changes its properties, it should change them back before releasing the device context. What happens if it doesn't? Let's say I do this: HDC hdc = GetDC(some_window); SelectObject(hdc, some_font); SetTextColor(hdc, 0x123456); SetBkColor(hdc, 0xFEDCBA); SetROP2(hdc, R2_XORPEN); ReleaseDC(some_window, hdc); and some_window 's window class does not have the CS_OWNDC or CS_CLASSDC flag. What happens? 回答1: Of the functions you

How do I hook global shortcuts in Windows?

与世无争的帅哥 提交于 2021-02-07 03:40:15
问题 I remember using a program, some years back, that allowed me to fine-tune my monitor's settings with custom gamma ramps and other adjustments. It had the ability to create different screen-settings profiles for different uses, and setup global hotkey shortcuts to activate them without switching out of the program you're in. My question is, how do you set up the hook for that? I'm sick of WINDOWS-D minimizing everything when I only want access to the desktop in one screen and I want to keep

How do I hook global shortcuts in Windows?

别等时光非礼了梦想. 提交于 2021-02-07 03:37:45
问题 I remember using a program, some years back, that allowed me to fine-tune my monitor's settings with custom gamma ramps and other adjustments. It had the ability to create different screen-settings profiles for different uses, and setup global hotkey shortcuts to activate them without switching out of the program you're in. My question is, how do you set up the hook for that? I'm sick of WINDOWS-D minimizing everything when I only want access to the desktop in one screen and I want to keep

How do I hook global shortcuts in Windows?

不想你离开。 提交于 2021-02-07 03:36:59
问题 I remember using a program, some years back, that allowed me to fine-tune my monitor's settings with custom gamma ramps and other adjustments. It had the ability to create different screen-settings profiles for different uses, and setup global hotkey shortcuts to activate them without switching out of the program you're in. My question is, how do you set up the hook for that? I'm sick of WINDOWS-D minimizing everything when I only want access to the desktop in one screen and I want to keep