createwindow

Win32 C++ SetLayeredWindowAttributes is either fully opaque or fully transparent; nothing in between

好久不见. 提交于 2021-02-07 10:20:57
问题 So I have a 2nd Window created within my program like: #define WINDOW_CLASS_NAME "WINCLASSFULL" WNDCLASSEX winclass; LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } some function { HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL); // first fill in the window class stucture winclass

深入delphi编程理解之消息(一)WINDOWS原生窗口编写及消息处理过程

ⅰ亾dé卋堺 提交于 2020-01-17 19:45:16
  通过以sdk方式编制windows窗口程序,对理解windows消息驱动机制和delphi消息编程有很大的帮助。 sdk编制windows窗口程序的步骤: 1、对TWndClass对象进行赋值; 2、向系统注册wndclass对象(RegisterClass); 3、CreateWindow创建窗口,获得窗口句柄Hwnd; 4、显示窗口(ShowWindow); 5、通过GetMessage函数不断获取系统消息,交给程序处理,程序过通回调函数(wndproc)处理系统消息。(消息处理部分)程序代码如下: program Project2; //{$APPTYPE CONSOLE} uses Windows, Messages; //============================================================================== // 定义回调函数 Wndproc(),处理windows消息; // 参数说明: // HWND 可以理解为窗口句柄 // AMessage 可理解为消息的编号 // Wparam 消息的高位 // Lparam 消息的低位 //==============================================================================

C语言Windows程序设计 -> 第十三天 -> 按钮类控件

我是研究僧i 提交于 2020-01-10 19:03:39
C语言Windows程序设计 -> 第十三天 -> 按钮类控件 终于到了令人激动的时刻, 尽管在前一阶段的学习中我们已经学习了如何在客户区中绘制简单的图形以及如何使用键盘和鼠标, 但是距离 Windows意义上的软件 似乎还是有点遥远, 而今天, 我们要做的就是将这个距离再缩短一大步! 这阶段要学习的就是 子窗口控件 的使用。 在其他一些 Windows应用软件上我们经常能够看到一些大致相同的按钮、复选框、组合框、列表框等控件, 这些控件很有可能就是使用 标准子窗口控件 来实现的。 一、子窗口的创建 在讲解 "标准子窗口控件" 的使用之前我们首先应该知道如何去创建一个子窗口, 因为这些 "子窗口控件" 实际上都是通过创建一个子窗口的形式来进行创建的, 因此我们应该把理解的重点放在 "子窗口" 上, 而不是 "控件" 上。 子窗口的创建可以将整个客户区划分为多个矩形区域, 并且每个子窗口都可以有自己的句柄、窗口过程和客户区, 每个子窗口过程只接收与自身窗口有关的鼠标消息、鼠标消息的参数 lParam 中包含的坐标是相对于 子窗口 客户区的左上角的。简单的说, 子窗口具有一个普通窗口的一切特性。 子窗口的创建同样是使用 CreateWindow 函数进行创建的, 下面我们通过一个示例来认识这个过程: 代码已折叠, 点击展开: View Code 1 #include<windows.h

Error 1813 when calling CreateWindow() func WinApi

随声附和 提交于 2019-12-25 04:33:40
问题 I'm new in C++ and WinApi. I can't create a simple window in WinApi. CreateWindow() function returns null. GetLastError() func returns error 1813. But before creating window GetLastError() returns 0. Sorry for my English. Here is my full code: #include <Windows.h> LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) { LPCWSTR szWindowClass = TEXT("WndClass"); LPCWSTR

Create child window in WM_CREATE, relevance of same thread?

限于喜欢 提交于 2019-12-25 01:39:44
问题 A typical pattern is to create a child window in the message callback ( WndProc ) at message WM_CREATE : LRESULT APIENTRY WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { ... switch (message) { case WM_CREATE: .... hwndChild[i] = CreateWindow (szChildClass[i], NULL, WS_CHILDWINDOW | WS_BORDER ... I perfectly understand this is a good opportunity, but is it a problem to do it any time later? One reason for doing so is that the child window is created within the same thread.

CreateWindowEx fails with ERROR_CANNOT_FIND_WND_CLASS

天涯浪子 提交于 2019-12-24 01:42:35
问题 I am trying to create a window with a certain class type ("VSDebugger CDataTipWnd"), however, when I run CreateWindowEx it fails, and GetLastError tells me that the class wasn't found. Here is the code for reference, though it shouldn't matter: const Win32WindowStyles dwStyle = Win32WindowStyles.WS_POPUP; IntPtr wnd = NativeMethods.CreateWindowEx(0L, "VSDebugger CDataTipWnd", "MyWindow", dwStyle, 100, 100, 100, 100, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); I am running as a plug

(Windows API) WM_PAINT Mouse problems

强颜欢笑 提交于 2019-12-23 01:11:25
问题 I created a window with the following flags to overlay a d3d application: WS_EX_TOPMOST | WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED I proceeded with colorkeying the window for transperacy and all worked well. However once I began drawing on it using GDI an unforeseen problem occurred: For some reason the mouse events (especially movement) are not passed correctly through the window when WM_PAINT is in progress, and so it appears as though the mouse and the keyboard for that matter

CreateWindow() -- 创建普通的窗口

邮差的信 提交于 2019-12-21 11:21:57
(1)函数原型 1 HWND CreateWindow( 2 LPCTSTR lpClassName, //pointer to register class name 3 LPCTSTR lpWindowName, //pointer to window name 4 DWORD dwstyle, //window style 5 int X, //horizontal position of window 6 int Y, //vertical positon of window 7 int nWidth, //window width 8 int nHeight, //window height 9 HWND hWndParent, //handle to parent or owner window 10 HMENU hMenu, //handle to menu or child-window identifier 11 HANDLE hInstance, //handle to application instance 12 LPVOID lpParam //pointer to window-creation data 13 } (2)函数说明 该函数创建一个重叠式、弹出式窗口或子窗口。CreateWindow函数指定窗口类型、窗口标题、窗口样式和窗口的初始位置及大小

Why CreateWindowEx() return NULL

三世轮回 提交于 2019-12-11 14:21:40
问题 I learn the example on MSDN, but when I code, I have big trouble with CreateWindowEx(). It's return NULL, so it can't create a window. I don't understand why it return that. This code follow MSDN example. Here's my code: #include <Windows.h> LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); int WINAPI wWinMain(HINSTANCE hIns, HINSTANCE hPreIns, PWSTR pCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPreIns); UNREFERENCED_PARAMETER(pCmdLine); HWND hWnd; TCHAR

Creating a Win32 Window app with English title bar, but the title bar becomes Chinese out of nowhere. How come?

 ̄綄美尐妖づ 提交于 2019-12-10 21:32:09
问题 HWND wndHandle; //global variable // code snipped WNDCLASSEX wcex; // code snipped wcex.lpszClassName = (LPCWSTR) "MyTitleName"; // code snipped wndHandle = CreateWindow( (LPCWSTR)"MyTitleName", //the window class to use (LPCWSTR)"MyTitleName", //the title bar text ... ... I am following a tutorial for Win32 Window application. The code above is used to set the name of the title bar of the window screen. The compiler yells at me : "cannot convert from 'const char [12]' to 'LPCWSTR'" so okay,