Esempio n. 1
0
void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible,
                                const CFX_FloatPoint& ptHead,
                                const CFX_FloatPoint& ptFoot,
                                const CPVT_WordPlace& place) {
  PWL_CARET_INFO cInfo;
  cInfo.bVisible = bVisible;
  cInfo.ptHead = ptHead;
  cInfo.ptFoot = ptFoot;

  OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr);
}
Esempio n. 2
0
void TWebTravelHomeNet::StartTravel(){
  PutConstrs();
  TStrV UrlStrV(300000, 0);
  TIntIntH UserIdToDocsH(1000);
  PSIn SIn=PSIn(new TFIn(InFNm));
  TILx Lx(SIn, TFSet()|iloRetEoln);
  TChA UrlStr;
  Lx.GetSym(syInt, syEof);
  while ((Lx.Sym!=syEof)&&(Lx.SymLnN<200000)){
//  while (Lx.Sym!=syEof){
    int UserId=Lx.Int; Lx.GetSym(syComma);
    Lx.GetInt(); Lx.GetSym(syComma);
    Lx.GetInt(); Lx.GetSym(syComma);
    Lx.GetInt(); Lx.GetSym(syComma);
    Lx.GetInt(); Lx.GetSym(syComma);
    TStr Method=Lx.GetIdStr(); Lx.GetSym(syComma);  // GET, POST
    UrlStr.Clr(); UrlStr+=Lx.GetIdStr(); Lx.GetSym(syComma); // http, ftp
    UrlStr+="://";
    UrlStr+=Lx.GetStrToCh(','); Lx.GetSym(syComma); // domain name
    UrlStr+=Lx.GetStrToEoln(); Lx.GetEoln(); // path
    if ((UserId==TgUserId)&&IsUrlOk(UrlStr)&&(Method=="GET")){
      UserIdToDocsH.AddDat(UserId)++;
      UrlStrV.Add(UrlStr);
    }
    Lx.GetSym(syInt, syEof);
    if (Lx.SymLnN%100000==0){OnNotify(TInt::GetStr(Lx.SymLnN)+ " docs");}
  }
  int UserIdToDocsP=UserIdToDocsH.FFirstKeyId();
  while (UserIdToDocsH.FNextKeyId(UserIdToDocsP)){
    int UserId=UserIdToDocsH.GetKey(UserIdToDocsP);
    int Docs=UserIdToDocsH[UserIdToDocsP];
    TStr MsgStr=TStr("User ")+TInt::GetStr(UserId)+": "+
     TInt::GetStr(Docs)+" Docs.";
    OnNotify(MsgStr);
  }
  UrlStrV.Shuffle(TRnd());
  for (int UrlStrN=0; UrlStrN<UrlStrV.Len(); UrlStrN++){
    Go(UrlStrV[UrlStrN]);
  }
}
Esempio n. 3
0
INT_PTR CallStackWnd::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) {
	case WM_NOTIFY:
		{
			NMHDR *pNmh = (NMHDR*)lParam;
			if (pNmh->hwndFrom == ::GetDlgItem(m_hWnd, IDC_LST_CALLSTACK))
				OnNotify(pNmh);
			break;
		}
	}
	return DockForm::DlgProc(hwnd, uMsg, wParam, lParam);
}
Esempio n. 4
0
INT_PTR DialogAbout::TabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_COMMAND:
		return OnCommand(wParam, lParam);

	case WM_NOTIFY:
		return OnNotify(wParam, lParam);
	}

	return FALSE;
}
/// <summary>
/// Dispatch the message to the handler function
/// </summary>
/// <param name="hWnd">The handle to the window which receives the message</param>
/// <param name="uMsg">The message identifier</param>
/// <param name="wParam">The additional message information</param>
/// <param name="lParam">The additional message information</param>
/// <returns>If the message has been processed by handler function, TRUE is returned. Otherwise FALSE is returned and the message is handled by default dialog procedure</returns>
LRESULT KinectWindow::DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_STREAMEVENT:
        UpdateStreams();
        break;

    case WM_TIMEREVENT:
        UpdateTimedStreams();
        break;

    case WM_INITDIALOG:
        NuiViewer::SetIcon(hWnd);
        break;

    case WM_SIZE:
        OnResize();
        break;

    case WM_COMMAND:
        OnCommand(wParam);
        break;

    case WM_NOTIFY:
        OnNotify(lParam);
        break;

    case WM_CLOSE:
        OnClose(hWnd, wParam);
        break;

    case WM_DESTROY:
        PostQuitMessage(0);
        break;

    case WM_SHOWKINECTWINDOW:
        {
            if (0 != wParam)
            {
                ShowWindows();
            }
        }
        break;

    default:
        break;
    }

    return FALSE;
}
Esempio n. 6
0
void GPanel::OnMouseClick(GMouse &m)
{
	if (OpenSize > 0 &&
		m.Left() &&
		m.Down() &&
		ThumbPos.Overlap(m.x, m.y))
	{
		Open(!IsOpen);
		if (GetParent())
		{
			OnNotify(this, 0);
		}
	}
}
Esempio n. 7
0
LRESULT TimePicker::TimePickerProc(HWND hwnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
	LRESULT result = 0;
	switch(msg)
	{
	case WM_NOTIFY:
		{
			NMHDR *hdr = reinterpret_cast<NMHDR *>(lParam);
			result = OnNotify(hwnd, wParam, hdr);
		}
		break;
	default:
		result = CallWindowProc(m_originalProc, hwnd, msg, wParam, lParam);
	}
	return result;
}
Esempio n. 8
0
INT_PTR Dialog::DlgMsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) {
	INT_PTR result = FALSE;

	switch(uMsg) {
		case WM_CLOSE: {
			EndDialog(m_hwnd, 99);
			result = TRUE;
			break; }
		case WM_COMMAND: {
			result = OnCommand(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
			break; }
		case WM_NOTIFY: {
			result = OnNotify((NMHDR*)lParam);
			break; }
		default: {
			result = FALSE;
			break; }
	}

	return result;
}
Esempio n. 9
0
BOOL CALLBACK SetupDlgFunc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {

	switch (uMsg) {
	case WM_INITDIALOG:
		return InitDialog(hWnd);

	case WM_NOTIFY:
		OnNotify(hWnd, wParam, lParam);
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam))	{
		case IDOK:
			OnOK(hWnd);
			EndDialog(hWnd, IDOK);
			break;

		case IDCANCEL:
			EndDialog(hWnd, IDCANCEL);
			break;
		
		case IDC_ADD:		// アイテムの追加
			OnEdit(hWnd, TRUE);
			break;

		case IDC_MODIFY:	// アイテムの変更
			OnEdit(hWnd, FALSE);
			break;
		
		case IDC_DELETE:	// アイテムの削除
			OnDelete(hWnd);
			break;
		
		case IDC_OPENFILE:	// ファイルの参照
			OnOpenFile(hWnd);
			break;
		}
	}
	return FALSE;
}
Esempio n. 10
0
static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    UINT nIDCtrl;
    UINT nIDNotify;

    // Dialog initialization
    switch(uMsg)
    {
        case WM_INITDIALOG:
            OnInitDialog(hDlg, lParam);
            return TRUE;

        case WM_SIZE:
            OnSize(hDlg);
            break;

        case WM_GETMINMAXINFO:
            OnGetMinMaxInfo(hDlg, lParam);
            break;

        case WM_NOTIFY:
            OnNotify(hDlg, (NMHDR *)lParam);
            break;

        case WM_COMMAND:
            nIDNotify = HIWORD(wParam);
            nIDCtrl = LOWORD(wParam);

            if(nIDNotify == BN_CLICKED)
                EndDialog(hDlg, nIDCtrl);
            break;

        case WM_DESTROY:
            OnDestroy(hDlg);
            break;
    }

    return FALSE;
}
Esempio n. 11
0
INT_PTR CALLBACK PageProc02(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    // Call tooltip to handle messages
    g_Tooltip.HandleMessages(hDlg, uMsg, wParam, lParam, NULL);

    // Handle other messages
    switch(uMsg)
    {
        case WM_INITDIALOG:
            return OnInitDialog(hDlg, lParam);

        case WM_SIZE:
            if(pAnchors != NULL)
                pAnchors->OnSize();
            return FALSE;

        case WM_DRAWITEM:
            if(wParam == IDC_RELATIVE_FILE_HELP)
                DrawURLButton(hDlg, (LPDRAWITEMSTRUCT)lParam, FALSE);
            return TRUE;

        case WM_CONTEXTMENU:
            return ExecuteContextMenu(hDlg, FindContextMenu(IDR_NTCREATE_MENU), lParam);

        case WM_COMMAND:
            return OnCommand(hDlg, HIWORD(wParam), LOWORD(wParam));

        case WM_NOTIFY:
            return OnNotify(hDlg, (NMHDR *)lParam);

        case WM_DESTROY:
            if(pAnchors != NULL)
                delete pAnchors;
            pAnchors = NULL;
            return FALSE;
    }
    return FALSE;
}
Esempio n. 12
0
bool CDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
  switch (message)
  {
    case WM_INITDIALOG:
      return OnInit();
    case WM_COMMAND:
      return OnCommand(wParam, lParam);
    case WM_NOTIFY:
      return OnNotify(wParam, (LPNMHDR) lParam);
    case WM_HELP:
      {
        OnHelp((LPHELPINFO)lParam);
        return true;
      }
    case WM_TIMER:
      {
        return OnTimer(wParam, lParam);
      }
    default:
      return false;
  }
}
Esempio n. 13
0
INT_PTR Dialog::DlgWndProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_INITDIALOG:
		return OnInitDlg(wParam, lParam);
	case WM_COMMAND:
		return OnCommand(wParam, lParam);
	case WM_NOTIFY:
		return OnNotify(wParam, lParam);
	case WM_TIMER:
		return OnTimer(wParam, lParam);
	case WM_CLOSE:
		return OnClose(wParam, lParam);
	case WM_DESTROY:
		return OnDestroy(wParam, lParam);
	case WM_SIZE:
		return OnSize(wParam, lParam);
	case WM_GETMINMAXINFO:
		return OnGetMinMaxInfo(wParam, lParam);
	}
	return (INT_PTR)FALSE;
}
Esempio n. 14
0
bool CDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
  switch (message)
  {
    case WM_INITDIALOG: return OnInit();
    case WM_COMMAND: return OnCommand(wParam, lParam);
    case WM_NOTIFY: return OnNotify((UINT)wParam, (LPNMHDR) lParam);
    case WM_TIMER: return OnTimer(wParam, lParam);
    case WM_SIZE: return OnSize(wParam, LOWORD(lParam), HIWORD(lParam));
    case WM_HELP: OnHelp(); return true;
    /*
        OnHelp(
          #ifdef UNDER_CE
          (void *)
          #else
          (LPHELPINFO)
          #endif
          lParam);
        return true;
    */
    default: return false;
  }
}
Esempio n. 15
0
void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin,
                                      FX_FLOAT fPlateMax,
                                      FX_FLOAT fContentMin,
                                      FX_FLOAT fContentMax,
                                      FX_FLOAT fSmallStep,
                                      FX_FLOAT fBigStep) {
  PWL_SCROLL_INFO Info;

  Info.fPlateWidth = fPlateMax - fPlateMin;
  Info.fContentMin = fContentMin;
  Info.fContentMax = fContentMax;
  Info.fSmallStep = fSmallStep;
  Info.fBigStep = fBigStep;

  OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&Info);

  if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
      IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
    ShowVScrollBar(FALSE);
  } else {
    ShowVScrollBar(TRUE);
  }
}
Esempio n. 16
0
INT_PTR CALLBACK
UsersPageProc(HWND hwndDlg,
              UINT uMsg,
              WPARAM wParam,
              LPARAM lParam)
{
    PUSER_DATA pUserData;

    UNREFERENCED_PARAMETER(wParam);

    pUserData = (PUSER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);

    switch (uMsg)
    {
        case WM_INITDIALOG:
            pUserData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(USER_DATA));
            SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pUserData);

            pUserData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_USER));

            OnInitDialog(hwndDlg);
            SetMenuDefaultItem(GetSubMenu(pUserData->hPopupMenu, 1),
                               IDM_USER_PROPERTIES,
                               FALSE);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDM_USER_CHANGE_PASSWORD:
                    DialogBoxParam(hApplet,
                                   MAKEINTRESOURCE(IDD_CHANGE_PASSWORD),
                                   hwndDlg,
                                   ChangePasswordDlgProc,
                                   (LPARAM)NULL);
                    break;

                case IDM_USER_RENAME:
                    UserRename(hwndDlg);
                    break;

                case IDM_USER_NEW:
                    UserNew(hwndDlg);
                    break;

                case IDM_USER_DELETE:
                    UserDelete(hwndDlg);
                    break;

                case IDM_USER_PROPERTIES:
                    if (UserProperties(hwndDlg))
                    {
                        UpdateUserProperties(hwndDlg);
                    }
                    break;
            }
            break;

        case WM_NOTIFY:
            return OnNotify(hwndDlg, pUserData, (NMHDR *)lParam);

        case WM_DESTROY:
            DestroyMenu(pUserData->hPopupMenu);
            HeapFree(GetProcessHeap(), 0, pUserData);
            break;
    }

    return FALSE;
}
Esempio n. 17
0
bool Win32Vif::Read(char* buffer, unsigned int& numBytes)  
{

    DWORD bytesRead = 0;
    unsigned int len = 0;
    if (NULL != GetNotifier())
    {
        if (!input_ready)
        {
            // We had a pending overlapped read operation
            if (FALSE != GetOverlappedResult(tap_handle,&read_overlapped,&bytesRead,FALSE))
            {
                numBytes = read_count = bytesRead;
                memcpy(buffer,read_buffer,bytesRead);
                input_ready = true;
            }
            else
            {
                numBytes = 0;
                switch (GetLastError())
                {
                case ERROR_BROKEN_PIPE:
                  OnNotify(NOTIFY_NONE);
                  return false;
                default:
                  PLOG(PL_ERROR,"Win32Vif::Read() GetOverlappedResult() error (%d): %s\n",GetLastError(), ::GetErrorString());
                  return false;
                }                
            }
        }  
    }
    // Do we have any data in our "read_buffer"? 
    if (read_count > 0)
    {
        memcpy (buffer,read_buffer,read_count);
        numBytes = read_count;
        read_count = 0;
        return true;
    }
    
    // Read more as needed, triggering overlapped I/O
    memset(&read_overlapped,0,sizeof(read_overlapped));
    read_overlapped.hEvent = input_handle;
    memset(&write_overlapped,0,sizeof(write_overlapped));
    write_overlapped.hEvent = output_handle; // ljt need me?

    bytesRead = 0;
    len = BUFFER_MAX;   
    if (0 != ReadFile(tap_handle,read_buffer,len,&bytesRead,&read_overlapped))
    {
        memcpy(buffer,read_buffer,bytesRead);
        numBytes = bytesRead;
        input_ready = true;
    }
    else
    {
        switch(GetLastError())
        {
        case ERROR_IO_PENDING:
          read_count = 0;
          input_ready = false;
          break;
        case ERROR_BROKEN_PIPE: 
          if (0 == bytesRead)
          {
              OnNotify(NOTIFY_NONE);
              return false;
          }
          break;
        default:
          PLOG(PL_ERROR,"Win32Vif::Read() error: %s\n", ::GetErrorString());
          if (0 == bytesRead) return false;
          break;
        }
    }

    numBytes = bytesRead;   
    return true;
}  // end Win32Vif::Read()
INT_PTR CMessageForwarder::ForwardMessage(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	m_hwnd = hwnd;
	m_uMsg = uMsg;
	m_wParam = wParam;
	m_lParam = lParam;

	/* Private message? */
	if(uMsg > WM_APP && uMsg < 0xBFFF)
	{
		return OnPrivateMessage(uMsg,wParam,lParam);
	}

	switch(uMsg)
	{
		case WM_INITDIALOG:
			return OnInitDialog();
			break;

		case WM_CTLCOLORSTATIC:
			return OnCtlColorStatic(reinterpret_cast<HWND>(lParam),
				reinterpret_cast<HDC>(wParam));
			break;

		case WM_CTLCOLOREDIT:
			return OnCtlColorEdit(reinterpret_cast<HWND>(lParam),
				reinterpret_cast<HDC>(wParam));
			break;

		case WM_HSCROLL:
			return OnHScroll(reinterpret_cast<HWND>(lParam));
			break;

		case WM_APPCOMMAND:
			return OnAppCommand(reinterpret_cast<HWND>(wParam),
				GET_APPCOMMAND_LPARAM(lParam),
				GET_DEVICE_LPARAM(lParam),
				GET_KEYSTATE_LPARAM(lParam));
			break;

		case WM_TIMER:
			return OnTimer(static_cast<int>(wParam));
			break;

		case WM_MBUTTONUP:
			return OnMButtonUp(&MAKEPOINTS(lParam));
			break;

		case WM_COMMAND:
			return OnCommand(wParam,lParam);
			break;

		case WM_NOTIFY:
			return OnNotify(reinterpret_cast<LPNMHDR>(lParam));
			break;

		case WM_GETMINMAXINFO:
			return OnGetMinMaxInfo(reinterpret_cast<LPMINMAXINFO>(lParam));
			break;

		case WM_SIZE:
			return OnSize(static_cast<int>(wParam),
				LOWORD(lParam),HIWORD(lParam));
			break;

		case WM_CLOSE:
			return OnClose();
			break;

		case WM_DESTROY:
			return OnDestroy();
			break;

		case WM_NCDESTROY:
			return OnNcDestroy();
			break;


		case EM_SETSEL:
			OnEMSetSel(wParam,lParam);
			break;
	}

	return GetDefaultReturnValue(hwnd,uMsg,wParam,lParam);
}
Esempio n. 19
0
INT_PTR
PropPageDlgProc(_In_ HWND   hDlg,
                   _In_ UINT   uMessage,
                   _In_ WPARAM wParam,
                   _In_ LPARAM lParam)
