当前位置: 首页>>代码示例>>C++>>正文


C++ MessageBeep函数代码示例

本文整理汇总了C++中MessageBeep函数的典型用法代码示例。如果您正苦于以下问题:C++ MessageBeep函数的具体用法?C++ MessageBeep怎么用?C++ MessageBeep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MessageBeep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _CmdWndProc

static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HTREEITEM hSelection;
    HKEY hRootKey;
    LPCWSTR keyPath, s;
    WORD wID = LOWORD(wParam);

    UNREFERENCED_PARAMETER(message);

    switch (wID)
    {
        /* Parse the menu selections: */
    case ID_REGISTRY_EXIT:
        DestroyWindow(hWnd);
        break;
    case ID_VIEW_REFRESH:
        /* TODO */
        break;
    case ID_TREE_EXPANDBRANCH:
        (void)TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_EXPAND);
        break;
    case ID_TREE_COLLAPSEBRANCH:
        (void)TreeView_Expand(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd), TVE_COLLAPSE);
        break;
    case ID_TREE_RENAME:
        SetFocus(g_pChildWnd->hTreeWnd);
        (void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
        break;
    case ID_TREE_DELETE:
        hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
        keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);

        if (keyPath == 0 || *keyPath == 0)
        {
            MessageBeep(MB_ICONHAND);
        }
        else if (DeleteKey(hWnd, hRootKey, keyPath))
            DeleteNode(g_pChildWnd->hTreeWnd, 0);
        break;
    case ID_TREE_EXPORT:
        ExportRegistryFile(g_pChildWnd->hTreeWnd);
        break;
    case ID_EDIT_FIND:
        FindDialog(hWnd);
        break;
    case ID_EDIT_COPYKEYNAME:
        hSelection = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
        keyPath = GetItemPath(g_pChildWnd->hTreeWnd, hSelection, &hRootKey);
        CopyKeyName(hWnd, hRootKey, keyPath);
        break;
    case ID_EDIT_NEW_KEY:
        CreateNewKey(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
        break;
    case ID_EDIT_NEW_STRINGVALUE:
    case ID_EDIT_NEW_BINARYVALUE:
    case ID_EDIT_NEW_DWORDVALUE:
        SendMessageW(hFrameWnd, WM_COMMAND, wParam, lParam);
        break;
    case ID_SWITCH_PANELS:
        g_pChildWnd->nFocusPanel = !g_pChildWnd->nFocusPanel;
        SetFocus(g_pChildWnd->nFocusPanel? g_pChildWnd->hListWnd: g_pChildWnd->hTreeWnd);
        break;
    default:
        if ((wID >= ID_TREE_SUGGESTION_MIN) && (wID <= ID_TREE_SUGGESTION_MAX))
        {
            s = Suggestions;
            while(wID > ID_TREE_SUGGESTION_MIN)
            {
                if (*s)
                    s += wcslen(s) + 1;
                wID--;
            }
            SelectNode(g_pChildWnd->hTreeWnd, s);
            break;
        }
        return FALSE;
    }
    return TRUE;
}
开发者ID:RareHare,项目名称:reactos,代码行数:79,代码来源:childwnd.c

示例2: LogProc

