winapi

How can I load the same icon as used by MessageBox on Windows 10?

落爺英雄遲暮 提交于 2021-02-15 05:07:44
问题 On Windows 10 calling LoadIcon asking for the standard icon IDI_INFORMATION yields this icon: On the other hand, calling MessageBox passing IDI_INFORMATION produces a dialog that uses this icon: How can I obtain the second icon, if the obvious call to LoadIcon does not do so? 回答1: This feels like a bug in user32.dll but Windows 8 has the same issue so I guess Microsoft doesn't care. You can get the flat icon used by MessageBox by calling SHGetStockIconInfo: SHSTOCKICONINFO sii; sii.cbSize =

How can I load the same icon as used by MessageBox on Windows 10?

梦想的初衷 提交于 2021-02-15 05:06:34
问题 On Windows 10 calling LoadIcon asking for the standard icon IDI_INFORMATION yields this icon: On the other hand, calling MessageBox passing IDI_INFORMATION produces a dialog that uses this icon: How can I obtain the second icon, if the obvious call to LoadIcon does not do so? 回答1: This feels like a bug in user32.dll but Windows 8 has the same issue so I guess Microsoft doesn't care. You can get the flat icon used by MessageBox by calling SHGetStockIconInfo: SHSTOCKICONINFO sii; sii.cbSize =

Is it possible to create a winapi window with only borders

坚强是说给别人听的谎言 提交于 2021-02-14 18:31:37
问题 So I'm trying to create a window that only shows its borders and have the rest of the body be see through. I've created a mockup of what that would look like in my head: I tried blitting in a buffer with transparent pixels but that did not have the desired effect. Any ideas ? 回答1: This is possible by passing the WS_EX_NOREDIRECTIONBITMAP 1 extended window style to a call to CreateWindowEx. This prevents the system from allocating a render surface for the window's client area, leaving the

MFC Change CMFCToolBar button to Toggle instead of press/release?

ぃ、小莉子 提交于 2021-02-11 16:16:30
问题 I found an article online that said to setup the toolbar button to be a type that stays pressed you just set a style TBBS_CHECKBOX on the button but it doesn't work for me (it still acts like a normal button). I confirmed the style is set, just after created and the SetWindowText() MFC wizard setup of CMainFrame::OnCreate() . What am I doing wrong? for (int i=0; ; i++) { int id=m_wndToolBar.GetItemID(i); if (id==0) { break; } if (id == ID_THE_ID) { m_wndToolBar.SetButtonStyle(i, TBBS_CHECKBOX

MFC Change CMFCToolBar button to Toggle instead of press/release?

自古美人都是妖i 提交于 2021-02-11 16:13:53
问题 I found an article online that said to setup the toolbar button to be a type that stays pressed you just set a style TBBS_CHECKBOX on the button but it doesn't work for me (it still acts like a normal button). I confirmed the style is set, just after created and the SetWindowText() MFC wizard setup of CMainFrame::OnCreate() . What am I doing wrong? for (int i=0; ; i++) { int id=m_wndToolBar.GetItemID(i); if (id==0) { break; } if (id == ID_THE_ID) { m_wndToolBar.SetButtonStyle(i, TBBS_CHECKBOX

SetKeyboardState doesnt work properly

﹥>﹥吖頭↗ 提交于 2021-02-11 15:46:39
问题 I have program, then it's running it asks stuffs and then user has to press 1 to proceed I use GetKeyState() function to decide if number was pressed and SetKeyboardState() to set keys states back to original, but it doesn't work after second attempt. Whats wrong? Code: BYTE States[256]; GetKeyboardState(States); cout << press 1 << endl; while(!Started) { if(GetKeyState(VK_NUMPAD1)) { Started = true; } } SetKeyboardState(States); cout << "press 1" << endl; while(!Name) { if(GetKeyState(VK

SetKeyboardState doesnt work properly

蹲街弑〆低调 提交于 2021-02-11 15:46:02
问题 I have program, then it's running it asks stuffs and then user has to press 1 to proceed I use GetKeyState() function to decide if number was pressed and SetKeyboardState() to set keys states back to original, but it doesn't work after second attempt. Whats wrong? Code: BYTE States[256]; GetKeyboardState(States); cout << press 1 << endl; while(!Started) { if(GetKeyState(VK_NUMPAD1)) { Started = true; } } SetKeyboardState(States); cout << "press 1" << endl; while(!Name) { if(GetKeyState(VK

C Windows API determine if user inactive for certain period

吃可爱长大的小学妹 提交于 2021-02-11 15:45:56
问题 So I've created a basic program with a blocking message event loop (to use little to no CPU while waiting) and waits for a user to change the foreground window, then executes some code: #include <Windows.h> VOID ExitFunction() { // Do Something } BOOL WINAPI HandlerRoutine(DWORD dwCtrlType) { switch (dwCtrlType) { case CTRL_SHUTDOWN_EVENT: ExitFunction(); return TRUE; case CTRL_LOGOFF_EVENT: ExitFunction(); return TRUE; //default: //We don't care about this event //Default handler is used }

Efficient sampling of audio render client position

扶醉桌前 提交于 2021-02-11 15:44:50
问题 I want to efficiently monitor audio playback position. I understand I can use IAudioClock::GetPosition() and that this is a blocking call that can fail, and should not be called from a thread that is decoding or resampling the audio stream. So I set a waitable timer object with a dedicated thread blocked on it, that then calls IAudioClock::GetPosition() and invokes a callback function to process that. There is the concern of the effect on low power state if the timers frequency is too high,

Efficient sampling of audio render client position

99封情书 提交于 2021-02-11 15:44:45
问题 I want to efficiently monitor audio playback position. I understand I can use IAudioClock::GetPosition() and that this is a blocking call that can fail, and should not be called from a thread that is decoding or resampling the audio stream. So I set a waitable timer object with a dedicated thread blocked on it, that then calls IAudioClock::GetPosition() and invokes a callback function to process that. There is the concern of the effect on low power state if the timers frequency is too high,