winapi

Block ESC and Enter keys in modeless dialog box (Win32, non-MFC)

风格不统一 提交于 2021-02-10 14:32:44
问题 There're some articles written on this subject, but none of them worked in my case. I'm writing the following using Win32 (no MFC). The goal is to prevent ESC or ENTER keys from closing the modeless dialog box. Here's the dialog template: IDD_DIALOG_1 DIALOGEX 0, 0, 345, 179 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "New Pt",IDC_CHECK_NEW_PT,"Button",BS_AUTOCHECKBOX | BS

VBA How to use FindWindowEx when have Windows Handle

北城以北 提交于 2021-02-10 14:29:42
问题 I have looked over the numerous "similiar questions" that pop up when you submit a question but unfortunately none of these fit my problem, plus they are all in c++ or c#. I found this and it has helped me get the handle : My problem now is that how am I to use this handle to click "No" on this window: My code below is working to retrieve the handle without error (I assume the handle output is correct), however I am unsure where to go, where to look for help on how to use the handle to click

WINAPI: Colored Border for Static Dialog Item

匆匆过客 提交于 2021-02-10 12:58:34
问题 I have a dialog box in win32 api. I have a Static Element which has been created as below. lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary lpdit = (LPDLGITEMTEMPLATE)lpw; lpdit->x = 12; lpdit->y = 36; lpdit->cx = 75; lpdit->cy = 7; lpdit->id = ID_ERROR_MSG; lpdit->style = WS_CHILD | SS_BITMAP | WS_VISIBLE ; lpw = (LPWORD)(lpdit + 1); *lpw++ = 0xFFFF; *lpw++ = 0x0082; // Static class lpwsz = (LPWSTR)lpw; nchar = MultiByteToWideChar(CP_ACP, 0, errorMsg.c_str(), -1, lpwsz, 50);

WINAPI: Colored Border for Static Dialog Item

泄露秘密 提交于 2021-02-10 12:56:55
问题 I have a dialog box in win32 api. I have a Static Element which has been created as below. lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary lpdit = (LPDLGITEMTEMPLATE)lpw; lpdit->x = 12; lpdit->y = 36; lpdit->cx = 75; lpdit->cy = 7; lpdit->id = ID_ERROR_MSG; lpdit->style = WS_CHILD | SS_BITMAP | WS_VISIBLE ; lpw = (LPWORD)(lpdit + 1); *lpw++ = 0xFFFF; *lpw++ = 0x0082; // Static class lpwsz = (LPWSTR)lpw; nchar = MultiByteToWideChar(CP_ACP, 0, errorMsg.c_str(), -1, lpwsz, 50);

Get Mouse Wheel Scroll usin Win32api in Python

自作多情 提交于 2021-02-10 12:47:06
问题 I want to read mouse wheel scroll events and then simulate them. I know I can simulate it using below code. #Scroll one up win32api.mouse_event(MOUSEEVENTF_WHEEL, x, y, 1, 0) #Scroll one down win32api.mouse_event(MOUSEEVENTF_WHEEL, x, y, -1, 0) However, I couldn't find a way to get whell scroll event using win32api in python. Is there anyway to detect wheel scroll up or down events? 回答1: If you need to get the global WM_MOUSEWHEEL message, you can use the SetWindowsHookEx function and with WH

Send windows message to a console application

╄→尐↘猪︶ㄣ 提交于 2021-02-10 12:46:14
问题 I have a DLL that send message to the UI application, most of the messages that the DLL send contains text in them, the GUI application get the message and act according to the message. I need to create a console application that works with the same DLL, Is there any option to get the messages to the console application, as in console application I do not have a windows message procedure. In the GUI application I load the DLL and use one of its function to set my current HWND to the DLL, once

CreateDC() causes glutInit() to fail?

℡╲_俬逩灬. 提交于 2021-02-10 12:23:25
问题 I wrote a code that creates a window and draws a shape into it: #include<glew.h> #include<iostream> #include<GL\freeglut.h> #include<Windows.h> #include<stdlib.h> #include<math.h> #pragma once void Render_All() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glColor3f(1, 0, 0); glVertex2f(0.5, 0.5); glColor3f(1, 0, 0); glVertex2f(0.5, -0.5); glColor3f(1, 0, 0); glVertex2f(-0.5, -0.5); glColor3f(1, 0, 0); glVertex2f(-0.5, 0.5); glEnd(); glFlush(); } int main(int argc, char** argv) {

CreateDC() causes glutInit() to fail?

只谈情不闲聊 提交于 2021-02-10 12:23:07
问题 I wrote a code that creates a window and draws a shape into it: #include<glew.h> #include<iostream> #include<GL\freeglut.h> #include<Windows.h> #include<stdlib.h> #include<math.h> #pragma once void Render_All() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glColor3f(1, 0, 0); glVertex2f(0.5, 0.5); glColor3f(1, 0, 0); glVertex2f(0.5, -0.5); glColor3f(1, 0, 0); glVertex2f(-0.5, -0.5); glColor3f(1, 0, 0); glVertex2f(-0.5, 0.5); glEnd(); glFlush(); } int main(int argc, char** argv) {

`SetWindowLong()` function doesn't change window style even after calling `SetWindowPos()`

故事扮演 提交于 2021-02-10 12:15:26
问题 I create the static control with the code below: hWnd = CreateWindowExW( 0, L"STATIC", Content.c_str(), SS_LEFT | WS_VISIBLE | WS_CHILD /*| SS_SUNKEN*/, 200, 120, 120, 40, hWndParent, NULL, hInstance, NULL); If I enable the SS_SUNKEN style in the creation code above, the created static control appears sunken successfully. But, what I'm trying to do is the change the control style after its creation. I tried this: void BaseWindowClass::AddStyle(DWORD NewStyle) { // NewStyle = 0x00001000 = SS

`SetWindowLong()` function doesn't change window style even after calling `SetWindowPos()`

梦想与她 提交于 2021-02-10 12:14:27
问题 I create the static control with the code below: hWnd = CreateWindowExW( 0, L"STATIC", Content.c_str(), SS_LEFT | WS_VISIBLE | WS_CHILD /*| SS_SUNKEN*/, 200, 120, 120, 40, hWndParent, NULL, hInstance, NULL); If I enable the SS_SUNKEN style in the creation code above, the created static control appears sunken successfully. But, what I'm trying to do is the change the control style after its creation. I tried this: void BaseWindowClass::AddStyle(DWORD NewStyle) { // NewStyle = 0x00001000 = SS