LRESULT CDdjdemoCtrl::OnOcmCommand(WPARAM wParam, LPARAM lParam)
{
#ifdef _WIN32
	WORD wNotifyCode = HIWORD(wParam);
#else
	WORD wNotifyCode = HIWORD(lParam);
#endif
	
	// This is where the listbox notifications are received. The only
	// one we're interested in is LBN_SELCHANGE. When the selection is
	// changed, we reuse the code for GetCurrentName and GetCurrentNumber
	// to retrieve the correct strings for name and phone number, then
	// call the FireNameNumberChanged event that ClassWizard created.
	switch(wNotifyCode)
	{
	case LBN_SELCHANGE:
		FireNameNumberChanged(GetCurrentName(), GetCurrentNumber());
		break;
	}

	return 0;
}
示例#2
0
int IoOldOoglLexer::ExpectNum(int count, float *array, IoOldOoglToken::NumberType type)
{
        int n = 0, m = 0;  // To keep track of the number of numbers read.
        int *iarray;
        short *sarray;

// This is a bit of a hack to get the incrementing to work in VC++.  I'm 
// not sure why, but VC++ doesn't seem to interpret (int *)array as an 
// l-value and therefore cannot increment it.  There may be something else
// wierd here that is causing this error, but I don't see it at the moment.
// jcm - 10/16/97

        if (count <= 0) return n;

  // First check for lookahead.
        if (mpNext != NULL)
        {
                SwapForward();

                if (GetCurrentType() != IoOldOoglToken::NUMBER) return 0;

                if (type == IoOldOoglToken::INTEGER)
                {
                        int num = (int) GetCurrentNumber();
                        *((int *)array) = num;
                        iarray = (int *)array;
                        iarray++;
                        array = (float *)iarray;
                }
                else if (type == IoOldOoglToken::SHORT)
                {
                        short num = (short) GetCurrentNumber();
                        *((short *)array) = num;
                        sarray = (short *)array;
                        sarray++;
                        array = (float *)iarray;
                }
                else
                {
                        *array = GetCurrentNumber();
                        array++;
                }

                count--; n++;
                if (count <= 0) return n;
        }

        if (type == IoOldOoglToken::INTEGER)
                m = mpStream->fgetni(count, (int   *)array, mDataType);
        else if (type == IoOldOoglToken::SHORT)
                m = mpStream->fgetns(count, (short *)array, mDataType);
        else
                m = mpStream->fgetnf(count, (float *)array, mDataType);

        if (m == 1)
                SwapForward();
        if (m >= 1)
        {
                mpCurrent->mType = IoOldOoglToken::NUMBER;
                mpCurrent->mFValue = array[m-1];
                // mpCurrent->mpCValue = NULL;      <----- What about strings?
                if (m >= 2)
                {
                        mpPrev->mType = IoOldOoglToken::NUMBER;
                        mpPrev->mFValue = array[m-2];
                        // mpPrev->mpCValue = NULL;      <----- What about strings?
                }
        }
        return n+m;
}