Quipex

Untitled

Oct 17th, 2017
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #include "../lab3dll/dllmain.h"
  2. #include "resource.h"
  3.  
  4. #include <tchar.h>
  5. LRESULT CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
  6. int APIENTRY _tWinMain(HINSTANCE, HINSTANCE, PWSTR, int) {
  7.     HINSTANCE hInst = GetModuleHandle(NULL);
  8.     DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG), 0, (DLGPROC)DlgProc);
  9.     return 0;
  10. }
  11.  
  12. LRESULT CALLBACK DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
  13.     TCHAR text_buff[] = _T("Spice Window was moved or resized!");
  14.     switch (msg) {
  15.     case WM_INITDIALOG:
  16.         if (!InstallHook(hDlg)) {
  17.             EndDialog(hDlg, LOWORD(wParam));
  18.         }
  19.         return TRUE;
  20.     case WM_CLOSE:
  21.         UninstallHook();
  22.         EndDialog(hDlg, LOWORD(wParam));
  23.         return TRUE;
  24.     case my_msg:
  25.  
  26.         if ((HWND)wParam == hDlg) {
  27.             SendDlgItemMessage(hDlg, ID_LISTBOX, LB_ADDSTRING, NULL, (LPARAM)text_buff);
  28.         }
  29.         else {
  30.             TCHAR szBuf[60];
  31.             GetWindowText((HWND)wParam, szBuf, 30);
  32.             wsprintf(szBuf, _T("%s window was moved or resized!"), szBuf);
  33.             SendDlgItemMessage(hDlg, ID_LISTBOX, LB_ADDSTRING, NULL, (LPARAM)szBuf);
  34.         }
  35.         return TRUE;
  36.     }
  37.  
  38.     return FALSE;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment