Hallo Community,
nachdem mein Problem mit der GUI gelößt wurde, habe ich nun eine einwandfrei funktionierende hübsche Oberfläche:
Alles anzeigen
In dem rot gekennzeichneten Bereich, lese ich einen Wert aus einem Edit Feld aus und speichere diesen in der Variable "text".
Nun habe ich eine weitere Datei: Eine Dll.
Alles anzeigen
nachdem mein Problem mit der GUI gelößt wurde, habe ich nun eine einwandfrei funktionierende hübsche Oberfläche:

C-Quellcode
- #include <windows.h>
- #include <stdio.h>
- #include <cstdio>
- #ifdef _UNICODE
- #if defined _M_IX86
- #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
- #elif defined _M_X64
- #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
- #else
- #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
- #endif
- #endif
- HWND hwndButton;
- HWND hwndEdit;
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- int WINAPI WinMain(HINSTANCE hI, HINSTANCE hPrI, PSTR szCmdLine, int iCmdShow)
- {
- LPWSTR szName = L"Fensterklasse";
- WNDCLASS wc;
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hI;
- wc.hIcon = LoadIcon (NULL,IDI_WINLOGO);
- wc.hCursor = LoadCursor (NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
- //wc.hbrBackground = CreateSolidBrush(RGB(0,0,0));
- wc.lpszMenuName = NULL;
- wc.lpszClassName = szName;
- RegisterClass(&wc);
- HWND hwnd = CreateWindow(szName, L"<Graphical User Interface>", WS_SYSMENU | WS_SIZEBOX,
- 0,0,300,200,NULL,NULL,hI,NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- MSG msg;
- while(GetMessage(&msg,NULL,0,0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- HDC hdc;
- PAINTSTRUCT ps;
- switch(message)
- {
- case WM_PAINT:
- hdc = BeginPaint(hwnd, &ps);
- SetBkMode(hdc,TRANSPARENT);
- SetTextColor(hdc,RGB(0,0,0));
- TextOut(hdc, 20, 20, L"Wert", 4);
- EndPaint(hwnd, &ps);
- return 0;
- case WM_CREATE:
- hwndButton = CreateWindow(L"button", L"Einlesen!", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
- 160, 20, 100, 18, hwnd, (HMENU)1, GetModuleHandle(0),0);
- hwndEdit = CreateWindow(L"edit",L"50", WS_VISIBLE | WS_CHILD,
- 60,20,80,17,hwnd,0, GetModuleHandle(0),0);
- break;
- case WM_COMMAND:
- switch(wParam)
- {
- case 1:
- {
- wchar_t text[256];
- SendMessage(hwndEdit, WM_GETTEXT, 256, (LPARAM)text);
- MessageBox(hwnd, text, L"Edit -- Feld", MB_OK);
- break;
- }
- }
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd, message, wParam, lParam);
- }
In dem rot gekennzeichneten Bereich, lese ich einen Wert aus einem Edit Feld aus und speichere diesen in der Variable "text".
Nun habe ich eine weitere Datei: Eine Dll.
C-Quellcode
- #include <iostream>
- #include <windows.h>
- #include <detours.h>
- BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD Reason, LPVOID Reserved)
- {
- switch(Reason)
- {
- case DLL_PROCESS_ATTACH:
- MessageBox(0,L"Attached.",L"Info",0);
- break;
- case DLL_PROCESS_DETACH:
- MessageBox(0,L"Detached.",L"Info",0);
- break;
- }
- return TRUE;
- }