static int CALLBACK LogProc(HWND hwnd, UINT msg,
			    WPARAM wParam, LPARAM lParam)
{
    int i;

    switch (msg) {
      case WM_INITDIALOG:
	{
	    char *str = dupprintf("%s Event Log", appname);
	    SetWindowText(hwnd, str);
	    sfree(str);
	}
	{
	    static int tabs[4] = { 78, 108 };
	    SendDlgItemMessage(hwnd, IDN_LIST, LB_SETTABSTOPS, 2,
			       (LPARAM) tabs);
	}
	for (i = 0; i < nevents; i++)
	    SendDlgItemMessage(hwnd, IDN_LIST, LB_ADDSTRING,
			       0, (LPARAM) events[i]);
	return 1;
      case WM_COMMAND:
	switch (LOWORD(wParam)) {
	  case IDOK:
	  case IDCANCEL:
	    logbox = NULL;
	    SetActiveWindow(GetParent(hwnd));
	    DestroyWindow(hwnd);
	    return 0;
	  case IDN_COPY:
	    if (HIWORD(wParam) == BN_CLICKED ||
		HIWORD(wParam) == BN_DOUBLECLICKED) {
		int selcount;
		int *selitems;
		selcount = SendDlgItemMessage(hwnd, IDN_LIST,
					      LB_GETSELCOUNT, 0, 0);
		if (selcount == 0) {   /* don't even try to copy zero items */
		    MessageBeep(0);
		    break;
		}

		selitems = snewn(selcount, int);
		if (selitems) {
		    int count = SendDlgItemMessage(hwnd, IDN_LIST,
						   LB_GETSELITEMS,
						   selcount,
						   (LPARAM) selitems);
		    int i;
		    int size;
		    char *clipdata;
		    static unsigned char sel_nl[] = SEL_NL;

		    if (count == 0) {  /* can't copy zero stuff */
			MessageBeep(0);
			break;
		    }

		    size = 0;
		    for (i = 0; i < count; i++)
			size +=
			    strlen(events[selitems[i]]) + sizeof(sel_nl);

		    clipdata = snewn(size, char);
		    if (clipdata) {
			char *p = clipdata;
			for (i = 0; i < count; i++) {
			    char *q = events[selitems[i]];
			    int qlen = strlen(q);
			    memcpy(p, q, qlen);
			    p += qlen;
			    memcpy(p, sel_nl, sizeof(sel_nl));
			    p += sizeof(sel_nl);
			}
			write_aclip(NULL, clipdata, size, TRUE);
			sfree(clipdata);
		    }
		    sfree(selitems);

		    for (i = 0; i < nevents; i++)
			SendDlgItemMessage(hwnd, IDN_LIST, LB_SETSEL,
					   FALSE, i);
		}
	    }
	    return 0;
	}
	return 0;
      case WM_CLOSE:
	logbox = NULL;
	SetActiveWindow(GetParent(hwnd));
	DestroyWindow(hwnd);
	return 0;
    }
开发者ID:adderek,项目名称:adbputty,代码行数:92,代码来源:WINDLG.C

示例3: MessageBeep

void CADQIDlg::OnDblClkInterfaces()
{
    CString s;
    int xx=0;
    int idx;
    IUnknown *pNewUnk = NULL;


    idx = m_cListIf.GetCurSel();
    if ( idx == LB_ERR )
    {
        MessageBeep(0);
        return;
    }


    CWaitCursor wait;
    m_cListIf.GetText( idx, s );


    //////////////////////////////////////////////////////////////
    //
    // Find the appropriate dialog box to display
    //
    /////////////////////////////////////////////////////////////////
    while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) && s != adsiIfs[xx].szIf  )
    {
        xx++;
    }

    ASSERT( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) );
    if ( adsiIfs[xx].pFn )
    {
        m_pUnk->AddRef();
        (*adsiIfs[xx].pFn)( m_pUnk, &pNewUnk );
    }
    else
    {
        wait.Restore();
        AfxMessageBox(_T("No UI implemented yet"));
    }



    ////////////////////////////////////////////////////
    // if IADsOpenObject is selected, special care
    ///////////////////////////////////////////////////
    if ( pNewUnk )
    {

        HRESULT hr;
        BSTR  bstr;
        IADs  *pADs;

        hr = pNewUnk->QueryInterface( IID_IADs, (void**) &pADs );
        if ( SUCCEEDED(hr) )
        {
            pADs->get_ADsPath( &bstr );
        }
        pADs->Release();

        m_sADsPath = bstr;
        SysFreeString( bstr );


        m_pUnk->Release(); // old ads iunknown path;
        m_pUnk = pNewUnk;

        UpdateData(FALSE);
        EnumerateInterface();

    }


}
开发者ID:dbremner,项目名称:Windows-classic-samples,代码行数:75,代码来源:ADQIDlg.cpp

示例4: MessageBeep

BOOL CMyDateEdit::CheckTime(char nchar,int StartPos,int EndPos)
{
	CString strText;
	if(m_isTime)
	{
		if(StartPos==2||StartPos==3||StartPos==5||StartPos==6)
		{
			if (nchar>'5')
			{
				MessageBeep((UINT)-1);
				return FALSE;
			}
		}	
		if(StartPos==0)
		{
			if (nchar>'2')
			{
				MessageBeep((UINT)-1);
				return FALSE;
			}
			if(nchar=='2')
			{
				if(GetText().GetAt(1)>'3')
				{
					strText=GetText();
					strText.SetAt(1,'3');
					SetWindowText(strText);
					SetSel(StartPos,EndPos);
					return TRUE;
				}
			}
		}	
		if(StartPos==1)
		{
			if(GetText().GetAt(0)=='2')
			{
				if(nchar>'3')
				{
					MessageBeep((UINT)-1);
					return FALSE;			
				}

			}
		}
	}
	if(m_isDateTime)
	{
		if(StartPos==13||StartPos==14||StartPos==16||StartPos==17)
		{
			if (nchar>'5')
			{
				MessageBeep((UINT)-1);
				return FALSE;
			}
		}
		if(StartPos==10||StartPos==11)
		{
			if (nchar>'2')
			{
				MessageBeep((UINT)-1);
				return FALSE;
			}
			if(nchar=='2')
			{
				if(GetText().GetAt(12)>'3')
				{
					strText=GetText();
					strText.SetAt(12,'3');
					SetWindowText(strText);
					SetSel(StartPos,EndPos);
					return TRUE;
				}
			}
		}	
		if(StartPos==12)
		{
			if(GetText().GetAt(11)=='2')
			{
				if(nchar>'3')
				{
					MessageBeep((UINT)-1);
					return FALSE;			
				}

			}
		}
	}	
	return TRUE;
}
开发者ID:likebeta,项目名称:code-snippets,代码行数:89,代码来源:MyDateEdit.cpp

示例5: MessageBeep