/*++

Routine Description: PropPageDlgProc

    The windows control function for the custom property page window

Arguments:

    hDlg, uMessage, wParam, lParam: standard windows DlgProc parameters

Return Value:

    BOOL: FALSE if function fails, TRUE if function passes

--*/
{
    PTOASTER_PROP_PARAMS params;

    UNREFERENCED_PARAMETER( wParam );

    params = (PTOASTER_PROP_PARAMS) GetWindowLongPtr(hDlg, DWLP_USER);

    switch(uMessage) {
    case WM_COMMAND:
        break;

    case WM_CONTEXTMENU:
        break;

    case WM_HELP:
        break;

    case WM_INITDIALOG:

        //
        // on WM_INITDIALOG call, lParam points to the property
        // sheet page.
        //
        // The lParam field in the property sheet page struct is set by the
        // caller. This was set when we created the property sheet.
        // Save this in the user window long so that we can access it on later 
        // on later messages.
        //

        params = (PTOASTER_PROP_PARAMS) ((LPPROPSHEETPAGE)lParam)->lParam;
        SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR) params);
        break;


    case WM_NOTIFY:
        OnNotify(hDlg, (NMHDR *)lParam, params);
        break;

    default: 
        return FALSE;
    }

    return TRUE;
} 
Esempio n. 20
0
INT_PTR CCreateEventDlg::PageProc(unsigned int msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
    case WM_CTLCOLORSTATIC:
        if(reinterpret_cast<HWND>(lParam) == m_pEstDuration->GetHWND())
        {
            HDC dc = reinterpret_cast<HDC>(wParam);
            SetDCBrushColor(dc, GetSysColor(COLOR_WINDOW));
            return reinterpret_cast<INT_PTR>(GetStockObject(DC_BRUSH));
        }
        return FALSE;
    case WM_CTLCOLOREDIT:
        if(reinterpret_cast<HWND>(lParam) == m_pEstDuration->GetHWND())
        {
            HDC dc = reinterpret_cast<HDC>(wParam);
            if(!m_pEstDuration->ValidData())
            {
                SetTextColor(dc, 0x006868ff);
            }
            else
            {
                SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT));
            }
            SetDCBrushColor(dc, GetSysColor(COLOR_WINDOW));
            return reinterpret_cast<INT_PTR>(GetStockObject(DC_BRUSH));
        }
        return FALSE;
    case WM_INITDIALOG:
        OnInitDialog();
        break;
    case WM_NOTIFY:
    {
        NMHDR *pHdr = reinterpret_cast<NMHDR *>(lParam);
        OnNotify(pHdr);
    }
    break;
    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK)
        {
            OnOkay();
        }
        else if(LOWORD(wParam) == IDC_CREATE_EVENT_ADD_USER_BUTTON)
        {
            StringBuffer sb(1024);
            HWND edit = GetDlgItem(m_hwnd, IDC_CREATE_EVENT_ADD_USER_EDIT);
            if(edit)
            {
                GetWindowText(edit, sb, 1023);
                sb.setLength(_tcslen(sb));
                SetWindowText(edit, _T(""));
                HWND lb = GetDlgItem(m_hwnd, IDC_CREATE_EVENT_ATTENDEE_LIST);
                SendMessage(lb, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sb.operator TCHAR *()));
                SetFocus(edit);
            }
        }
        break;

    default:
        return FALSE;
    }
    return TRUE;
}
Esempio n. 21
0
BOOL WZCWLanNetworkDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
    PWLAN_INFO psWLanInfo = (PWLAN_INFO)GetWindowLong(hDlg, GWL_USERDATA);
    BOOL   fRet = PropPageDialogHelper(hDlg, message, wParam, lParam);

    // Figure out whther to show the listbox or "insert card" text and hide 
    // the control we don't need. We do this before calling SHRCMLDialogProc
    // because these controls occupy the same position - if they're both
    // visible, the dialog resizing code gets confused.
    if (WM_INITDIALOG== message)
    {
        psWLanInfo = (PWLAN_INFO)(((PROPSHEETPAGE*)lParam)->lParam);
        if (psWLanInfo)
        {
            psWLanInfo->hDlg = hDlg;        
            SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psWLanInfo);
                        
            OnInitDialog(psWLanInfo);      
            
            if (psWLanInfo->fWirelessCardPresent)
            { // show listbox, hide textbox
                ShowWindow(GetDlgItem(hDlg,IDC_WZC_STATIC_NO_WIRELESS_CARD_PRESEND),SW_HIDE);
            }
            else
            {
                ShowWindow(GetDlgItem(hDlg,IDC_WZC_LIST_NETWORKS),SW_HIDE);
            }
        }
    }

    fRet = SHRCMLDialogProc( HINST_RESDLL, MAKEINTRESOURCE(IDD_WZC_WLAN_NETWORK), hDlg, message, wParam, lParam);

    // Check for the home screen being activated
    if (g_uMsgActivateHome == message)
    {
        OnActivateHome(psWLanInfo);
    }

    switch(message)
    {
    case WM_INITDIALOG:
        fRet = TRUE;
        break;

    case WM_COMMAND:
        fRet = OnCommand(psWLanInfo, wParam);
        break;

    case WM_ACTIVATE:
        OnActivate(wParam, (HWND)lParam, psWLanInfo);
        break;

    case WM_NOTIFY:
        fRet = OnNotify(psWLanInfo, wParam, lParam);
        break;

    case WM_DESTROY:
        OnDestroy(psWLanInfo);
        break;

    case WM_SIZE:
        RelayoutDlg(psWLanInfo);
        break;

    case WM_INITMENUPOPUP:
        OnMenuPopup(psWLanInfo, (HMENU) wParam, ListView_GetNextItem(psWLanInfo->hwndNetList, -1, LVNI_SELECTED));
        break;

    case WM_SHWZC_CALLBACK:
        psWLanInfo->dwHWFlags = SHWZCGetHardwareFlags();

        switch (wParam)
        {
        case SHWZC_EVENT_BROADCASTCHANGE:
        case SHWZC_EVENT_CONNECTING:
        case SHWZC_EVENT_CONNECTION:
            if (NULL == psWLanInfo->hwndNCPrsht)
            {
                RefreshNetListView(psWLanInfo);
            }
            break;
        }
        break;

    case WM_WARNING_NO_WIRELESS_CARD:
        if (psWLanInfo->hwndNCPrsht)
        {
            // IDOK actually is not save, this will save network settings while
            // unplug wireless network card. But IDCANCEL is refused by Network Property
            // property sheet. So we need to keep an eye on this one.
            PostMessage(psWLanInfo->hwndNCPrsht, WM_COMMAND, IDOK, 0);
        }
        break;
    }
    
    return fRet;
}
Esempio n. 22
0
LRESULT CMainWnd::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	//创建窗口后先发送WM_CREATE消息创建控件,再发送WM_ERASEBKGND消息擦除背景,然后发送WM_SIZE消息调整窗口大小,发送WM_PAINT消息进行重绘
	switch (uMsg)
	{
	case WM_CREATE:
		OnCreate(hWnd, wParam, lParam);
		break;
	case WM_PAINT:
		OnPaint(wParam, lParam);//绘制消息		
		break;
	case WM_ERASEBKGND:
		return OnEraseBkgnd(wParam, lParam);
	case WM_SIZE:
		OnSize(wParam, lParam);//大小改变消息
		break;
	case WM_MOVE:
		GetWindowRect(hWnd, &rtWindow);//获取整个主窗体的窗口矩形
		GetClientRectEx(&rtClient);//获取主窗体客户区的矩形
		break;
	case WM_NOTIFY:
		OnNotify(wParam, lParam);//子窗体通知消息
		break;
	case WM_COMMAND:
		OnCommand(wParam, lParam);//菜单或者按钮控件消息
		break;
	case WM_MENUSELECT:
		OnMenuSelect(wParam, lParam);	//菜单选择消息			
		break;
	case WM_LBUTTONDOWN:
		OnLButtonDown(wParam, lParam);//左键单击消息
		break;
	case WM_LBUTTONDBLCLK:
		OnLButtonDbClick(wParam, lParam);//左键双击消息
		break;
	case WM_RBUTTONDOWN:
		OnRButtonDown(wParam, lParam);//右键单击消息
		break;
	case WM_MOUSEMOVE:
		OnMouseMove(wParam, lParam);//鼠标移动消息
		break;
	case WM_KEYDOWN:
		OnKeyDown(wParam, lParam);//键盘按键消息
		break;
	case WM_TIMER:
		OnTimer(wParam, lParam);//定时器消息
		break;
	case WM_CLOSE:
		OnClose(wParam, lParam);	//关闭窗体消息
		break;//用户点击关闭按钮时,不需要系统来处理
	case WM_DESTROY:
		OnDestroy(wParam, lParam);		//破坏窗体消息
		break;

		//自定义消息
	case GM_NAME://设置引擎名
		SetName((char*)wParam, (int)lParam);
		break;
	case GM_SHOWSTEP://显示着法信息(由其中支持模块发送)
		AppendStepHis((char*)wParam);
		Function::SaveBoardShot();
		Function::SaveChessManual((char*)wParam);
		break;
	case GM_WINLOSE:
		Function::GameStop();
		ShowWiner((int)lParam);
		break;

	default:
		return DefWindowProc(hWnd, uMsg, wParam, lParam);//处理不完全的消息或者其它消息统一由系统处理		
	}
	return 0;
}
Esempio n. 23
0
void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) {
  OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy);
}
Esempio n. 24
0
INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
{
	if (!m_HandleCommands)
	{
		// Values are being changed/reset, no need to apply changes
		return FALSE;
	}

	switch (LOWORD(wParam))
	{
	case IDC_MANAGESKINS_ACTIVESKINS_BUTTON:
		{
			HMENU menu = CreatePopupMenu();

			// Add active skins to menu
			std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
			int index = 0;
			for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
			{
				std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
				name += ((*iter).second)->GetFileName();
				InsertMenu(menu, index, MF_BYPOSITION, ID_CONFIG_FIRST + index, name.c_str());
				++index;
			}

			if (index > 0)
			{
				RECT r;
				GetWindowRect((HWND)lParam, &r);

				// Show context menu
				TrackPopupMenu(
					menu,
					TPM_RIGHTBUTTON | TPM_LEFTALIGN,
					(*GetString(ID_STR_ISRTL) == L'1') ? r.right : r.left,
					--r.bottom,
					0,
					m_Window,
					NULL
				);
			}

			DestroyMenu(menu);
		}
		break;

	case IDC_MANAGESKINS_CREATEPACKAGE_BUTTON:
		{
			std::wstring file = Rainmeter->GetPath() + L"SkinInstaller.exe";
			RunFile(file.c_str(), L"/Packager");
		}
		break;

	case IDC_MANAGESKINS_LOAD_BUTTON:
		{
			if (!m_SkinWindow)
			{
				// Skin not active, load
				std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinFolderPath, m_SkinFileName);
				if (indexes.first != -1 && indexes.second != -1)
				{
					Rainmeter->ActivateSkin(indexes.first, indexes.second);

					// Fake selection change to update controls
					NMHDR nm;
					nm.code = TVN_SELCHANGED;
					nm.idFrom = IDC_MANAGESKINS_SKINS_TREEVIEW;
					nm.hwndFrom = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
					OnNotify(0, (LPARAM)&nm);
				}
			}
			else
			{
				m_HandleCommands = false;
				Rainmeter->DeactivateSkin(m_SkinWindow, -1);
			}
		}
		break;

	case IDC_MANAGESKINS_REFRESH_BUTTON:
		if (m_SkinWindow)
		{
			m_SkinWindow->Refresh(false);
		}
		break;

	case IDC_MANAGESKINS_EDIT_BUTTON:
		Rainmeter->EditSkinFile(m_SkinFolderPath, m_SkinFileName);
		break;

	case IDC_MANAGESKINS_X_TEXT:
		if (HIWORD(wParam) == EN_CHANGE)
		{
			WCHAR buffer[32];
			m_IgnoreUpdate = true;
			int x = (GetWindowText((HWND)lParam, buffer, 32) > 0) ? _wtoi(buffer) : 0;
			m_SkinWindow->MoveWindow(x, m_SkinWindow->GetY());

			if (x > m_SkinWindow->GetX())
			{
				_itow_s(m_SkinWindow->GetX(), buffer, 10);
				Edit_SetText((HWND)lParam, buffer);
			}
		}
		break;

	case IDC_MANAGESKINS_Y_TEXT:
		if (HIWORD(wParam) == EN_CHANGE)
		{
			WCHAR buffer[32];
			m_IgnoreUpdate = true;
			int y = (GetWindowText((HWND)lParam, buffer, 32) > 0) ? _wtoi(buffer) : 0;
			m_SkinWindow->MoveWindow(m_SkinWindow->GetX(), y);

			if (y > m_SkinWindow->GetY())
			{
				_itow_s(m_SkinWindow->GetY(), buffer, 10);
				Edit_SetText((HWND)lParam, buffer);
			}
		}
		break;

	case IDC_MANAGESKINS_LOADORDER_TEXT:
		if (HIWORD(wParam) == EN_CHANGE)
		{
			if (m_IgnoreUpdate)
			{
				// To avoid infinite loop after setting value below
				m_IgnoreUpdate = false;
			}
			else
			{
				// Convert text to number and set it to get rid of extra chars
				WCHAR buffer[32];
				int len = GetWindowText((HWND)lParam, buffer, 32);
				if ((len == 0) || (len == 1 && buffer[0] == L'-'))
				{
					// Ignore if empty or if - is only char
					break;
				}

				// Get selection
				DWORD sel = Edit_GetSel((HWND)lParam);

				// Reset value (to get rid of invalid chars)
				m_IgnoreUpdate = true;
				int value = _wtoi(buffer);

				_itow_s(value, buffer, 10);
				SetWindowText((HWND)lParam, buffer);

				// Reset selection
				Edit_SetSel((HWND)lParam, LOWORD(sel), HIWORD(sel));

				WritePrivateProfileString(m_SkinFolderPath.c_str(), L"LoadOrder", buffer, Rainmeter->GetIniFile().c_str());
				std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinWindow);
				if (indexes.first != -1)
				{
					Rainmeter->SetLoadOrder(indexes.first, value);

					std::multimap<int, CMeterWindow*> windows;
					Rainmeter->GetMeterWindowsByLoadOrder(windows);

					CSystem::PrepareHelperWindow();

					// Reorder window z-position to reflect load order
					std::multimap<int, CMeterWindow*>::const_iterator iter = windows.begin();
					for ( ; iter != windows.end(); ++iter)
					{
						CMeterWindow* mw = (*iter).second;
						mw->ChangeZPos(mw->GetWindowZPosition(), true);
					}
				}
			}
		}
		break;

	case IDC_MANAGESKINS_DISPLAYMONITOR_BUTTON:
		{
			HMENU menu = LoadMenu(Rainmeter->GetResourceInstance(), MAKEINTRESOURCE(IDR_SKIN_MENU));
			if (menu)
			{
				HMENU subMenu = GetSubMenu(menu, 0);	// Skin menu
				subMenu = GetSubMenu(subMenu, 4); // Settings menu
				subMenu = GetSubMenu(subMenu, 0); // Position menu
				subMenu = GetSubMenu(subMenu, 0); // Display monitor menu
				Rainmeter->CreateMonitorMenu(subMenu, m_SkinWindow);

				RECT r;
				GetWindowRect((HWND)lParam, &r);

				// Show context menu
				TrackPopupMenu(
					subMenu,
					TPM_RIGHTBUTTON | TPM_LEFTALIGN,
					(*GetString(ID_STR_ISRTL) == L'1') ? r.right : r.left,
					--r.bottom,
					0,
					m_Window,
					NULL
				);

				DestroyMenu(menu);
			}
		}
		break;

	case IDC_MANAGESKINS_DRAGGABLE_CHECKBOX:
		m_IgnoreUpdate = true;
		m_SkinWindow->SetWindowDraggable(!m_SkinWindow->GetWindowDraggable());
		break;

	case IDC_MANAGESKINS_CLICKTHROUGH_CHECKBOX:
		m_IgnoreUpdate = true;
		m_SkinWindow->SetClickThrough(!m_SkinWindow->GetClickThrough());
		break;

	case IDC_MANAGESKINS_KEEPONSCREEN_CHECKBOX:
		m_IgnoreUpdate = true;
		m_SkinWindow->SetKeepOnScreen(!m_SkinWindow->GetKeepOnScreen());
		break;

	case IDC_MANAGESKINS_SAVEPOSITION_CHECKBOX:
		m_IgnoreUpdate = true;
		m_SkinWindow->SetSavePosition(!m_SkinWindow->GetSavePosition());
		break;

	case IDC_MANAGESKINS_SNAPTOEDGES_CHECKBOX:
		m_IgnoreUpdate = true;
		m_SkinWindow->SetSnapEdges(!m_SkinWindow->GetSnapEdges());
		break;

	case IDC_MANAGESKINS_ZPOSITION_COMBOBOX:
		if (HIWORD(wParam) == CBN_SELCHANGE)
		{
			m_IgnoreUpdate = true;
			ZPOSITION zpos = (ZPOSITION)(ComboBox_GetCurSel((HWND)lParam) - 2);
			m_SkinWindow->SetWindowZPosition(zpos);
		}
		break;

	case IDC_MANAGESKINS_TRANSPARENCY_COMBOBOX:
		if (HIWORD(wParam) == CBN_SELCHANGE)
		{
			m_IgnoreUpdate = true;
			int sel = ComboBox_GetCurSel((HWND)lParam) + IDM_SKIN_TRANSPARENCY_0;
			SendMessage(m_SkinWindow->GetWindow(), WM_COMMAND, sel, 0);
		}
		break;

	case IDC_MANAGESKINS_ONHOVER_COMBOBOX:
		if (HIWORD(wParam) == CBN_SELCHANGE)
		{
			m_IgnoreUpdate = true;
			HIDEMODE hide = (HIDEMODE)ComboBox_GetCurSel((HWND)lParam);
			m_SkinWindow->SetWindowHide(hide);
		}
		break;

	case IDM_MANAGESKINSMENU_EXPAND:
		{
			HWND tree = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
			HTREEITEM item = TreeView_GetSelection(tree);
			TreeView_Expand(tree, item, TVE_TOGGLE);
		}
		break;

	case IDM_MANAGESKINSMENU_OPENFOLDER:
		{
			HWND tree = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
			Rainmeter->OpenSkinFolder(GetTreeSelectionPath(tree));
		}
		break;

	default:
		if (wParam >= ID_CONFIG_FIRST && wParam <= ID_CONFIG_LAST)
		{
			std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
			int index = (int)wParam - ID_CONFIG_FIRST;
			int i = 0;
			for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
			{
				if (i == index)
				{
					std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
					name += ((*iter).second)->GetFileName();

					HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
					SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
					break;
				}

				++i;
			}
		}
		else if (wParam == IDM_SKIN_MONITOR_AUTOSELECT ||
			wParam == IDM_SKIN_MONITOR_PRIMARY ||
			wParam >= ID_MONITOR_FIRST && wParam <= ID_MONITOR_LAST)
		{
			if (m_SkinWindow)
			{
				SendMessage(m_SkinWindow->GetWindow(), WM_COMMAND, wParam, 0);
			}
			break;
		}

		return 1;
	}

	return 0;
}
Esempio n. 25
0
INT_PTR CALLBACK
GroupsPageProc(HWND hwndDlg,
               UINT uMsg,
               WPARAM wParam,
               LPARAM lParam)
{
    PGROUP_DATA pGroupData;

    UNREFERENCED_PARAMETER(lParam);
    UNREFERENCED_PARAMETER(wParam);
    UNREFERENCED_PARAMETER(hwndDlg);


    pGroupData = (PGROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);

    switch (uMsg)
    {
        case WM_INITDIALOG:
            pGroupData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GROUP_DATA));
            SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGroupData);

            pGroupData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_GROUP));

            OnInitDialog(hwndDlg);
            SetMenuDefaultItem(GetSubMenu(pGroupData->hPopupMenu, 1),
                               IDM_GROUP_PROPERTIES,
                               FALSE);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDM_GROUP_NEW:
                case IDC_GROUPS_ADD:
                    GroupNew(hwndDlg);
                    break;

                case IDM_GROUP_RENAME:
                    GroupRename(hwndDlg);
                    break;

                case IDM_GROUP_DELETE:
                case IDC_GROUPS_REMOVE:
                    GroupDelete(hwndDlg);
                    break;

                case IDM_GROUP_PROPERTIES:
                case IDC_GROUPS_PROPERTIES:
                    if (GroupProperties(hwndDlg) == IDOK)
                        UpdateGroupProperties(hwndDlg);
                    break;
            }
            break;

        case WM_NOTIFY:
            return OnNotify(hwndDlg, pGroupData, (NMHDR *)lParam);

        case WM_DESTROY:
            DestroyMenu(pGroupData->hPopupMenu);
            HeapFree(GetProcessHeap(), 0, pGroupData);
            break;
    }

    return FALSE;
}
Esempio n. 26
0
/***************************************************
OnConnect
    This member is called when a connection is made and
    accepted. Do all processing here, since the connection
    is automatically terminated when this function returns.
    Plus the thread that this function runs in is terminated
    as well.
    This function is the main engine that process all clients 
    commands.
PARAM
    NONE
RETURN
    VOID
****************************************************/
void CUT_HTTPThread::OnConnect(){

    char    command[30];
    int     success = TRUE;
    
    // Clear the data variables
    m_szFileName[0] = 0;
    m_szBuf[0]      = 0;
    m_szData[0]     = 0;

    // Get the current tick count
    long tickCount = GetTickCount();

    // Get the first line
    int len = ReceiveLine(m_szData, WSS_BUFFER_SIZE*2);

    // Break on error or disconnect
    if(len <= 0)
        return;

    // Remove the CRLF pair from the string
    CUT_StrMethods::RemoveCRLF(m_szData);

    // Parse the line
    if(CUT_StrMethods::ParseString(m_szData," ",0,command,30) != UTE_SUCCESS) {

        // Command not reconized
        Send("Command Not Reconized\r\n");
        return;
        }

    // Get the command ID
    int commandID = GetCommandID(command);

    if(commandID == CUT_NA) {
        Send("Command Not Reconized\r\n");
        return;
        }

    //**********************************
    // Check for GET
    //**********************************
    if(commandID == CUT_GET || commandID == CUT_HEAD ){

        // Get the filename
        if(CUT_StrMethods::ParseString(m_szData," ?",1,m_szBuf, WSS_BUFFER_SIZE) != UTE_SUCCESS) {
            // Command not reconized
            Send("Command Not Reconized\r\n");
            return;
            }

        // Get the absolute path
        if(MakePath(m_szFileName,m_szBuf) != UTE_SUCCESS) {
            Send("HTTP/1.0 404 Requested file not found\r\n");
            return;
            }

        // Send a start notification
        if(OnNotify(CUT_START,commandID,m_szFileName,sizeof(m_szFileName),success) == FALSE) {
            // If FALSE is returned then do not continue
            ClearReceiveBuffer();
            return;
            }

        // Open the file
		// v4.2 using CreateFileA here
        HANDLE hFile = CreateFileA(m_szFileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
        if(hFile ==  INVALID_HANDLE_VALUE) {
            Send("HTTP/1.0 404 Requested file not found\r\n");
            success = FALSE;
            }
        else {
            // Send the MIME header
            Send("HTTP/1.0 200 OK\r\n");
            _snprintf(m_szBuf,sizeof(m_szBuf)-1,"Date:%s\r\n",GetGMTStamp());
            Send(m_szBuf);
            Send("Server: The Ultimate Toolbox WWW Server\r\n");
            Send("MIME-verion: 1.0\r\n");
            _snprintf(m_szBuf,sizeof(m_szBuf)-1,"Content-type: %s\r\n",GetContentType(m_szFileName));
            Send(m_szBuf);
            _snprintf(m_szBuf,sizeof(m_szBuf)-1,"Last-modified: %s\r\n",GetFileModifiedTime(hFile));
            Send(m_szBuf);
            DWORD hiVal;
            long OrigFileSize = GetFileSize(hFile,&hiVal);
            _snprintf(m_szBuf,sizeof(m_szBuf)-1,"Content-length: %ld\r\n",OrigFileSize);
            Send(m_szBuf);
            Send("\r\n");

            // Send the file only for a GET
            if(commandID == CUT_GET) {

                // Get the max send size to send at once
                len = GetMaxSend();
                if(len > WSS_BUFFER_SIZE*2)
                    len = WSS_BUFFER_SIZE*2;       

                // Send the file
                DWORD   readLen;
                int     rt;
                long    totalLen = 0;

				// v4.2 change - was while(1) - gave conditional expression is constant warning
				for (;;) {
                    rt = ReadFile(hFile,m_szData,len,&readLen,NULL);
                    if(rt == FALSE || readLen ==0)
                        break;
                    if(Send(m_szData,readLen) == SOCKET_ERROR)
						break;
                    totalLen+= readLen;
                    }

                if(totalLen != OrigFileSize)
                    success = FALSE;
                }
            CloseHandle(hFile);
            ClearReceiveBuffer();
            }

        // Send a finish notification
        OnNotify(CUT_FINISH,commandID,m_szFileName,sizeof(m_szFileName),success);
        }

    //**********************************
    // Check for POST
    //**********************************
    else if(commandID == CUT_POST) {
        
        while(IsDataWaiting()) {
            len = ReceiveLine(m_szData, WSS_BUFFER_SIZE*2);
            CUT_StrMethods::RemoveCRLF(m_szData);
            ((CUT_HTTPServer *)m_winsockclass_this)->OnStatus(m_szData);
            }
        }

    //**********************************
    // Check for PUT
    //**********************************
    else if(commandID == CUT_PUT){
		Send("HTTP/1.0 501 Not Implemented\r\n\r\n");
	    Send("Server: The Ultimate Toolbox WWW Server\r\n");
        Send("MIME-verion: 1.0\r\n");
		return;

        }

    //**********************************
    // Check for PLACE
    //**********************************
    else if(commandID == CUT_PLACE) {
		Send("HTTP/1.0 501 Not Implemented\r\n\r\n");
		return;

        }

    //**********************************
    // Check for DELETE
    //**********************************
    else if(commandID == CUT_DELETE) {

        // Get the filename
        if(CUT_StrMethods::ParseString(m_szData," ",1,m_szBuf, WSS_BUFFER_SIZE) != UTE_SUCCESS) {
            // Command not reconized
            Send("HTTP/1.0 400 Bad Request\r\n\r\n");
            return;
            }

        // Get the absolute path
        if(MakePath(m_szFileName,m_szBuf) != UTE_SUCCESS) {
            Send("HTTP/1.0 404 Requested file not found\r\n\r\n");
            return;
            }

        // Send a start notification
        if(OnNotify(CUT_START,commandID,m_szFileName,sizeof(m_szFileName),success) == FALSE) {
            // If FALSE is returned then do not continue
			Send("HTTP/1.0 405 Method Not Allowed\r\n");
			Send("Content-Type: text/html\r\n\r\n");			
			Send("<html><body>DELETE Method Not Allowed</body></html>");			
            ClearReceiveBuffer();
            return;
            }

        // Send the finish notify
		// v4.2 using DeleteFileA here
        if(DeleteFileA(m_szFileName) == FALSE)
		{
			Send("HTTP/1.0 500 Internal Server Error\r\n");
		    success = FALSE;
			return ;
		}

        // Send a start notification
        OnNotify(CUT_FINISH,commandID,m_szFileName,sizeof(m_szFileName),success);
        }

    //**********************************
    // Allow handling for custom commands
    //**********************************
	else
	{
		// Get the rest of the data after the command
		char* pData = strstr(m_szData, " ");
		if (pData)
			strncpy(m_szBuf, pData+1, sizeof(m_szBuf));

		if(OnNotify(CUT_START,commandID,m_szBuf,sizeof(m_szBuf),success) == FALSE) {
			// If FALSE is returned then do not continue
			ClearReceiveBuffer();
			return;
		}

		OnCustomCommand(commandID,m_szBuf,WSS_BUFFER_SIZE);

        // Send a finish notification
        OnNotify(CUT_FINISH,commandID,m_szBuf,sizeof(m_szBuf),success);

		//Returns so the default OnSendStatus() implementation is not called.
		// If needed OnStatus() can be called in the OnNotify(CUT_FINISH)!
		return;
	}


    // Send a status line to the server history window
    OnSendStatus(commandID,m_szFileName,success,tickCount);
}
Esempio n. 27
0
/* Environment dialog procedure */
INT_PTR CALLBACK
EnvironmentDlgProc(HWND hwndDlg,
                   UINT uMsg,
                   WPARAM wParam,
                   LPARAM lParam)
{
    switch (uMsg)
    {
        case WM_INITDIALOG:
            OnInitDialog(hwndDlg);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_USER_VARIABLE_NEW:
                    OnNewVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
                    return TRUE;

                case IDC_USER_VARIABLE_EDIT:
                    OnEditVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
                    return TRUE;

                case IDC_USER_VARIABLE_DELETE:
                    OnDeleteVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
                    return TRUE;

                case IDC_SYSTEM_VARIABLE_NEW:
                    OnNewVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
                    return TRUE;

                case IDC_SYSTEM_VARIABLE_EDIT:
                    OnEditVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
                    return TRUE;

                case IDC_SYSTEM_VARIABLE_DELETE:
                    OnDeleteVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
                    return TRUE;

                case IDOK:
                    SetAllVars(hwndDlg, IDC_USER_VARIABLE_LIST);
                    SetAllVars(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
                    SendMessage(HWND_BROADCAST, WM_WININICHANGE,
                                0, (LPARAM)_T("Environment"));
                    EndDialog(hwndDlg, 0);
                    return TRUE;

                case IDCANCEL:
                    EndDialog(hwndDlg, 0);
                    return TRUE;
            }
            break;

        case WM_DESTROY:
            ReleaseListViewItems(hwndDlg, IDC_USER_VARIABLE_LIST);
            ReleaseListViewItems(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
            break;

        case WM_NOTIFY:
            return OnNotify(hwndDlg, (NMHDR*)lParam);
    }

    return FALSE;
}
Esempio n. 28
0
bool Win32Vif::Write(const char* buffer, unsigned int numBytes) 
{
    // ljt is this quite right??

    DWORD bytesWritten = 0;
    OVERLAPPED overlappedPtr;

    // set up overlapped structure fields
    overlappedPtr.Offset     = 0; 
    overlappedPtr.OffsetHigh = 0; 
    overlappedPtr.hEvent     = NULL; 

    const char* bufPtr = buffer;
    
    if (NULL != GetNotifier())
    {
        if (!output_ready)
        {
            if (FALSE != GetOverlappedResult(tap_handle,&write_overlapped,&bytesWritten,FALSE))
            {
                output_ready = true;
                overlappedPtr = write_overlapped;
                bufPtr = write_buffer;
                if (numBytes > BUFFER_MAX) numBytes = BUFFER_MAX;
                memcpy(write_buffer,buffer,numBytes);
            }
            else
            {
                if (GetDebugLevel() >= 2)
                    PLOG(PL_ERROR,"Win32Vif::Write() GetOverlappedResult() error: %s\n",::GetErrorString());
                return false;
            }
        }
    }

    if (0 != WriteFile(tap_handle,bufPtr,numBytes,&bytesWritten,(LPOVERLAPPED)&overlappedPtr))
    {
        numBytes = bytesWritten;
        if (0 == numBytes) 
        {
          output_ready = false;
        }
        return true;
    }
    else
    {
        numBytes = 0;
        switch (GetLastError())
        {
        case ERROR_IO_PENDING:
          return true;
        case ERROR_BROKEN_PIPE:
          OnNotify(NOTIFY_NONE);
          break;
        default:
          PLOG(PL_ERROR,"Win32Vif::Write() WriteFile() error(%d): %s\n",GetLastError(),::GetErrorString());
          break;
        }
        return false;
    }
    
    return true;
}  // end Win32Vif::Write()
Esempio n. 29
0
INT_PTR CALLBACK
UserMembershipPageProc(HWND hwndDlg,
                       UINT uMsg,
                       WPARAM wParam,
                       LPARAM lParam)
{
    PMEMBERSHIP_USER_DATA pUserData;

    UNREFERENCED_PARAMETER(lParam);
    UNREFERENCED_PARAMETER(wParam);
    UNREFERENCED_PARAMETER(hwndDlg);

    pUserData= (PMEMBERSHIP_USER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);

    switch (uMsg)
    {
        case WM_INITDIALOG:
            pUserData = (PMEMBERSHIP_USER_DATA)HeapAlloc(GetProcessHeap(),
                                                         HEAP_ZERO_MEMORY,
                                                         sizeof(MEMBERSHIP_USER_DATA) + 
                                                         lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR));
            lstrcpy(pUserData->szUserName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);

            SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData);

            GetUserMembershipData(hwndDlg, pUserData);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_USER_MEMBERSHIP_ADD:
                    AddGroupToUser(hwndDlg, pUserData);
                    break;

                case IDC_USER_MEMBERSHIP_REMOVE:
                    RemoveGroupFromUser(hwndDlg, pUserData);
                    break;
            }
            break;

        case WM_NOTIFY:
            if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY)
            {
                return TRUE;
            }
            else
            {
                return OnNotify(hwndDlg, pUserData, lParam);
            }
            break;


        case WM_DESTROY:
            if (pUserData->pGroupData)
                NetApiBufferFree(pUserData->pGroupData);

            HeapFree(GetProcessHeap(), 0, pUserData);
            break;
    }

    return FALSE;
}
Esempio n. 30
0
INT_PTR DialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_INITDIALOG:
		return OnInitDialog(wParam, lParam);

	case WM_ACTIVATE:
		return OnActivate(wParam, lParam);

	case WM_COMMAND:
		return OnCommand(wParam, lParam);

	case WM_NOTIFY:
		return OnNotify(wParam, lParam);

	case WM_GETMINMAXINFO:
		{
			MINMAXINFO* mmi = (MINMAXINFO*)lParam;
			mmi->ptMinTrackSize.x = 700;
			mmi->ptMinTrackSize.y = 350;
		}
		return TRUE;

	case WM_SIZE:
		{
			if (wParam != SIZE_MINIMIZED)
			{
				int w = LOWORD(lParam);
				int h = HIWORD(lParam);
				RECT r;

				HWND item = GetControl(Id_Tab);
				SetWindowPos(item, nullptr, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER);

				item = GetControl(Id_CloseButton);
				GetClientRect(item, &r);
				SetWindowPos(item, nullptr, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

				w -= 48;
				h -= 100;
				m_TabLog.Resize(w, h);
				m_TabSkins.Resize(w, h);
				m_TabPlugins.Resize(w, h);
				m_TabVersion.Resize(w, h);
			}
		}
		return TRUE;

	case WM_CLOSE:
		{
			GetWindowPlacement(m_Window, &c_WindowPlacement);
			if (c_WindowPlacement.showCmd == SW_SHOWMINIMIZED)
			{
				c_WindowPlacement.showCmd = SW_SHOWNORMAL;
			}

			delete c_Dialog;
			c_Dialog = nullptr;
		}
		return TRUE;
	}

	return FALSE;
}