1条回答 默认 最新
快撑死的鱼 2023-01-09 18:49关注回答不易,求求您点赞采纳哦
要在 Windows 动态库 (DLL) 中创建带有输入框的窗口,您需要使用 Windows API。Windows API 提供了一组函数和数据类型,您可以使用它们来创建窗口并与操作系统交互。
下面是一个示例,说明如何在动态库中创建带有输入框的窗口:
#include <windows.h> HWND hwnd; // Window procedure function LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_CREATE: { // Create an input box hwnd = CreateWindowEx(0, "edit", "", WS_CHILD | WS_VISIBLE, 10, 10, 200, 25, hwnd, (HMENU) 1, NULL, NULL); break; } case WM_COMMAND: { // Check if the input box was modified if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == 1) { // Get the text from the input box int length = GetWindowTextLength(hwnd); char* text = new char[length + 1]; GetWindowText(hwnd, text, length + 1); // Do something with the text here... } break; } case WM_DESTROY: { PostQuitMessage(0); break; } default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } // Dynamic library entry point BOOL APIENTRY DllMain(HMODULE hModule, DW解决 无用评论 打赏 举报