// This function tries to prevent the user from entering invalid
// amounts in the CArborEditCurrency text control.  This is difficult
// to do here because you really need the amount string after the edit,
// not before.  This function attempts to construct the new amount string,
// but it's risky business trying to predict what Windows will REALLY do...
//
// A better approach might be to construct a DDV_Currency function that
// checks for valid amounts after the user selects "OK" from the dialog box.
void CArborEditCurrency::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// If the control is read only, beep and exit
	if (GetStyle() & ES_READONLY)
	{
		MessageBeep(MB_ICONEXCLAMATION);
		return;
	}

	// Get the decimal delimiter for this currency.  Beep and exit if problem
	// getting currency info (invalid currency or init_currency_formats
	// not called)
	char cDelimiter = get_currency_decimal_delimiter(m_iCurrencyCode);
	if (cDelimiter == -1)
	{
		MessageBeep(MB_ICONEXCLAMATION);
		return;
	}

	// If the input character is not a control character,
	// digit, or decimal delimiter, then beep and exit
	if (!(nChar < 0x20) &&
		!isdigit(nChar) &&
		!(nChar == (UINT)cDelimiter))
	{
		MessageBeep(MB_ICONEXCLAMATION);
		return;
	}

	// Now attempt to construct what the new text string will look like.
	// Only try this for "normal" edits; i.e., edits that don't involve
	// control characters other than paste (0x16).
	if (nChar == 0x16 || nChar > 0x19)
	{
		// Get the old string
		CString oldString;
		GetWindowText(oldString);

		// Get the inserted string.  This is a single character unless
		// text is being pasted from the clipboard.
		CString insertedString;
		if (nChar != 0x16)
		{
			insertedString = (char)nChar;
		}
		else
		{
			// Get pasted text from the clipboard
			if (OpenClipboard())
			{
				HGLOBAL hData = ::GetClipboardData(CF_TEXT);
				if (hData)
				{
					insertedString = (LPCTSTR) GlobalLock(hData);
					GlobalUnlock(hData);
				}
			}
			CloseClipboard();
		}

		// Construct the new string.
		// Replace any text that is currently selected.
		int iStartSel, iEndSel;
		GetSel(iStartSel, iEndSel);
		CString newString = oldString.Left(iStartSel) + insertedString
			+ oldString.Right(oldString.GetLength() - iEndSel);

		// Count the number of minus signs, decimal delimiters,
		// integer digits, and decimal digits
		int nMinusSigns = 0;
		int nDelimiters = 0;
		int nIntegerDigits = 0;
		int nDecimalDigits = 0;

		for (int i = 0; i < newString.GetLength(); i++)
		{
			if (newString[i] == '-')
				nMinusSigns++;
			if (newString[i] == cDelimiter)
				nDelimiters++;
			if (isdigit(newString[i]) && nDelimiters == 0)
				nIntegerDigits++;
			if (isdigit(newString[i]) && nDelimiters > 0)
				nDecimalDigits++;
		}

		// Determine the maximum number of integer and decimal digits
		// based on Arb_numeric and the currency.  If problem getting
		// currency info (perhaps invalid currency or init_currency_formats
		// not called), beep and exit.
		int maxDecimalDigits = get_currency_implied_decimal(m_iCurrencyCode);
		if (maxDecimalDigits == -1)
//.........这里部分代码省略.........
开发者ID:huilang22,项目名称:Projects,代码行数:101,代码来源:arboreditcurrency.cpp

示例6: MessageBeep

void WinSonicSimpleAlert::Beep() const
{
	MessageBeep(MB_ICONASTERISK);
}
开发者ID:shengang1978,项目名称:HH,代码行数:4,代码来源:WinSonicSimpleAlert.cpp

示例7: AfxMessageBox

LRESULT CSwissKnifePaneModify::OnGridNotify( WPARAM wParam, LPARAM lParam )
{
	if (wParam == XTP_PGN_INPLACEBUTTONDOWN)
	{
		CXTPPropertyGridInplaceButton* pButton = (CXTPPropertyGridInplaceButton*)lParam;
		if (pButton->GetItem()->GetID() == 510 && pButton->GetID() == XTP_ID_PROPERTYGRID_EXPANDBUTTON) // 2 Buttons
		{
			AfxMessageBox(_T("Expand button"));
			return TRUE;
		}
	}

	if (wParam == XTP_PGN_SORTORDER_CHANGED)
	{
		UpdateData(FALSE);
		TRACE(_T("SortOrder Changed.\n"));
	}
	if (wParam == XTP_PGN_ITEMVALUE_CHANGED)
	{
		CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
		TRACE(_T("Value Changed. Caption = %s, ID = %i, Value = %s\n"), pItem->GetCaption(), pItem->GetID(), pItem->GetValue());

		if (DYNAMIC_DOWNCAST(CXTPPropertyGridItemEnum, pItem))
		{
			if (pItem->GetMetrics(TRUE, FALSE))
			{
				pItem->GetMetrics(TRUE, FALSE)->m_nImage = ((CXTPPropertyGridItemEnum*)pItem)->GetEnum();
			}
		}


		if( pItem->GetID() == ID_CREATE_PHYSIC_LAYER)
		{
			CXTPPropertyGridItemBool* itembool = (CXTPPropertyGridItemBool*)pItem;
			if (m_currTarget && itembool->GetBool())
			{
				if (!m_currTarget->getPhysicLayer())
				{
#ifdef OS_WIN32

						IGameObjectPhysicLayer* pPhysicLayer = gEnv->pPhysics->CreatePhysicLayer();
						m_currTarget->setGameObjectLayer(pPhysicLayer);
						pPhysicLayer->createStatic();

						
#endif

				}
			}
		}
	}
	if (wParam == XTP_PGN_SELECTION_CHANGED)
	{
		CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
		if (pItem)
		{
			if (pItem->IsKindOf(RUNTIME_CLASS(CXTPPropertyGridItemColor)))
			{
				TRACE(_T("Color Item. Selection Changed. Item = %s\n"), pItem->GetCaption());
			}
		}
	}
	if (wParam == XTP_PGN_EDIT_CHANGED)
	{
		CXTPPropertyGridInplaceEdit* pEdit = DYNAMIC_DOWNCAST(CXTPPropertyGridInplaceEdit, (CWnd*)lParam);
		if (pEdit && pEdit->GetItem())
		{
			// Custom Validation
			// Custom Validation
			if (pEdit->GetItem()->GetCaption() == _T("ItemsInMRUList"))
			{
				CString str;
				pEdit->CEdit::GetWindowText(str);

				int i = _ttoi(str);
				if (i > 20)
				{
					MessageBeep((UINT)-1);
					pEdit->SetSel(0, -1);
					pEdit->ReplaceSel(_T("20"));
				}
			}
		}
	}
	return 0;
}
开发者ID:CheryJazz,项目名称:gkEngine,代码行数:86,代码来源:SwissKnifePaneModify.cpp

示例8: MyToUpper

void CChEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
#if 1

	// flomar, 03/28/2013: after hours of debugging I finally located the source of 
	// the problem; obviously the user's key strokes weren't correctly processed, in 
	// other words a character inserted at a specific location would get assigned to an 
	// incorrect matrix cell-- before digging in any deeper I completely re-wrote this 
	// function; it *should* work as intended now; I left the old code in here on purpose 
	// (see the '#if' blocks above and below) in case someone has to deal with this in 
	// another 10 or so years, and I'm not 100% sure I didn't introduce some bugs myself

	// the character the user tried to insert-- in case the character is invalid with regards 
	// to the analysis alphabet, it gets replaced implicitly; if the replacement fails (i.e. 
	// the character is still invalid), we return right away and notify the user with a beep
	const char newCharacter = MyToUpper(m_Alg->getAlphabet()->replaceInvalidLetter(true, nChar));
	if(!m_Alg->myisalpha2(newCharacter)) {
		MessageBeep(MB_OK);
	}
	// the character that was replaced by the new character; the way this is handled 
	// is pretty ugly with all that SetSel/GetLine stuff, but I'm certainly not gonna 
	// touch any other parts of this dialog for the meantime (note: a better solution 
	// would be to have member variables for each and every cell of the GUI matrix);
	// in case the character is not part of the analysis alphabet, we're trying to 
	// convert it just like we did with the new character above
	char tempCharacter[2];
	memset(tempCharacter, 0, sizeof(char) * 2);
	SetSel(0, 1);
	GetLine(0, tempCharacter, 1);
	ReplaceSel(CString(newCharacter));
	SetSel(0, 1);
	// try to replace the temp character with something valid, if necessary
	tempCharacter[0] = MyToUpper(m_Alg->getAlphabet()->replaceInvalidLetter(true, tempCharacter[0]));
	// if the character is still invalid after the conversion, we proceed with a 
	// null element which, as of today, is denoted by the '*' character
	if(!tempCharacter[0]) {
		tempCharacter[0] = m_Alg->getAlphabet()->getNullElement()->getValue();
	}
	// at this point all conversion work is done, we can now assign the old character
	const char oldCharacter = tempCharacter[0];
	// if old a new character are identical, return without doing anything else
	if(newCharacter == oldCharacter) {
		return;
	}
	// if the new character is invalid (not part of the alphabet), return as well
	if(!m_Alg->myisalpha2(newCharacter)) {
		return;
	}
	// we're gonna need those in a minute...
	int newCharacterIndexColumn = -1;
	int newCharacterIndexRow = -1;
	// get the size of the current maxtrix (either 5x5 or 6x6)
	const int matrixSize = m_Alg->getSize();
	// go through all cells of the matrix and find the newly inserted character
	for(int indexRow=0; indexRow<matrixSize; indexRow++) {
		for(int indexColumn=0; indexColumn<matrixSize; indexColumn++) {
			// get the current character
			char currentCharacter = m_Alg->getCharOfMatrix(indexColumn, indexRow);
			// ignore null elements
			if(currentCharacter != m_Alg->getAlphabet()->getNullElement()->getValue()) {
				// assign indices for new character
				if(newCharacter == currentCharacter) {
					newCharacterIndexColumn = indexColumn;
					newCharacterIndexRow = indexRow;
				}
			}
		}
	}
	// this variable tells us if the new character did already exist in the matrix
	const bool newCharacterAlreadyExisted = newCharacterIndexColumn != -1 && newCharacterIndexRow != -1;
	// if the new character did NOT exist in the matrix, determine its indices (column/row)
	if(!newCharacterAlreadyExisted) {
		for(int indexRow=0; indexRow<matrixSize && newCharacterIndexRow<0; indexRow++) {
			for(int indexColumn=0; indexColumn<matrixSize && newCharacterIndexColumn<0; indexColumn++) {
				// get the content of the current matrix cell
				CString stringCurrentMatrixCell;
				m_Dia->getEinfeld(indexColumn, indexRow)->GetWindowText(stringCurrentMatrixCell);
				// check if we've arrived at the new character
				if(newCharacter == stringCurrentMatrixCell[0]) {
					// update indices for the new character
					newCharacterIndexColumn = indexColumn;
					newCharacterIndexRow = indexRow;
					// now update the matrix (actually insert the new character at its appropriate position)
					m_Alg->setElMatrix(newCharacter, newCharacterIndexColumn, newCharacterIndexRow);
				}
			}
		}
	}
	// in case the new character was already inserted, switch back to the old character
	if(newCharacterAlreadyExisted) {
		// update the dialog
		m_Dia->getEinfeld(newCharacterIndexColumn, newCharacterIndexRow)->SetWindowText(CString(oldCharacter));
		// update the analysis
		m_Alg->setElMatrix(oldCharacter, newCharacterIndexColumn, newCharacterIndexRow);
	}
	// some clean-up work
	m_Alg->UpdateDigrams(m_Dia->getDec());
	m_Alg->DoCipher(false, m_Dia->getDec(),MAXSHOWLETTER);
	m_Dia->UpdateListBox();
	m_Dia->UpdatePassword();
//.........这里部分代码省略.........
开发者ID:flomar,项目名称:CrypTool-VS2015,代码行数:101,代码来源:DlgPlayfairAnalysis.cpp

示例9: MessageBeep

/////////////////////////////////////////////////////////////////////////////
//	OnEditVerifyPercentCell
//		This is a handy utility to keep user entry in percent cells valid as they type.
//    The caller should determine that the cell is for percent entry, and if so
//    can pass verification of the input key to this function.
//	Params:
//		col, row	- location of the edit cell
//		edit		-	pointer to the edit control
//		vcKey		- virtual key code of the pressed key
//	Return:
//		TRUE - to accept pressed key
//		FALSE - to do not accept the key
int CDDBaseGrid::OnEditVerifyPercentCell(int col, long row,CWnd *edit,UINT *vcKey)
{
   // Cursor movement keys are okay
   // But these symbols don't work ... ?
   //if (*vcKey == VK_BACK || *vcKey == VK_LEFT || *vcKey == VK_RIGHT || *vcKey == VK_DELETE)
   //   return TRUE;
   if (*vcKey == VK_BACK || *vcKey == 0x7F /*Delete*/ 
      || *vcKey == VK_CANCEL/*Ctrl+C*/ || *vcKey == 0x16/*Ctrl+V*/)
      return TRUE;

   // Current selection will be replaced, so chars in there don't matter, remove them from
   // consideration during validation tests.
   CString curTxt;
   CEdit *cedit = (CEdit*)edit;
   edit->GetWindowText(curTxt);
   int startIndx = -1, endIndx = -1;
   cedit->GetSel(startIndx, endIndx);
   if (startIndx > -1 && endIndx > startIndx)
      curTxt.Delete(startIndx, endIndx - startIndx);

   int curPercentIndx = curTxt.Find("%");

   // Alpha chars '.' and '%' accepted, but only one per customer
   if (*vcKey == '%' || *vcKey == '.')
   {
      // Possibly okay, make sure no duplicate of percent or decimal pt.

      int curDecimalIndx = curTxt.Find(".");

      // Can only have one of these
      if (*vcKey == '%' && curPercentIndx > -1)
      {
         MessageBeep((UINT)-1);
         return FALSE;
      }
      if (*vcKey == '.' && curDecimalIndx > -1)
      {
         MessageBeep((UINT)-1);
         return FALSE;
      }

      // Can't put decimal after percent
      // startIndx is where new char will go
      if (*vcKey == '.' && curPercentIndx > -1 && startIndx > curPercentIndx)
      {
         MessageBeep((UINT)-1);
         return FALSE;
      }

      // Percent can only go at end
      if (*vcKey == '%' && startIndx < curTxt.GetLength())
      {
         MessageBeep((UINT)-1);
         return FALSE;
      }

      // Okay, we'll accept the char
      return TRUE;
   }

   // We're accepting digits, but can't be after percent
   if (isdigit(*vcKey))
   {
      // Can't put digits after percent
      // startIndx is where new char will go
      if (curPercentIndx > -1 && startIndx > curPercentIndx)
      {
         MessageBeep((UINT)-1);
         return FALSE;
      }

      // Okay
      return TRUE;
   }

   // All else
   MessageBeep((UINT)-1);
   return FALSE;
}
开发者ID:mpatwa,项目名称:CCEtoODB_Translator,代码行数:91,代码来源:UltimateGrid.cpp

示例10: _CmdWndProc


//.........这里部分代码省略.........
                TCHAR msg[128], caption[128];
                LoadString(hInst, IDS_QUERY_DELETE_CONFIRM, caption, sizeof(caption)/sizeof(TCHAR));
                LoadString(hInst, (nSelected == 1 ? IDS_QUERY_DELETE_ONE : IDS_QUERY_DELETE_MORE), msg, sizeof(msg)/sizeof(TCHAR));
                if(MessageBox(g_pChildWnd->hWnd, msg, caption, MB_ICONQUESTION | MB_YESNO) == IDYES)
                {
                    int ni, errs;

                    item = -1;
                    errs = 0;
                    while((ni = ListView_GetNextItem(g_pChildWnd->hListWnd, item, LVNI_SELECTED)) > -1)
                    {
                        valueName = GetValueName(g_pChildWnd->hListWnd, item);
                        if(RegDeleteValue(hKey, valueName) != ERROR_SUCCESS)
                        {
                            errs++;
                        }
                        item = ni;
                    }

                    RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
                    if(errs > 0)
                    {
                        LoadString(hInst, IDS_ERR_DELVAL_CAPTION, caption, sizeof(caption)/sizeof(TCHAR));
                        LoadString(hInst, IDS_ERR_DELETEVALUE, msg, sizeof(msg)/sizeof(TCHAR));
                        MessageBox(g_pChildWnd->hWnd, msg, caption, MB_ICONSTOP);
                    }
                }
            }
        }
        else if (GetFocus() == g_pChildWnd->hTreeWnd)
        {
            if (keyPath == 0 || *keyPath == 0)
            {
                MessageBeep(MB_ICONHAND);
            }
            else if (DeleteKey(hWnd, hKeyRoot, keyPath))
            {
                DeleteNode(g_pChildWnd->hTreeWnd, 0);
                RefreshTreeView(g_pChildWnd->hTreeWnd);
            }
        }
        break;
    }
    case ID_EDIT_NEW_STRINGVALUE:
        CreateNewValue(hKeyRoot, keyPath, REG_SZ);
        break;
    case ID_EDIT_NEW_BINARYVALUE:
        CreateNewValue(hKeyRoot, keyPath, REG_BINARY);
        break;
    case ID_EDIT_NEW_DWORDVALUE:
        CreateNewValue(hKeyRoot, keyPath, REG_DWORD);
        break;
    case ID_EDIT_NEW_MULTISTRINGVALUE:
        CreateNewValue(hKeyRoot, keyPath, REG_MULTI_SZ);
        break;
    case ID_EDIT_NEW_EXPANDABLESTRINGVALUE:
        CreateNewValue(hKeyRoot, keyPath, REG_EXPAND_SZ);
        break;
    case ID_EDIT_FIND:
        FindDialog(hWnd);
        break;
    case ID_EDIT_FINDNEXT:
        FindNext(hWnd);
        break;
    case ID_EDIT_COPYKEYNAME:
        CopyKeyName(hWnd, hKeyRoot, keyPath);
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:67,代码来源:framewnd.c

