本文整理汇总了C++中BOOL函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOL函数的具体用法?C++ BOOL怎么用?C++ BOOL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BOOL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SJ_ToggleFullScreen
//-----------------------------------------------------------------------------
// Changes presentation parameters for windowed or fullscreen
//-----------------------------------------------------------------------------
void SJ_ToggleFullScreen( )
{
g_fullScreen = ! g_fullScreen;
ZeroMemory( &g_d3dpp, sizeof( g_d3dpp ) );
g_d3dpp.Windowed = !g_fullScreen;
g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
g_d3dpp.EnableAutoDepthStencil = TRUE;
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
GetClientRect( g_hWnd, &g_clRect );
if ( g_fullScreen )
{
g_d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
g_d3dpp.FullScreen_RefreshRateInHz = 0;
g_d3dpp.BackBufferWidth = SCREEN_WIDTH;
g_d3dpp.BackBufferHeight = SCREEN_HEIGHT;
g_clRect.right = SCREEN_WIDTH;
g_clRect.bottom = SCREEN_HEIGHT;
SetCursor( NULL );
}
ShowCursor( BOOL(!g_fullScreen) );
if ( g_pd3dDevice != NULL )
g_pd3dDevice->ShowCursor( BOOL(!g_fullScreen) );
}
示例2: ApplyAER
BOOL vmsTpDownloadMgr::CheckDstFileExists()
{
if (DWORD (-1) != GetFileAttributes (m_info.strOutputPath + m_info.strFileName))
{
fsAlreadyExistReaction enAER = m_enAER;
BOOL bRet = ApplyAER (enAER);
if (bRet == FALSE)
{
RaiseEvent (DE_EXTERROR, DMEE_FATALERROR);
return FALSE;
}
else if (bRet == BOOL (-1))
return FALSE;
else if (bRet == BOOL (2))
SetToRestartState ();
RaiseEvent (LS (L_OPENINGFILE));
m_dldr->InitTpStream(m_info.strTorrentUrl, m_info.strOutputPath + m_info.strFileName, GetStreamingSpeed ());
RaiseEvent (LS (L_SUCCESS), EDT_RESPONSE_S);
}
return TRUE;
}
示例3: icon_list_new
static GtkWidget *
icon_list_new (GladeXML *xml, GType widget_type,
GladeWidgetInfo *info)
{
GtkWidget *gil;
int flags = 0;
int icon_width = 0;
int i;
for (i = 0; i < info->n_properties; i++) {
const char *name = info->properties[i].name;
const char *value = info->properties[i].value;
if (!strcmp (name, "text_editable")) {
if (BOOL (value))
flags |= MATE_ICON_LIST_IS_EDITABLE;
} else if (!strcmp (name, "text_static")) {
if (BOOL (value))
flags |= MATE_ICON_LIST_STATIC_TEXT;
} else if (!strcmp (name, "icon_width")) {
icon_width = INT (value);
}
}
gil = glade_standard_build_widget (xml, widget_type, info);
mate_icon_list_construct (MATE_ICON_LIST (gil),
icon_width, NULL, flags);
return gil;
}
示例4: s_TEST_WinSystemDll
static void s_TEST_WinSystemDll(void)
{
#if defined NCBI_OS_MSWIN
CDll dll_user32("USER32", CDll::eLoadLater);
CDll dll_userenv("userenv.dll", CDll::eLoadNow, CDll::eAutoUnload);
// Load DLL
dll_user32.Load();
// DLL functions definition
BOOL (STDMETHODCALLTYPE FAR * dllMessageBeep)
(UINT type) = NULL;
BOOL (STDMETHODCALLTYPE FAR * dllGetProfilesDirectory)
(LPTSTR lpProfilesDir, LPDWORD lpcchSize) = NULL;
// This is other variant of functions definition
//
// typedef BOOL (STDMETHODCALLTYPE FAR * LPFNMESSAGEBEEP) (
// UINT uType
// );
// LPFNMESSAGEBEEP dllMessageBeep = NULL;
//
// typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETPROFILESDIR) (
// LPTSTR lpProfilesDir,
// LPDWORD lpcchSize
// );
// LPFNGETUSERPROFILESDIR dllGetProfilesDirectory = NULL;
dllMessageBeep = dll_user32.GetEntryPoint_Func("MessageBeep", &dllMessageBeep );
if ( !dllMessageBeep ) {
ERR_FATAL("Error get address of function MessageBeep().");
}
// Call loaded function
dllMessageBeep(-1);
#ifdef UNICODE
dll_userenv.GetEntryPoint_Func("GetProfilesDirectoryW", &dllGetProfilesDirectory);
#else
dll_userenv.GetEntryPoint_Func("GetProfilesDirectoryA", &dllGetProfilesDirectory);
#endif
if ( !dllGetProfilesDirectory ) {
ERR_FATAL("Error get address of function GetUserProfileDirectory().");
}
// Call loaded function
TCHAR szProfilePath[1024];
DWORD cchPath = 1024;
if ( dllGetProfilesDirectory(szProfilePath, &cchPath) ) {
cout << "Profile dir: " << szProfilePath << endl;
} else {
ERR_FATAL("GetProfilesDirectory() failed");
}
// Unload USER32.DLL (our work copy)
dll_user32.Unload();
// USERENV.DLL will be unloaded in the destructor
// dll_userenv.Unload();
#endif
}
示例5: test_cryptTls
static void test_cryptTls(void)
{
DWORD (WINAPI *pI_CryptAllocTls)(void);
LPVOID (WINAPI *pI_CryptDetachTls)(DWORD dwTlsIndex);
LPVOID (WINAPI *pI_CryptGetTls)(DWORD dwTlsIndex);
BOOL (WINAPI *pI_CryptSetTls)(DWORD dwTlsIndex, LPVOID lpTlsValue);
BOOL (WINAPI *pI_CryptFreeTls)(DWORD dwTlsIndex, DWORD unknown);
DWORD index;
BOOL ret;
pI_CryptAllocTls = (void *)GetProcAddress(hCrypt, "I_CryptAllocTls");
pI_CryptDetachTls = (void *)GetProcAddress(hCrypt, "I_CryptDetachTls");
pI_CryptGetTls = (void *)GetProcAddress(hCrypt, "I_CryptGetTls");
pI_CryptSetTls = (void *)GetProcAddress(hCrypt, "I_CryptSetTls");
pI_CryptFreeTls = (void *)GetProcAddress(hCrypt, "I_CryptFreeTls");
/* One normal pass */
index = pI_CryptAllocTls();
ok(index, "I_CryptAllocTls failed: %08x\n", GetLastError());
if (index)
{
LPVOID ptr;
ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n");
ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef);
ok(ret, "I_CryptSetTls failed: %08x\n", GetLastError());
ptr = pI_CryptGetTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
/* This crashes
ret = pI_CryptFreeTls(index, 1);
*/
ret = pI_CryptFreeTls(index, 0);
ok(ret, "I_CryptFreeTls failed: %08x\n", GetLastError());
ret = pI_CryptFreeTls(index, 0);
ok(!ret, "I_CryptFreeTls succeeded\n");
ok(GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
}
/* Similar pass, check I_CryptDetachTls */
index = pI_CryptAllocTls();
ok(index, "I_CryptAllocTls failed: %08x\n", GetLastError());
if (index)
{
LPVOID ptr;
ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n");
ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef);
ok(ret, "I_CryptSetTls failed: %08x\n", GetLastError());
ptr = pI_CryptGetTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
ptr = pI_CryptDetachTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n");
}
}
示例6: sdl_getMouseState
static VALUE sdl_getMouseState(VALUE mod)
{
int x,y;
Uint8 result;
result=SDL_GetMouseState(&x,&y);
return rb_ary_new3(5,INT2FIX(x),INT2FIX(y),BOOL(result&SDL_BUTTON_LMASK),
BOOL(result&SDL_BUTTON_MMASK),
BOOL(result&SDL_BUTTON_RMASK));
}
示例7: ValidateRDesc
void dx10StateManager::SetMultisample(u32 Enable)
{
ValidateRDesc();
if (m_RDesc.MultisampleEnable!=BOOL(Enable))
{
m_bRSChanged = true;
m_RDesc.MultisampleEnable=BOOL(Enable);
}
}
示例8: setInfoToSMPEGInfo
static void setInfoToSMPEGInfo(VALUE obj,SMPEG_Info info)
{
rb_iv_set(obj,"@has_audio",BOOL(info.has_audio));
rb_iv_set(obj,"@has_video",BOOL(info.has_video));
rb_iv_set(obj,"@width",INT2NUM(info.width));
rb_iv_set(obj,"@height",INT2NUM(info.height));
rb_iv_set(obj,"@current_frame",INT2NUM(info.current_frame));
rb_iv_set(obj,"@current_fps",INT2NUM(info.current_fps));
rb_iv_set(obj,"@audio_string",rb_str_new2(info.audio_string));
rb_iv_set(obj,"@audio_current_frame",INT2NUM(info.audio_current_frame));
rb_iv_set(obj,"@current_offset",UINT2NUM(info.current_offset));
rb_iv_set(obj,"@total_size",UINT2NUM(info.total_size));
rb_iv_set(obj,"@current_time",UINT2NUM(info.current_time));
rb_iv_set(obj,"@total_time",UINT2NUM(info.total_time));
}
示例9: _T
bool CI8DeskSvr::StartRemoteControl()
{
stdex::tString strFilePath = utility::GetAppPath() + _T("WinVNC\\");
SetDllDirectory(strFilePath.c_str());
strFilePath += TEXT("WinVNC.dll");
m_hRemoteCtrl = LoadLibrary(strFilePath.c_str());
if (m_hRemoteCtrl == NULL)
return false;
typedef BOOL (WINAPI* PFNSTARTVNC)();
PFNSTARTVNC pfnStartVNC = GetProcAddress(m_hRemoteCtrl, "[email protected]");
if (pfnStartVNC == NULL)
return false;
try
{
pfnStartVNC();
}
catch(...)
{
m_pLogger->WriteLog(LM_INFO, TEXT("加载远程控制客户端失败。\r\n"));
BOOL (WINAPI* pfnStopVNC)();
pfnStopVNC = GetProcAddress(m_hRemoteCtrl, "[email protected]");
if (pfnStopVNC == NULL)
return false;
pfnStopVNC();
}
m_pLogger->WriteLog(LM_INFO, TEXT("加载远程控制客户端成功。\r\n"));
return true;
}
示例10: fclose
S32 LLXfer_File::startDownload()
{
S32 retval = 0; // presume success
mFp = LLFile::fopen(mTempFilename,"w+b"); /* Flawfinder : ignore */
if (mFp)
{
fclose(mFp);
mFp = NULL;
gMessageSystem->newMessageFast(_PREHASH_RequestXfer);
gMessageSystem->nextBlockFast(_PREHASH_XferID);
gMessageSystem->addU64Fast(_PREHASH_ID, mID);
gMessageSystem->addStringFast(_PREHASH_Filename, mRemoteFilename);
gMessageSystem->addU8("FilePath", (U8) mRemotePath);
gMessageSystem->addBOOL("DeleteOnCompletion", mDeleteRemoteOnCompletion);
gMessageSystem->addBOOL("UseBigPackets", BOOL(mChunkSize == LL_XFER_LARGE_PAYLOAD));
gMessageSystem->addUUIDFast(_PREHASH_VFileID, LLUUID::null);
gMessageSystem->addS16Fast(_PREHASH_VFileType, -1);
gMessageSystem->sendReliable(mRemoteHost);
mStatus = e_LL_XFER_IN_PROGRESS;
}
else
{
LL_WARNS() << "Couldn't create file to be received!" << LL_ENDL;
retval = -1;
}
return (retval);
}
示例11: dpb
// static
void LLKeyTool::onTransferInfo(LLMessageSystem *msg, void **user_data)
{
S32 params_size = msg->getSize(_PREHASH_TransferInfo, _PREHASH_Params);
if(params_size < 1) return;
U8 tmp[1024];
msg->getBinaryDataFast(_PREHASH_TransferInfo, _PREHASH_Params, tmp, params_size);
LLDataPackerBinaryBuffer dpb(tmp, 1024);
LLUUID asset_id;
dpb.unpackUUID(asset_id, "AssetID");
S32 asset_type;
dpb.unpackS32(asset_type, "AssetType");
S32 status;
msg->getS32Fast(_PREHASH_TransferInfo, _PREHASH_Status, status, 0);
BOOL wanted = callback(asset_id, KT_ASSET, (LLAssetType::EType)asset_type, BOOL(status == 0)); // LLTS_OK (e_status_codes)
if(wanted)
{
LLKeyTool::sTransferRequests--;
if(LLKeyTool::sTransferRequests <= 0)
{
LLKeyTool::sTransferRequests = 0;
gMessageSystem->delHandlerFuncFast(_PREHASH_TransferInfo, &onTransferInfo);
}
}
}
示例12: SetAlpha
SetAlpha(LONG nTrans) {
HMODULE hDllUser32 = LoadLibrary("user32");
if (hDllUser32) {
BOOL (WINAPI *pfnSetLayeredWindowAttributes)(HWND,DWORD,BYTE,DWORD);
pfnSetLayeredWindowAttributes
= (BOOL (WINAPI *)(HWND,DWORD,BYTE,DWORD))
GetProcAddress(hDllUser32, "SetLayeredWindowAttributes");
if (pfnSetLayeredWindowAttributes) {
HWND hTop = GetVimWindow();
if (hTop) {
if (nTrans == 255) {
SetWindowLong(hTop, GWL_EXSTYLE,
GetWindowLong(hTop, GWL_EXSTYLE) & ~WS_EX_LAYERED);
} else {
SetWindowLong(hTop, GWL_EXSTYLE,
GetWindowLong(hTop, GWL_EXSTYLE) | WS_EX_LAYERED);
pfnSetLayeredWindowAttributes(hTop, 0, (BYTE)nTrans, LWA_ALPHA);
}
}
}
FreeLibrary(hDllUser32);
}
return GetLastError();
}
示例13: BOOL
CAygshellHelper::CAygshellHelper( void )
{
if( m_hAygshellDLL = LoadLibrary( L"aygshell.dll" ) )
{
BOOL (*SHInitExtraControls)() = NULL;
SHInitExtraControls = (BOOL (*)())GetProcAddress( m_hAygshellDLL, L"SHInitExtraControls" );
SHInitDialog = (LPSHINITDIALOG)GetProcAddress( m_hAygshellDLL, L"SHInitDialog" );
SHInputDialog = (LPSHINPUTDIALOG)GetProcAddress( m_hAygshellDLL, L"SHInputDialog" );
SHSipInfo = (LPSHSIPINFO)GetProcAddress( m_hAygshellDLL, L"SHSipInfo" );
// SHHandleWMSettingChange isn't exported by name, so reference its ordinal.
// OEMs shouldn't have to do this since they won't conditionally include aygshell.
SHHandleWMSettingChange = (LPSHHANDLEWMSETTINGCHANGE)GetProcAddress( m_hAygshellDLL, (LPWSTR)MAKELONG(83, 0) );
if( !(SHInitDialog && SHInputDialog
&& SHInitExtraControls && SHSipInfo
&& SHHandleWMSettingChange) )
{
FreeLibrary( m_hAygshellDLL );
m_hAygshellDLL = NULL;
}
else
{
SHInitExtraControls();
}
}
}
示例14: list_tasks_worker
int
list_tasks_worker(worker_t * worker, GError ** error)
{
struct bulk_s {
char id[MAX_TASKID_LENGTH];
gint64 period;
guint8 busy;
// used to compute the length of the structure without padding, with
// the help of offsetof().
gchar last[];
} bulk;
GHashTableIter iter;
gpointer k, v;
GByteArray *gba = g_byte_array_new();
g_hash_table_iter_init(&iter, tasks);
while (g_hash_table_iter_next(&iter, &k, &v)) {
task_t *t;
if (!(t = v))
continue;
memset(&bulk, 0, sizeof(bulk));
g_strlcpy(bulk.id, t->id, sizeof(bulk.id));
bulk.period = t->period;
bulk.busy = BOOL(t->busy);
g_byte_array_append(gba, (guint8*)&bulk, offsetof(struct bulk_s, last));
}
return __respond(worker, 1, gba, error);
}
示例15: AssertFatal
void
GWControlProxy::setEnable(const bool in_enable) const
{
AssertFatal(m_attached == true, "Error, not attached...");
EnableWindow(m_ctrlHWnd, BOOL(in_enable));
}