void WindowAttributesPickle::LoadAttributes()
{
    wxPoint pos = GetWindowPos(m_name, wxDefaultPosition);
    wxSize size = GetWindowSize(m_name, m_default_size);
    m_window->SetSize(pos.x, pos.y, size.GetWidth(), size.GetHeight());
#ifndef __WXMAC__
    m_window->Maximize(GetWindowMaximized(m_name));
#endif
}
//EnumChildWindows回调函数,hwnd为指定的父窗口  
BOOL CALLBACK EnumChildWindowsProc(HWND hWnd, LPARAM lParam)
{
	//RECT rc;
	int PosX = 0;
	int PosY = 0;
	char WindowTitle[100] = { 0 };

	GetWindowText(hWnd, WindowTitle, 100);
	printf("%s\n", WindowTitle);
	if (strstr(WindowTitle, "fuzzed"))
	{
		printf("%s\n", WindowTitle);
		if (GetWindowPos(hWnd, &PosX, &PosY))
			CloseMyWindow(PosX, PosY);
	}
	//printf("%s\n", WindowTitle);
	//GetWindowRect(hWnd, &rc);
	//printf("%d\n", rc.left);
	return true;
}
Beispiel #3
0
BOOL CALLBACK DockDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  static HWND hWndTitleText;
  static HWND hWndTitleClose;
  static HMENU hMenuLabel;
  static DIALOGRESIZE drs[]={{&hWndTitleText,    DRS_SIZE|DRS_X, 0},
                             {&hWndTitleClose,   DRS_MOVE|DRS_X, 0},
                             {&hWndCaptureEdit,  DRS_SIZE|DRS_X, 0},
                             {&hWndCaptureEdit,  DRS_SIZE|DRS_Y, 0},
                             {0, 0, 0}};

  if (uMsg == WM_INITDIALOG)
  {
    HFONT hFontEdit;

    hWndCaptureEdit=GetDlgItem(hDlg, IDC_CAPTURE);
    hWndTitleText=GetDlgItem(hDlg, IDC_TITLETEXT);
    hWndTitleClose=GetDlgItem(hDlg, IDC_CAPTURE_CLOSE);

    //SendMessage(hWndCaptureEdit, EM_SETUNDOLIMIT, 0, 0);
    hFontEdit=(HFONT)SendMessage(hMainWnd, AKD_GETFONT, (WPARAM)NULL, (LPARAM)NULL);
    SendMessage(hWndCaptureEdit, WM_SETFONT, (WPARAM)hFontEdit, FALSE);

    hMenuLabel=CreatePopupMenu();
    AppendMenuWide(hMenuLabel, MF_STRING, IDM_SETUP, GetLangStringW(wLangModule, STRID_SETUP));

    //Set dock title
    {
      BUTTONDRAW bd={BIF_CROSS|BIF_ETCHED};

      SetWindowTextWide(hWndTitleText, L"Clipboard::Capture");
      SendMessage(hMainWnd, AKD_SETBUTTONDRAW, (WPARAM)hWndTitleClose, (LPARAM)&bd);
    }

    //View clipboard
    hWndNextViewer=SetClipboardViewer(hMainWnd);
  }
  else if (uMsg == AKDLL_SETUP)
  {
    DialogBoxWide(hInstanceDLL, MAKEINTRESOURCEW(IDD_SETUP), hDlg, (DLGPROC)SetupDlgProc);
  }
  else if (uMsg == WM_LBUTTONDBLCLK)
  {
    POINT pt;
    RECT rc;

    GetCursorPos(&pt);
    GetWindowRect(hWndTitleText, &rc);

    if (PtInRect(&rc, pt))
    {
      PostMessage(hDlg, AKDLL_SETUP, 0, 0);
    }
  }
  else if (uMsg == WM_CONTEXTMENU)
  {
    if ((HWND)wParam == hDlg)
    {
      POINT pt;
      RECT rc;

      GetCursorPos(&pt);
      GetWindowRect(hWndTitleText, &rc);

      if (PtInRect(&rc, pt))
      {
        int nCmd;

        nCmd=TrackPopupMenu(hMenuLabel, TPM_RETURNCMD|TPM_NONOTIFY|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, pt.x, pt.y, 0, hWndTitleText, NULL);

        if (nCmd == IDM_SETUP)
          PostMessage(hDlg, AKDLL_SETUP, 0, 0);
      }
    }
    else if ((HWND)wParam == hWndCaptureEdit)
    {
      ShowStandardEditMenu((HWND)wParam, hPopupEdit, lParam != -1);
    }
  }
  else if (uMsg == WM_COMMAND)
  {
    if (LOWORD(wParam) == IDC_CAPTURE_CLOSE ||
        LOWORD(wParam) == IDCANCEL)
    {
      //Stop view clipboard
      ChangeClipboardChain(hMainWnd, hWndNextViewer);
      hWndNextViewer=NULL;

      //Save OF_CAPTURE_RECT
      if (dwSaveFlags)
      {
        SaveOptions(dwSaveFlags);
        dwSaveFlags=0;
      }

      UninitMain();
      UninitCapture();
      SendMessage(hMainWnd, AKD_DOCK, DK_DELETE, (LPARAM)dkCaptureDlg);
      dkCaptureDlg=NULL;

      DestroyMenu(hMenuLabel);
      DestroyWindow(hWndCaptureDlg);
      hWndCaptureDlg=NULL;

      if (!(lParam & DKT_ONMAINFINISH))
      {
        SendMessage(hMainWnd, AKD_RESIZE, 0, 0);
        SetFocus(hMainWnd);

        if (!(lParam & DKT_KEEPAUTOLOAD))
        {
          pfCapture->bAutoLoad=FALSE;
          SendMessage(hMainWnd, AKD_DLLSAVE, DLLSF_ONEXIT, 0);
        }
        if ((lParam & DKT_NOUNLOAD) || nInitMain)
        {
          pfCapture->bRunning=FALSE;
          SendMessage(hMainWnd, WM_COMMAND, 0, 0);
        }
        else PostMessage(hMainWnd, AKD_DLLUNLOAD, (WPARAM)hInstanceDLL, (LPARAM)NULL);
      }
    }
  }

  //Dialog resize messages
  {
    DIALOGRESIZEMSG drsm={&drs[0], NULL, &rcCaptureCurrentDialog, 0, hDlg, uMsg, wParam, lParam};

    if (SendMessage(hMainWnd, AKD_DIALOGRESIZE, 0, (LPARAM)&drsm))
      if (dkCaptureDlg) GetWindowPos(hWndTitleText, hDlg, &dkCaptureDlg->rcDragDrop);
  }

  return FALSE;
}