示例11: WndProc

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static int		idColor[5] = {WHITE_BRUSH, LTGRAY_BRUSH, GRAY_BRUSH, DKGRAY_BRUSH, BLACK_BRUSH};
	static int		iSelection = IDM_BKGND_WHITE;
	static HMENU	hMenu, hSubMenu;
	POINT			point;
	int				cnt;
	HDC				hdc;
	TCHAR			szBuffer[10];

	switch (message) {
	//case WM_CREATE:
	//	hMenu = LoadMenu(hInst, szAppName);
	//	hMenu = GetSubMenu(hMenu, 0);
	//	return 0;

	case WM_RBUTTONUP:
		hMenu = LoadMenu(hInst, szAppName);
		hMenu = GetSubMenu(hMenu, 1);
		
		point.x = LOWORD(lParam);
		point.y = HIWORD(lParam);
		ClientToScreen(hwnd, &point);
		TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hwnd, NULL);


		//Show count
		hSubMenu = GetSubMenu(hMenu, 0);
		hdc = GetDC(hwnd);
		TextOut(hdc,0 ,0, szBuffer, wsprintf(szBuffer, TEXT("File: %i"), GetMenuItemCount(hSubMenu))); 
		ReleaseDC(hwnd, hdc);
		DestroyMenu(hSubMenu);

		hSubMenu = GetSubMenu(hMenu, 3);
		hdc = GetDC(hwnd);
		TextOut(hdc,0 ,20, szBuffer, wsprintf(szBuffer, TEXT("Timer: %i"), GetMenuItemCount(hSubMenu))); 
		ReleaseDC(hwnd, hdc);
		DestroyMenu(hSubMenu);

		DestroyMenu(hMenu);

		return 0;

	case WM_COMMAND:
		hMenu = GetMenu(hwnd);
		switch (LOWORD (wParam)) {
		case IDM_FILE_NEW:
		case IDM_FILE_OPEN:
		case IDM_FILE_SAVE:
		case IDM_FILE_SAVE_AS:
			MessageBeep(0);
			return 0;

		case IDM_APP_EXIT:
			SendMessage(hwnd, WM_CLOSE, 0, 0);
			return 0;

		case IDM_EDIT_UNDO:
		case IDM_EDIT_CUT:
		case IDM_EDIT_COPY:
		case IDM_EDIT_PASTE:
		case IDM_EDIT_CLEAR:
			MessageBeep(0);
			return 0;

		case IDM_BKGND_WHITE:
		case IDM_BKGND_LTGRAY:
		case IDM_BKGND_GRAY:
		case IDM_BKGND_DKGRAY:
		case IDM_BKGND_BLACK:
			CheckMenuItem(hMenu, iSelection, MF_UNCHECKED);
			iSelection = LOWORD(wParam);
			CheckMenuItem(hMenu, iSelection, MF_CHECKED);

			SetClassLong(hwnd, GCL_HBRBACKGROUND, (LONG) GetStockObject(idColor[LOWORD(wParam) - IDM_BKGND_WHITE]));
			InvalidateRect(hwnd, NULL, TRUE);
			return 0;

		case IDM_TIMER_START:
			if (SetTimer(hwnd, ID_TIMER, 1000, NULL)) {
				EnableMenuItem(hMenu, IDM_TIMER_START, MF_GRAYED);
				EnableMenuItem(hMenu, IDM_TIMER_STOP, MF_ENABLED);
			}
			return 0;

		case IDM_TIMER_STOP:
			KillTimer(hwnd, ID_TIMER);
			EnableMenuItem(hMenu, IDM_TIMER_START, MF_ENABLED);
			EnableMenuItem(hMenu, IDM_TIMER_STOP, MF_GRAYED);
			return 0;

		case IDM_APP_HELP:
			MessageBox(hwnd, TEXT("Help not yet implemented!"), szAppName, MB_ICONEXCLAMATION | MB_OK);
			return 0;

		case IDM_APP_ABOUT:
			MessageBox(hwnd, TEXT("Menu Demonstration Program\n") TEXT("(c) hogehoge, 2013"), szAppName, MB_ICONINFORMATION | MB_OK);
			return 0;
		}
		//break;
