예제 #1
0
 template < typename _T_REG_UNION > __forceinline void writeRegisterNoFence (
     _T_REG_UNION RegUnion
     ) const throw ()
 {
     C_ASSERT(sizeof(UINT32) == sizeof(ULONG));
     ULONG* const regPtr = reinterpret_cast<ULONG*>(
         ULONG_PTR(this->basePtr) + ULONG(RegUnion.OFFSET));
     ::WRITE_REGISTER_NOFENCE_ULONG(regPtr, RegUnion.AsUint32);
 } // writeRegisterNoFence<...> ( _T_REG_UNION )
/// SimpleDPX::ReadData
// Read a single pixel from the specified file.
UQUAD SimpleDPX::ReadData(FILE *in,const struct ImageElement *el,bool issigned)
{
  // The specs seem to indicate that data is always packed into 32-bit LONGs,
  // no matter what. Interestingly, not all software seems to follow this,
  // but for this time, accept only correctly formulated data.
  switch(el->m_ucBitDepth) {
  case 32:
    return GetLong(in);
  case 64:
    {
      UQUAD q1,q2;
      q1 = GetLong(in);
      q2 = GetLong(in);
      if (m_bLittleEndian) {
	return q1 | (q1 << 32);
      } else {
	return q2 | (q1 << 32);
      }
    }
  default:
    if (el->m_ucBitDepth < 32) {
      ULONG res   = 0;
      UBYTE sign  = el->m_ucBitDepth;
      UBYTE bits  = el->m_ucBitDepth;
      UBYTE shift = 0;
      
      do {
	// Refill the buffer if only the padding bits are left, or no bits are left.
	if (m_cBit <= el->m_ucMSBPaddingBits) {
	  // Fill up the bit-buffer.
	  m_ulBitBuffer = GetLong(in);
	  m_cBit        = 32;
	  //
	  // If LSB padding is on, remove now the LSB bits.
	  m_cBit       -= el->m_ucLSBPaddingBits;
	}
	UBYTE avail = m_cBit;
	if (avail > bits)
	  avail = bits; // do not remove more bits than requested.
	
	// remove avail bits from the byte
	res     |= ((m_ulBitBuffer >> (32 - m_cBit)) & ((1UL << avail) - 1)) << shift;
	bits    -= avail;
	shift   += avail;
	m_cBit  -= avail;
      } while(bits);

      if (el->m_ucPackElements == 1)
	m_cBit -= el->m_ucLSBPaddingBits + el->m_ucMSBPaddingBits;
      
      if (issigned) {
	if (res & (1 << (sign - 1))) { // result is negative
	  res |= ULONG(-1) << sign;
	}
      }
      return res;
    } else {
예제 #3
0
 template < typename _T_REG_UNION > __forceinline void readRegisterNoFence (
     _Out_ _T_REG_UNION* RegUnionPtr
     ) const throw ()
 {
     C_ASSERT(sizeof(UINT32) == sizeof(ULONG));
     ULONG* const regPtr = reinterpret_cast<ULONG*>(
         ULONG_PTR(this->basePtr) + ULONG(RegUnionPtr->OFFSET));
     RegUnionPtr->AsUint32 = ::READ_REGISTER_NOFENCE_ULONG(regPtr);
  } // readRegisterNoFence<...> ( _T_REG_UNION* )
예제 #4
0
파일: ISO.cpp 프로젝트: hnordquist/MIC
void CISO::PostToWatch(char *pMessage)
{
	if ((NULL != pMessage) && (NULL != m_pComm))
	{
		BSTR bstr_out;
		Convert_Character_String_to_BSTR(pMessage, bstr_out);
		m_pComm->SendToWatch(bstr_out, ULONG(m_iNode));
	}
}
예제 #5
0
void
DoMAPISendDocuments(HWND hWnd)
{
  ULONG (FAR PASCAL *lpfnMAPISendDocuments) (ULONG ulUIParam, 
          LPTSTR lpszDelimChar, LPTSTR lpszFullPaths, 
          LPTSTR lpszFileNames, ULONG ulReserved);

#ifdef WIN16		
  (FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISENDDOCUMENTS"); 
#else
  (FARPROC&) lpfnMAPISendDocuments = GetProcAddress(m_hInstMapi, "MAPISendDocuments"); 
#endif
  
  if (!lpfnMAPISendDocuments)
  {
    ShowMessage(hWnd, "Unable to locate MAPI function.");
    return;
  }

  char  msg[1024];
  char  tempFileName[_MAX_PATH] = "";
  char  lpszFullPaths[(_MAX_PATH + 1) * 4] = "";
  char  lpszFileNames[(_MAX_PATH + 1) * 4] = "";

  // Now get the names of the files to attach...
  GetDlgItemText(hWnd, ID_EDIT_ATTACH1, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  GetDlgItemText(hWnd, ID_EDIT_ATTACH2, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  GetDlgItemText(hWnd, ID_EDIT_ATTACH3, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  GetDlgItemText(hWnd, ID_EDIT_ATTACH4, tempFileName, sizeof(tempFileName));
  TackItOn(lpszFullPaths, lpszFileNames, tempFileName); 

  LONG  rc = (*lpfnMAPISendDocuments)
        ( (ULONG) hWnd,        
          lpszDelimChar, 
          lpszFullPaths, 
          lpszFileNames, 
          0);

  if (rc == SUCCESS_SUCCESS)
  {
    ShowMessage(hWnd, "Success with MAPISendDocuments");
    SetFooter("MAPISendDocuments success");
  }
  else
  {
    wsprintf(msg, "FAILURE: Return code %d from MAPISendDocuments\nError=[%s]", 
                      rc, GetMAPIError(rc));
    ShowMessage(hWnd, msg);
    SetFooter("MAPISendDocuments failed");
  }
}
예제 #6
0
void print_alloc_info(char *addr, int size){
  if(addr){
    fprintf(stderr, "ALLOC at : %lu (%d byte(s))\n", 
	    ULONG(addr - memory), size);
  }
  else{
    fprintf(stderr, "Warning, system is out of memory\n"); 
  }
}
예제 #7
0
/// Environ::AllocVec without reqments
void *Environ::AllocVec(size_t bytesize)
{
  size_t *mem;
  // This is build directly on AllocMem
  bytesize += sizeof(union Align);
  mem       = (size_t *)CoreAllocMem(ULONG(bytesize),0);
  *mem      = bytesize; // enter the bytesize
  return (void *)(ptrdiff_t(mem) + sizeof(union Align)); 
}
예제 #8
0
DFireFlicker::DFireFlicker (sector_t *sector)
	: DLighting (sector)
{
	m_MaxLight = sector->lightlevel;
	m_MinLight = sector_t::ClampLight(sector->FindMinSurroundingLight(sector->lightlevel) + 16);
	m_Count = 4;

	// [BC] If we're the server, tell clients to create the fire flicker.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightFireFlicker( ULONG( sector - sectors ), m_MaxLight, m_MinLight );
}
예제 #9
0
DFireFlicker::DFireFlicker (sector_t *sector, int upper, int lower)
	: DLighting (sector)
{
	m_MaxLight = sector_t::ClampLight(upper);
	m_MinLight = sector_t::ClampLight(lower);
	m_Count = 4;

	// [BC] If we're the server, tell clients to create the fire flicker.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightFireFlicker( ULONG( sector - sectors ), m_MaxLight, m_MinLight );
}
예제 #10
0
DGlow::DGlow (sector_t *sector)
	: DLighting (sector)
{
	m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
	m_MaxLight = sector->lightlevel;
	m_Direction = -1;

	// [BC] If we're the server, tell clients to create the glow light.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightGlow( ULONG( sector - sectors ));
}
예제 #11
0
DPhased::DPhased (sector_t *sector, int baselevel, int phase)
	: DLighting (sector)
{
	m_BaseLevel = baselevel;
	m_Phase = phase;
	sector->special &= 0xff00;

	// [BC] If we're the server, tell clients to create the phased light.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightPhased( ULONG( sector - sectors ), m_BaseLevel, m_Phase );
}
예제 #12
0
// Update the data to be exposed as the windows performance counter values.
void update_windows_counters(boost::uint64_t value)
{
    // Set raw counter data for queue length.
    ULONG status = PerfSetULongCounterValue
        (HPXHeartBeat, queue_counter, 1, ULONG(value));
    if (status != ERROR_SUCCESS) {
        std::cerr << "PerfSetCounterRefValue for 'sum_queue_counter' failed "
                     "with error code: "
                  << std::to_string(GetLastError());
        return;
    }

    // Set raw counter data for average queue length.
    status = PerfSetULongCounterValue(HPXHeartBeat, avg_queue_counter, 2, ULONG(value));
    if (status != ERROR_SUCCESS) {
        std::cerr << "PerfSetCounterRefValue for 'avg_queue_counter' failed "
                     "with error code: "
                  << std::to_string(GetLastError());
        return;
    }
}
예제 #13
0
DFlicker::DFlicker (sector_t *sector, int upper, int lower)
	: DLighting (sector)
{
	m_MaxLight = upper;
	m_MinLight = lower;
	sector->lightlevel = upper;
	m_Count = (pr_flicker()&64)+1;

	// [BC] If we're the server, tell clients to create the flicker.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightFlicker( ULONG( sector - sectors ), m_MaxLight, m_MinLight );
}
예제 #14
0
bool SetAvermediaEncoderConfig(IBaseFilter *encoder, VideoEncoderConfig &config)
{
	HRESULT hr;

	ComQIPtr<IKsPropertySet> propertySet(encoder);
	if (!propertySet) {
		Warning(L"Could not get IKsPropertySet for encoder");
		return false;
	}

	double fps = double(config.fpsNumerator) /
		double(config.fpsDenominator);

	hr = SetAVMEncoderSetting(propertySet,
			AVER_PARAMETER_ENCODE_FRAME_RATE,
			ULONG(fps), 0);
	if (FAILED(hr)) {
		WarningHR(L"Failed to set Avermedia encoder FPS", hr);
		return false;
	}

	hr = SetAVMEncoderSetting(propertySet,
			AVER_PARAMETER_ENCODE_BIT_RATE,
			ULONG(config.bitrate), 0);
	if (FAILED(hr)) {
		WarningHR(L"Failed to set Avermedia encoder bitrate", hr);
		return false;
	}

	hr = SetAVMEncoderSetting(propertySet,
			AVER_PARAMETER_CURRENT_RESOLUTION,
			ULONG(config.cx), ULONG(config.cy));
	if (FAILED(hr)) {
		WarningHR(L"Failed to set Avermedia encoder current res", hr);
		return false;
	}

	hr = SetAVMEncoderSetting(propertySet,
			AVER_PARAMETER_ENCODE_RESOLUTION,
			ULONG(config.cx), ULONG(config.cy));
	if (FAILED(hr)) {
		WarningHR(L"Failed to set Avermedia encoder res", hr);
		return false;
	}

	hr = SetAVMEncoderSetting(propertySet,
			AVER_PARAMETER_ENCODE_GOP,
			ULONG(config.keyframeInterval), 0);
	if (FAILED(hr)) {
		WarningHR(L"Failed to set Avermedia encoder GOP", hr);
		return false;
	}

	return true;
}
예제 #15
0
DGlow2::DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot)
	: DLighting (sector)
{
	m_Start = sector_t::ClampLight(start);
	m_End = sector_t::ClampLight(end);
	m_MaxTics = tics;
	m_Tics = -1;
	m_OneShot = oneshot;

	// [BC] If we're the server, tell clients to create the glow light.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightGlow2( ULONG( sector - sectors ), m_Start, m_End, m_Tics, m_MaxTics, m_OneShot );
}
예제 #16
0
/*****************************************************************************
 * CUnknown::NonDelegatingRelease()
 *****************************************************************************
 * Release a reference to the object without delegating to the outer unknown.
 */
STDMETHODIMP_(ULONG) CUnknown::NonDelegatingRelease(void)
{
    ASSERT(m_lRefCount > 0);

    if (InterlockedDecrement(&m_lRefCount) == 0)
	{
        m_lRefCount++;
        delete this;
        return 0;
	}

    return ULONG(m_lRefCount); 
}
예제 #17
0
DStrobe::DStrobe (sector_t *sector, int upper, int lower, int utics, int ltics)
	: DLighting (sector)
{
	m_DarkTime = ltics;
	m_BrightTime = utics;
	m_MaxLight = sector_t::ClampLight(upper);
	m_MinLight = sector_t::ClampLight(lower);
	m_Count = 1;	// Hexen-style is always in sync

	// [BC] If we're the server, tell clients to create the strobe light.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightStrobe( ULONG( sector - sectors ), m_DarkTime, m_BrightTime, m_MaxLight, m_MinLight, m_Count );
}
예제 #18
0
DEFINE_ACTION_FUNCTION(AActor, A_CFlameAttack)
{
	player_t *player;

	if (NULL == (player = self->player))
	{
		return;
	}
	AWeapon *weapon = self->player->ReadyWeapon;
	if (weapon != NULL)
	{
		if (!weapon->DepleteAmmo (weapon->bAltFire))
			return;
	}

	// [BC] Weapons are handled by the server.
	if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) ||
		( CLIENTDEMO_IsPlaying( )))
	{
		S_Sound (self, CHAN_WEAPON, "ClericFlameFire", 1, ATTN_NORM);
		return;
	}

	P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACFlameMissile));
	
	// [BC] Apply spread.
	if ( player->cheats & CF_SPREAD )
	{
		P_SpawnPlayerMissile( self, RUNTIME_CLASS(ACFlameMissile), self->angle + ( ANGLE_45 / 3 ));
		P_SpawnPlayerMissile( self, RUNTIME_CLASS(ACFlameMissile), self->angle - ( ANGLE_45 / 3 ));
	}

	S_Sound (self, CHAN_WEAPON, "ClericFlameFire", 1, ATTN_NORM);

	// [BC] If we're the server, tell other clients to make the sound.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_WeaponSound( ULONG( player - players ), "ClericFlameFire", ULONG( player - players ), SVCF_SKIPTHISCLIENT );
}
예제 #19
0
DLightFlash::DLightFlash (sector_t *sector, int min, int max)
	: DLighting (sector)
{
	// Use specified light levels.
	m_MaxLight = sector_t::ClampLight(max);
	m_MinLight = sector_t::ClampLight(min);
	m_MaxTime = 64;
	m_MinTime = 7;
	m_Count = (pr_lightflash() & m_MaxTime) + 1;

	// [BC] If we're the server, tell clients to create the light flash.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightLightFlash( ULONG( sector - sectors ), m_MaxLight, m_MinLight );
}
예제 #20
0
DLightFlash::DLightFlash (sector_t *sector)
	: DLighting (sector)
{
	// Find light levels like Doom.
	m_MaxLight = sector->lightlevel;
	m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
	m_MaxTime = 64;
	m_MinTime = 7;
	m_Count = (pr_lightflash() & m_MaxTime) + 1;

	// [BC] If we're the server, tell clients to create the light flash.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightLightFlash( ULONG( sector - sectors ), m_MaxLight, m_MinLight );
}
예제 #21
0
파일: dbgoth.cpp 프로젝트: VWarlock/pentevo
void __cdecl BankNames(int i, char *Name)
{
    unsigned rom_bank;
    unsigned ram_bank;

    bool IsRam = (RAM_BASE_M <= bankr[i]) && (bankr[i] < RAM_BASE_M + PAGE * MAX_RAM_PAGES);
    bool IsRom = (ROM_BASE_M <= bankr[i]) && (bankr[i] < ROM_BASE_M + PAGE * MAX_ROM_PAGES);

    if(IsRam)
        ram_bank = ULONG((bankr[i] - RAM_BASE_M)/PAGE);

    if(IsRom)
        rom_bank = ULONG((bankr[i] - ROM_BASE_M)/PAGE);

    if (IsRam)
        sprintf(Name, "RAM%2X", ram_bank);

    if (IsRom)
        sprintf(Name, "ROM%2X", rom_bank);

    if (bankr[i] == base_sos_rom)
        strcpy(Name, "BASIC");
    if (bankr[i] == base_dos_rom)
        strcpy(Name, "TRDOS");
    if (bankr[i] == base_128_rom)
        strcpy(Name, "B128K");
    if (bankr[i] == base_sys_rom && (conf.mem_model == MM_PROFSCORP || conf.mem_model == MM_SCORP))
        strcpy(Name, "SVM  ");
    if ((conf.mem_model == MM_PROFSCORP || conf.mem_model == MM_SCORP) && IsRom && rom_bank > 3)
        sprintf(Name, "ROM%2X", rom_bank);

    if (bankr[i] == CACHE_M)
        strcpy(Name, (conf.cache!=32)?"CACHE":"CACH0");
    if (bankr[i] == CACHE_M+PAGE)
        strcpy(Name, "CACH1");
}
예제 #22
0
StackVector GetNativeStack()
{
	StackVector stackVector;
	stackVector.resize(256);
	ULONG filled;
	HRESULT status = E_FAIL;

	if ((status = g_Ext->m_Control5->GetStackTraceEx(0, 0, 0, &stackVector[0], ULONG(stackVector.size()), OUT &filled)) != S_OK)
	{
		g_Ext->ThrowRemote(status, "Unable to get callstack.");
	}
	stackVector.resize(filled);
	return stackVector;

}
예제 #23
0
void EV_StopLightEffect (int tag)
{
	TThinkerIterator<DLighting> iterator;
	DLighting *effect;

	while ((effect = iterator.Next()) != NULL)
	{
		if (effect->GetSector()->tag == tag)
		{
			effect->Destroy();

			// [BC] Since this sector's light level most likely changed, mark it as such so
			// that we can tell clients when they come in.
			effect->GetSector( )->bLightChange = true;

			// [BC] If we're the server, tell clients to stop this light effect.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
			{
				SERVERCOMMANDS_StopSectorLightEffect( ULONG( effect->GetSector( ) - sectors ));
				SERVERCOMMANDS_SetSectorLightLevel( ULONG( effect->GetSector( ) - sectors ));
			}
		}
	}
}
예제 #24
0
//
// EV_CeilingCrushStop
// Stop a ceiling from crushing!
// [RH] Passed a tag instead of a line and rewritten to use a list
//
bool EV_CeilingCrushStop (int tag)
{
	bool rtn = false;
	DCeiling *scan;
	TThinkerIterator<DCeiling> iterator;

	while ( (scan = iterator.Next ()) )
	{
		if (scan->m_Tag == tag && scan->m_Direction != 0)
		{
			// [BC] If we're stopping, this is probably a good time to verify all the clients
			// have the correct floor/ceiling height for this sector.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
			{
				if ( scan->m_Sector->floorOrCeiling == 0 )
					SERVERCOMMANDS_SetSectorFloorPlane( ULONG( scan->m_Sector - sectors ));
				else
					SERVERCOMMANDS_SetSectorCeilingPlane( ULONG( scan->m_Sector - sectors ));

				// Tell clients to stop the floor's sound sequence.
				SERVERCOMMANDS_StopSectorSequence( scan->m_Sector );
			}

			SN_StopSequence (scan->m_Sector);
			scan->m_OldDirection = scan->m_Direction;
			scan->m_Direction = 0;		// in-stasis;
			rtn = true;

			// [BB] Also tell the updated direction to the clients.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
				SERVERCOMMANDS_ChangeCeilingDirection( scan->GetID( ), scan->GetDirection( ));
		}
	}

	return rtn;
}
예제 #25
0
DStrobe::DStrobe (sector_t *sector, int utics, int ltics, bool inSync)
	: DLighting (sector)
{
	m_DarkTime = ltics;
	m_BrightTime = utics;

	m_MaxLight = sector->lightlevel;
	m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);

	if (m_MinLight == m_MaxLight)
		m_MinLight = 0;

	m_Count = inSync ? 1 : (pr_strobeflash() & 7) + 1;

	// [BC] If we're the server, tell clients to create the strobe light.
	if ( NETWORK_GetState( ) == NETSTATE_SERVER )
		SERVERCOMMANDS_DoSectorLightStrobe( ULONG( sector - sectors ), m_DarkTime, m_BrightTime, m_MaxLight, m_MinLight, m_Count );
}
예제 #26
0
REFERENCE_TIME CAMSchedule::Advise( const REFERENCE_TIME & rtTime )
{
    REFERENCE_TIME  rtNextTime;
    CAdvisePacket * pAdvise;

    DbgLog((LOG_TIMING, 2,
        TEXT("CAMSchedule::Advise( %lu ms )"), ULONG(rtTime / (UNITS / MILLISECONDS))));

    CAutoLock lck(&m_Serialize);

    #ifdef DEBUG
        if (DbgCheckModuleLevel(LOG_TIMING, 4)) DumpLinkedList();
    #endif

    //  Note - DON'T cache the difference, it might overflow 
    while ( rtTime >= (rtNextTime = (pAdvise=head.m_next)->m_rtEventTime) &&
            !pAdvise->IsZ() )
    {
        ASSERT(pAdvise->m_dwAdviseCookie); // If this is zero, its the head or the tail!!

        ASSERT(pAdvise->m_hNotify != INVALID_HANDLE_VALUE);

        if (pAdvise->m_bPeriodic == TRUE)
        {
            ReleaseSemaphore(pAdvise->m_hNotify,1,NULL);
            pAdvise->m_rtEventTime += pAdvise->m_rtPeriod;
            ShuntHead();
        }
        else
        {
            ASSERT( pAdvise->m_bPeriodic == FALSE );
            EXECUTE_ASSERT(SetEvent(pAdvise->m_hNotify));
            --m_dwAdviseCount;
            Delete( head.RemoveNext() );
        }

    }

    DbgLog((LOG_TIMING, 3,
            TEXT("CAMSchedule::Advise() Next time stamp: %lu ms, for advise %lu."),
            DWORD(rtNextTime / (UNITS / MILLISECONDS)), pAdvise->m_dwAdviseCookie ));

    return rtNextTime;
}
void CSettingsDlg::OnOK()
{
	CString tmp;
	m_edtMaxMem.GetWindowTextW(tmp);
	int k, i;
	i = m_cmbUnits.GetCurSel();
	switch (i)
	{
	case 0:
		{
			k = 1;
			break;
		}
	case 1:
		{
			k = 1024;
			break;
		}
	case 2:
		{
			k = 1024 * 1024;
			break;
		}
	default:
		{
			k = 1;
		}
	}
	m_MaxMem = ULONG(abs(_wtof(tmp.GetBuffer()) * k));
	m_edtNumSteps.GetWindowTextW(tmp);
	m_NumSteps = abs(_wtoi(tmp.GetBuffer()));
	m_edtTimeStep.GetWindowTextW(tmp);
	m_TimeStep = abs(_wtoi(tmp.GetBuffer()));
	m_edtWidth.GetWindowTextW(tmp);
	m_Width = abs(_wtoi(tmp.GetBuffer()));
	m_edtHeight.GetWindowTextW(tmp);
	m_Height = abs(_wtoi(tmp.GetBuffer()));
	if ( (!m_MaxMem) || (!m_NumSteps) || (!m_TimeStep) || (!m_Width) || (!m_Height) )
	{
		MessageBox(L"Invalid values!", L"Error!", MB_ICONERROR);
		return;
	}
	CDialog::OnOK();
}
예제 #28
0
HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Next(unsigned long  celt, VARIANT FAR*  rgVar, unsigned long FAR*  pCeltFetched)
{
    if (pCeltFetched)
        *pCeltFetched = 0;

    ULONG l;
    for (l = 0; l < celt; l++) {
        VariantInit(&rgVar[l]);
        if (current + 1 > ULONG(array.size())) {
            *pCeltFetched = l;
            return S_FALSE;
        }

        rgVar[l].vt = VT_I4;
        rgVar[l].lVal = array[int(current)];
        ++current;
    }
    *pCeltFetched = l;
    return S_OK;
}
예제 #29
0
HRESULT CAuxUIOwner::OnSelect (ITRiASBar *pIBar, UINT uiID, LPSTR pBuffer, ULONG ulLen, ULONG *pulWritten)
{
	if (NULL == pIBar || NULL == pBuffer || 0 == ulLen) 
		return E_POINTER;

// Select behandeln, dazu ResID oder String besorgen
UIOwnerData::iterator it = m_Data.find (uiID);

	TX_ASSERT(it != m_Data.end());

const UIOWNERPROCS *pProcs = (*it).second;

	TX_ASSERT(NULL != pProcs);
	TX_ASSERT(NULL != pProcs -> pFcnResID || NULL != pProcs -> pFcnResStr);

	try {
	ULONG ulToWrite = 0L;

		if (NULL != pProcs -> pFcnResID) {
		UINT uiResID = (this ->* pProcs -> pFcnResID)(pIBar, uiID);

			TX_ASSERT(0 != uiResID);
		
		ResString str (ResID (uiResID, &g_pTE -> RF()), 255);
			
			ulToWrite = min (ulLen-1, ULONG(str.Len()));
			strncpy (pBuffer, str, ulToWrite);
			pBuffer[ulToWrite] = '\0';
		} else {
			(this ->* pProcs -> pFcnResStr)(pIBar, uiID, pBuffer, ulLen);
			ulToWrite = strlen (pBuffer);
		}
		if (pulWritten)
			*pulWritten = ulToWrite;

	} catch (...) {
		return E_OUTOFMEMORY;
	} 

return NOERROR;
}
void CSettingsDlg::OnCbnSelchangeCmbUnits()
{
	int i;
	i = m_cmbUnits.GetCurSel();
	if (i == last_units) return; // nothing to do
	CString tmp;
	m_edtMaxMem.GetWindowTextW(tmp);
	ULONG t = ULONG(_wtof(tmp.GetBuffer()));
	int k = last_units - i;
	switch(k)
	{
	case 1:
		{
			t *= 1024;
			break;
		}
	case 2:
		{
			t *= 1024 * 1024;
			break;
		}
	case -1:
		{
			t /= 1024;
			break;
		}
	case -2:
		{
			t /= 1024 * 1024;
			break;
		}
	default:
		{
			// do nothing
		}
	}
	last_units = i;
	tmp.Format(L"%u", t);
	m_edtMaxMem.SetWindowTextW(tmp);
}