//.........这里部分代码省略.........
开发者ID:ochikage,项目名称:programming_windows,代码行数:101,代码来源:PopMenu.c

示例12: MainDlgProc


//.........这里部分代码省略.........
	    SetDlgItemText(hwnd, IDC_COMMENTEDIT, *state->commentptr);
	    /*
	     * Set the key fingerprint.
	     */
	    savecomment = *state->commentptr;
	    *state->commentptr = NULL;
	    if (state->ssh2) {
		char *fp;
		fp = state->ssh2key.alg->fingerprint(state->ssh2key.data);
		SetDlgItemText(hwnd, IDC_FINGERPRINT, fp);
		sfree(fp);
	    } else {
		char buf[128];
		rsa_fingerprint(buf, sizeof(buf), &state->key);
		SetDlgItemText(hwnd, IDC_FINGERPRINT, buf);
	    }
	    *state->commentptr = savecomment;
	    /*
	     * Construct a decimal representation of the key, for
	     * pasting into .ssh/authorized_keys or
	     * .ssh/authorized_keys2 on a Unix box.
	     */
	    if (state->ssh2) {
		setupbigedit2(hwnd, IDC_KEYDISPLAY,
			      IDC_PKSTATIC, &state->ssh2key);
	    } else {
		setupbigedit1(hwnd, IDC_KEYDISPLAY,
			      IDC_PKSTATIC, &state->key);
	    }
	}
	/*
	 * Finally, hide the progress bar and show the key data.
	 */
	ui_set_state(hwnd, state, 2);
	break;
      case WM_HELP:
        if (help_path) {
            int id = ((LPHELPINFO)lParam)->iCtrlId;
            char *cmd = NULL;
            switch (id) {
              case IDC_GENERATING:
              case IDC_PROGRESS:
              case IDC_GENSTATIC:
              case IDC_GENERATE:
                cmd = "JI(`',`puttygen.generate')"; break;
              case IDC_PKSTATIC:
              case IDC_KEYDISPLAY:
                cmd = "JI(`',`puttygen.pastekey')"; break;
              case IDC_FPSTATIC:
              case IDC_FINGERPRINT:
                cmd = "JI(`',`puttygen.fingerprint')"; break;
              case IDC_COMMENTSTATIC:
              case IDC_COMMENTEDIT:
                cmd = "JI(`',`puttygen.comment')"; break;
              case IDC_PASSPHRASE1STATIC:
              case IDC_PASSPHRASE1EDIT:
              case IDC_PASSPHRASE2STATIC:
              case IDC_PASSPHRASE2EDIT:
                cmd = "JI(`',`puttygen.passphrase')"; break;
              case IDC_LOADSTATIC:
              case IDC_LOAD:
                cmd = "JI(`',`puttygen.load')"; break;
              case IDC_SAVESTATIC:
              case IDC_SAVE:
                cmd = "JI(`',`puttygen.savepriv')"; break;
              case IDC_SAVEPUB:
                cmd = "JI(`',`puttygen.savepub')"; break;
              case IDC_TYPESTATIC:
              case IDC_KEYSSH1:
              case IDC_KEYSSH2RSA:
              case IDC_KEYSSH2DSA:
                cmd = "JI(`',`puttygen.keytype')"; break;
              case IDC_BITSSTATIC:
              case IDC_BITS:
                cmd = "JI(`',`puttygen.bits')"; break;
              case IDC_IMPORT:
              case IDC_EXPORT_OPENSSH:
              case IDC_EXPORT_SSHCOM:
                cmd = "JI(`',`puttygen.conversions')"; break;
            }
            if (cmd) {
                WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
                requested_help = TRUE;
            } else {
                MessageBeep(0);
            }
        }
        break;
      case WM_CLOSE:
	state = (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
	sfree(state);
        if (requested_help) {
            WinHelp(hwnd, help_path, HELP_QUIT, 0);
            requested_help = FALSE;
        }
	EndDialog(hwnd, 1);
	return 0;
    }
    return 0;
}
开发者ID:rdebath,项目名称:sgt,代码行数:101,代码来源:puttygen.c

示例13: Sys_Beep

void Sys_Beep( void )
{
	MessageBeep( MB_ICONASTERISK );
}
开发者ID:OnlyTheGhosts,项目名称:OWEngine,代码行数:4,代码来源:Win_qe3.cpp

示例14: EditCtlProc

LRESULT CALLBACK EditCtlProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
    LPCTSTR lpTable, lpTable1;
    TCHAR   c;
#ifdef FAREAST
    TCHAR ch, chHW;
#endif // FAREAST
    HKL     hkl = GetKeyboardLayout(0);

    ASSERT(oldEditCtlProc);

    switch (message) {
    case WM_PASTE :
    {
        BOOL bPassThrough = TRUE;

        if (IsNumericOnlyEdit(hwnd))
        {
            // only going to accept pastes that have pure numeric data in them

            HANDLE hMem;

            if(OpenClipboard(hwnd))
            {
                hMem = GetClipboardData(CF_UNICODETEXT);
                if(hMem)
                {
                    TCHAR *pText = (TCHAR *)LocalLock(hMem); // can't fail on CE
                    int iLen = _tcslen(pText);
                    int iPos = 0;

                    for (iPos = 0; (iPos < iLen) && bPassThrough; iPos++)
                    {
                        if (!_istdigit(pText[iPos]))
                        {
                            // bad char
                            bPassThrough = FALSE;

                        }
                    }

                    LocalUnlock(hMem);
                }
                CloseClipboard();
            }
        }

        if (bPassThrough)
        {
            return CallWindowProc(oldEditCtlProc,hwnd, message, wParam, lParam);
        } else {
            MessageBeep(MB_OK);
            return FALSE;
        }
    }
    break;


    case WM_IME_COMPOSITION:
        if( ImmIsIME(hkl ) &&
                LOWORD(hkl ) == MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT))
        {
            HIMC himc = ImmGetContext(hwnd);
            if (himc)
            {
                TCHAR szTempStr[4];
                if (0<ImmGetCompositionString(himc,GCS_COMPSTR, szTempStr, 4))
                {
                    DWORD fdwConversion;
                    DWORD fdwSentence;

                    ImmNotifyIME(himc,NI_COMPOSITIONSTR,CPS_CANCEL,0);
                    ImmGetConversionStatus(himc, &fdwConversion, &fdwSentence);
                    fdwConversion&=(~IME_CMODE_NATIVE);
                    ImmSetConversionStatus(himc,fdwConversion, fdwSentence);
                }
                ImmReleaseContext(hwnd,himc);
                return CallWindowProc(oldEditCtlProc,hwnd, message, wParam, lParam);
            }
        }
        break;

    case WM_CHAR:
#ifdef FAREAST // Convert full-width numbers to half width
        ch = (TCHAR)wParam;
        LCMapString(LOCALE_USER_DEFAULT, LCMAP_HALFWIDTH,
                    &ch, 1, &chHW, 1);
        wParam = (WPARAM)chHW;
#endif // FAREAST
        // This character is not ASCII. If your country/region needs specific characters. You
        // have to change this. Otherwise, we abandon this character.
        if (wParam >= 0x80 )  {  // service on ilegal chars
            MessageBeep(MB_OK);
            return TRUE;
        }
        if (wParam < VK_SPACE || wParam > 0x7e )  {  // service on legal chars
            //DPF("None ascii char. ignore \r\n ");
            break;
        }

//.........这里部分代码省略.........
开发者ID:NemProjects,项目名称:WLAN,代码行数:101,代码来源:util.c

示例15: text_putch

int
text_putch(TW *tw, int ch)
{
int pos;
int n;
#ifndef WINDOWS_NO_UNICODE
int shift = tw->utf8shift;
    tw->utf8shift=0;
#endif
    if (tw->quitnow)
        return ch;	/* don't write error message as we shut down */
    switch(ch) {
        case '\r':
                tw->CursorPos.x = 0;
                if (tw->CursorFlag)
                    text_to_cursor(tw);
                break;
        case '\n':
                text_new_line(tw);
                break;
        case 7:
                MessageBeep(-1);
                if (tw->CursorFlag)
                    text_to_cursor(tw);
                break;
        case '\t':
                {
                    for (n = 8 - (tw->CursorPos.x % 8); n>0; n-- )
                            text_putch(tw, ' ');
                }
                break;
        case 0x08:
        case 0x7f:
                tw->CursorPos.x--;
                if (tw->CursorPos.x < 0) {
                    tw->CursorPos.x = tw->ScreenSize.x - 1;
                    tw->CursorPos.y--;
                }
                if (tw->CursorPos.y < 0)
                    tw->CursorPos.y = 0;
                break;
        default:
                pos = tw->CursorPos.y*tw->ScreenSize.x + tw->CursorPos.x;
#ifndef WINDOWS_NO_UNICODE
                /* Are we continuing a unicode char? */
                if ((ch & 0xC0) == 0x80) {
                    tw->ScreenBuffer[pos] |= (ch & 0x3F)<<shift;
                    if (shift > 0)
                        tw->utf8shift = shift-6;
                    else
                        text_update_text(tw, 1); /* Only update when complete */
                } else if (ch >= 0xe0) { /* 2 more to come */
                    tw->ScreenBuffer[pos] = (ch & 0x0f)<<12;
                    tw->utf8shift = 6;
                } else if (ch >= 0xC0) { /* 1 more to come */
                    tw->ScreenBuffer[pos] = (ch & 0x01f)<<6;
                    tw->utf8shift = 0;
                }
                else
#endif
                {
                    tw->ScreenBuffer[pos] = ch;
                    text_update_text(tw, 1);
                }
    }
    return ch;
}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:67,代码来源:dwtext.c


注:本文中的MessageBeep函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。