本文整理汇总了C++中LogString函数的典型用法代码示例。如果您正苦于以下问题:C++ LogString函数的具体用法?C++ LogString怎么用?C++ LogString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MyOpenClipboard
bool MyOpenClipboard(LPCWSTR asAction)
{
_ASSERTE(gnMyClipboardOpened==0 || gnMyClipboardOpened==1);
if (gnMyClipboardOpened > 0)
{
InterlockedIncrement(&gnMyClipboardOpened);
return true;
}
BOOL lbRc;
int iMaxTries = 100;
// Open Windows' clipboard
while (!(lbRc = OpenClipboard((ghWnd && IsWindow(ghWnd)) ? ghWnd : NULL)) && (iMaxTries-- > 0))
{
DWORD dwErr = GetLastError();
wchar_t szCode[32]; _wsprintf(szCode, SKIPCOUNT(szCode) L", Code=%u", dwErr);
wchar_t* pszMsg = lstrmerge(L"OpenClipboard failed (", asAction, L")", szCode);
LogString(pszMsg);
int iBtn = DisplayLastError(pszMsg, dwErr, MB_RETRYCANCEL|MB_ICONSTOP);
SafeFree(pszMsg);
if (iBtn != IDRETRY)
return false;
}
InterlockedIncrement(&gnMyClipboardOpened);
_ASSERTE(gnMyClipboardOpened==1);
LogString(L"OpenClipboard succeeded");
return true;
}
示例2: dreamSock_SendPacket
//-----------------------------------------------------------------------------
// Name: empty()
// Desc:
//-----------------------------------------------------------------------------
void dreamSock_SendPacket(SOCKET sock, int length, char *data, struct sockaddr addr)
{
int ret;
ret = sendto(sock, data, length, 0, &addr, sizeof(addr));
if(ret == -1)
{
#ifdef WIN32
errno = WSAGetLastError();
// Silently handle wouldblock
if(errno == WSAEWOULDBLOCK)
return;
LogString("Error code %d: sendto() : %s", errno, strerror(errno));
#else
// Silently handle wouldblock
if(errno == EWOULDBLOCK)
return;
LogString("Error code %d: sendto() : %s", errno, strerror(errno));
#endif
}
}
示例3: dreamSock_Socket
//-----------------------------------------------------------------------------
// Name: empty()
// Desc:
//-----------------------------------------------------------------------------
SOCKET dreamSock_Socket(int protocol)
{
int type;
int proto;
SOCKET sock;
// Check which protocol to use
if(protocol == DREAMSOCK_TCP)
{
type = SOCK_STREAM;
proto = IPPROTO_TCP;
}
else
{
type = SOCK_DGRAM;
proto = IPPROTO_UDP;
}
// Create the socket
if((sock = socket(AF_INET, type, proto)) == -1)
{
LogString("dreamSock_Socket - socket() failed");
#ifdef WIN32
errno = WSAGetLastError();
LogString("Error: socket() code %d : %s", errno, strerror(errno));
#else
LogString("Error: socket() : %s", strerror(errno));
#endif
return DREAMSOCK_INVALID_SOCKET;
}
return sock;
}
示例4: LogString
int ServerSideNetworkedGame::InitNetwork()
{
if(dreamSock_Initialize() != 0)
{
LogString("Error initialising Communication Library!");
return 1;
}
LogString("Initialising game");
// Create the game servers on new ports, starting from 30004
int ret = networkServer->Initialise("", 30004);
if(ret == DREAMSOCK_SERVER_ERROR)
{
#ifdef WIN32
char text[64];
sprintf(text, "Could not open server on port %d", networkServer->GetPort());
MessageBox(NULL, text, "Error", MB_OK);
#else
LogString("Could not open server on port %d", networkServer->GetPort());
#endif
return 1;
}
return 0;
}
示例5: sizeof
HWND CConEmuInside::CheckInsideFocus()
{
if (!isInsideWndSet())
{
//_ASSERTE(FALSE && "Inside was not initialized");
return NULL;
}
wchar_t szInfo[512];
GUITHREADINFO tif = { sizeof(tif) };
HWND hParentWnd = GetParentRoot();
DWORD nTID = GetWindowThreadProcessId(hParentWnd, NULL);
if (!GetGUIThreadInfo(nTID, &tif))
{
_wsprintf(szInfo, SKIPCOUNT(szInfo) L"GetGUIThreadInfo(%u) failed, code=%u", nTID, GetLastError());
LogString(szInfo);
return NULL;
}
static GUITHREADINFO last_tif = {};
if (memcmp(&last_tif, &tif, sizeof(tif)) != 0)
{
last_tif = tif;
_wsprintf(szInfo, SKIPCOUNT(szInfo)
L"ParentInputInfo: flags=x%X Active=x%X Focus=x%X Capture=x%X Menu=x%X MoveSize=x%X Caret=x%X (%i,%i)-(%i,%i)",
tif.flags, LODWORD(tif.hwndActive), LODWORD(tif.hwndFocus), LODWORD(tif.hwndCapture), LODWORD(tif.hwndMenuOwner),
LODWORD(tif.hwndMoveSize), LODWORD(tif.hwndCaret), LOGRECTCOORDS(tif.rcCaret));
LogString(szInfo);
}
return tif.hwndFocus;
}
示例6: assert
//.........这里部分代码省略.........
tagHotICON hotICON;
hotICON.m_cType = CLANSKILL_ICON;
hotICON.m_nSlotNo = pSkillIcon->GetSkillSlotFromIcon();
if( hotICON.m_nSlotNo < 0 || hotICON.m_nSlotNo >= MAX_CLAN_SKILL_SLOT )
{
assert( 0 && "Invalid Skill Slot Index @CTCmdDragClanSkill2QuickBar::Exec" );
return true;
}
g_pNet->Send_cli_SET_HOTICON( (BYTE)nQuickSlotIdx, hotICON );
return true;
}
///*------------------------------------------------------------------------------------------------------------*/
bool CTCmdDragItemFromQuickBar::Exec( CTObject* pObj )
{
if( pObj == NULL )
{
assert( pObj && "Invalid Arg @CTCmdItemFromQuickBar::Exec");
return true;
}
CIconQuick* pIcon = (CIconQuick*)pObj;
short nSlotIndex = pIcon->GetQuickBarSlotIndex();
if( nSlotIndex < 0 || nSlotIndex >= MAX_HOT_ICONS )
{
LogString( LOG_NORMAL,"Not Found SlotIndex By Icon Pointer @CTCmdDragItemFromQuickBar::Exec");
return true;
}
tagHotICON hotICON;
hotICON.m_cType = 0;
hotICON.m_nSlotNo = 0;
g_pNet->Send_cli_SET_HOTICON( (BYTE)nSlotIndex, hotICON );
return true;
}
///*------------------------------------------------------------------------------------------------------------*/
bool CTCmdMoveIconInQuickBar::Exec( CTObject* pObj )
{
if( pObj == NULL )
{
assert( pObj && "Invalid Arg @CTCmdItemFromQuickBar::Exec");
return true;
}
CIconQuick* pIcon = (CIconQuick*)pObj;
short nPrevSlotIndex = pIcon->GetQuickBarSlotIndex();
if( nPrevSlotIndex < 0 || nPrevSlotIndex >= MAX_HOT_ICONS )
{
LogString( LOG_NORMAL,"Invalid QuickBar SlotIndex @CTCmdDragItemFromQuickBar::Exec");
return true;
}
CTDialog* pDlg = g_itMGR.FindDlg( m_nType );
if( pDlg == NULL )
示例7: LogString
void NetworkedGame::Connect(void)
{
if(init)
{
LogString("ArmyWar already initialised");
return;
}
LogString("PolyNetworkedGame::Connect");
init = true;
networkClient->SendConnect("myname");
}
示例8: Cal_RunSPEED
void CObjUSER::Update_SPEED ()
{
//Cal_RunSPEED() Add speed to calculate.
//It turns on after the speed gives m_nRunSPEED value in the server.
//Another way to compute here. ;;;;
m_nRunSPEED = Cal_RunSPEED ();
if ( this->GetPetMode() < 0 )
{
m_fRunAniSPEED = Cal_RunAniSPEED( m_nRunSPEED );
m_nAtkAniSPEED = Cal_AtkAniSPEED( this->GetPartITEM(BODY_PART_WEAPON_R) );
}
else
{
/// Add Battle Heart attack speed application nAvy - 2005/7/28
#if defined(_GBC)
m_fRunAniSPEED = ( m_nRunSPEED + 500 ) / 1000.f;
m_nAtkAniSPEED = Cal_AtkAniSPEED( this->GetPartITEM(BODY_PART_WEAPON_R) );
/*for( int i = 0 ; i < MAX_RIDING_PART; ++i )
m_nAtkAniSPEED += PAT_ITEM_ATK_SPD( m_sPetPartItemIDX[ i ].m_nItemNo );*/
#else
m_fRunAniSPEED = ( m_nRunSPEED + 500 ) / 1000.f;
///<- 2005/7/25 Add to Cart modifying system parts : nAvy
//m_nAtkAniSPEED = ( 1500.f / ( ( PAT_ITEM_ATK_SPD( m_sPetPartItemIDX[ RIDE_PART_ARMS ].m_nItemNo )) + 5 ) ) + this->m_iAddValue[ AT_ATK_SPD ];
m_nAtkAniSPEED = ( 1500.f / ( ( PAT_ITEM_ATK_SPD( m_sPetPartItemIDX[ RIDE_PART_ARMS ].m_nItemNo )) + 5 ) ) + this->m_iAddValue[ AT_ATK_SPD ];
///->
#endif
}
LogString (LOG_DEBUG, "CmPerSEC: %f, AniSpeed: %f \n", m_nRunSPEED, m_fRunAniSPEED );
};
示例9: wsprintfW
bool CClientDB::InsertInventoryData( const char* pszName, S_InventoryData Data )
{
ICommandText* pICommandText = NULL;
HRESULT hr;
LONG cNumRows = 0;
WCHAR wCmdString[1024];
wsprintfW(wCmdString, L"INSERT INTO INVENTORY ( name, realindex, virtualindex ) VALUES ( '%S', %d, %d )", pszName, Data.lRealIndex, Data.lVirtualIndex );
pICommandText = CreateCommand ( m_pIDBInitialize ,wCmdString );
if( pICommandText == NULL )
return false;
if(FAILED(hr = pICommandText->Execute(
NULL,
IID_NULL,
NULL,
&cNumRows,
NULL)))
{
LogString( LOG_NORMAL,"Fail CreateInventoryTable\n" );
}
pICommandText->Release();
return true;
}
示例10: QF_appendQuest
//-------------------------------------------------------------------------------------------------
int QF_appendQuest ( int iQuestID )
{
LogString (LOG_DEBUG, "QF_appendQuest( %d ) \n", iQuestID );
//--------------------------------------------------------------------------------
LOGOUT( "QF_appendQuest( %d ) ", iQuestID );
//--------------------------------------------------------------------------------
for (short nI=0; nI<QUEST_PER_PLAYER; nI++)
if ( 0 == g_pAVATAR->m_Quests.m_QUEST[ nI ].GetID() )
{
g_pAVATAR->m_Quests.m_QUEST[ nI ].Init ();
g_pAVATAR->m_Quests.m_QUEST[ nI ].SetID( iQuestID, true );
//--------------------------------------------------------------------------------
LOGOUT( "QF_appendQuest( %d ) [ The request to the server : %d ] ", iQuestID, nI );
//--------------------------------------------------------------------------------
g_pNet->Send_cli_QUEST_REQ(TYPE_QUEST_REQ_ADD, (BYTE)nI, iQuestID );
return nI;
}
//--------------------------------------------------------------------------------
LOGERR( "QF_appendQuest( %d ) FAILED ", iQuestID );
//--------------------------------------------------------------------------------
return -1;
}
示例11: INVENTORY
//*----------------------------------------------------------------------------
/// 매번 새로 만들려고 시도한다.. 이미 만들어져 있다면 Fail
//*----------------------------------------------------------------------------
bool CClientDB::CreateInventoryTable()
{
ICommandText* pICommandText = NULL;
HRESULT hr;
LONG cNumRows = 0;
WCHAR wCmdString[] = L"CREATE TABLE INVENTORY ( name TEXT(30), realindex long , virtualindex long )";
pICommandText = CreateCommand ( m_pIDBInitialize ,wCmdString );
if( pICommandText == NULL )
return false;
if(FAILED(hr = pICommandText->Execute(
NULL,
IID_NULL,
NULL,
&cNumRows,
NULL)))
{
LogString( LOG_NORMAL,"Fail CreateInventoryTable\n" );
}
pICommandText->Release();
return true;
}
示例12: wcscpy_c
void CTabPanelBase::UpdateTabFontInt()
{
if (!IsTabbarCreated())
return;
LOGFONT lf = {};
lf.lfWeight = FW_DONTCARE;
lf.lfCharSet = gpSet->nTabFontCharSet;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
wcscpy_c(lf.lfFaceName, gpSet->sTabFontFace);
gpFontMgr->EvalLogfontSizes(lf, gpSet->nTabFontHeight, 0);
wchar_t szInfo[100];
_wsprintf(szInfo, SKIPCOUNT(szInfo) L"Creating tab font name='%s' height=%i", lf.lfFaceName, lf.lfHeight);
LogString(szInfo);
// CreateFont
HFONT hFont = CreateFontIndirect(&lf);
// virtual
SetTabbarFont(hFont);
// Store new Font in member variable
if (mh_TabFont)
DeleteObject(mh_TabFont);
mh_TabFont = hFont;
}
示例13: _ASSERTE
bool CSetPgApps::CreateChildDlg()
{
if (mh_Child && !IsWindow(mh_Child))
{
_ASSERTE(FALSE && "Invalid mh_Child");
mh_Child = NULL;
}
if (!mh_Child)
{
#if defined(_DEBUG)
HWND hChild = GetDlgItem(mh_Dlg, IDD_SPG_APPDISTINCT2);
_ASSERTE(hChild == NULL);
#endif
LogString(L"Creating child dialog IDD_SPG_APPDISTINCT2");
SafeDelete(mp_DlgDistinct2); // JIC
mp_DlgDistinct2 = CDynDialog::ShowDialog(IDD_SPG_APPDISTINCT2, mh_Dlg, pageOpProc_AppsChild, 0/*dwInitParam*/);
mh_Child = mp_DlgDistinct2 ? mp_DlgDistinct2->mh_Dlg : NULL;
if (!mh_Child)
{
EnableWindow(mh_Dlg, FALSE);
MBoxAssert(mh_Child && "CreateDialogParam(IDD_SPG_APPDISTINCT2) failed");
return 0;
}
SetWindowLongPtr(mh_Child, GWLP_ID, IDD_SPG_APPDISTINCT2);
if (!mp_DpiDistinct2 && mp_ParentDpi)
{
mp_DpiDistinct2 = new CDpiForDialog();
mp_DpiDistinct2->Attach(mh_Child, mh_Dlg, mp_DlgDistinct2);
}
HWND hHolder = GetDlgItem(mh_Dlg, tAppDistinctHolder);
RECT rcPos = {}; GetWindowRect(hHolder, &rcPos);
MapWindowPoints(NULL, mh_Dlg, (LPPOINT)&rcPos, 2);
POINT ptScroll = {};
HWND hEnd = GetDlgItem(mh_Child,stAppDistinctBottom);
MapWindowPoints(hEnd, mh_Child, &ptScroll, 1);
ShowWindow(hEnd, SW_HIDE);
SCROLLINFO si = {sizeof(si), SIF_ALL};
si.nMax = ptScroll.y - (rcPos.bottom - rcPos.top);
RECT rcChild = {}; GetWindowRect(GetDlgItem(mh_Child, DistinctControls[1].nOverrideID), &rcChild);
si.nPage = rcChild.bottom - rcChild.top;
SetScrollInfo(mh_Child, SB_VERT, &si, FALSE);
MoveWindowRect(mh_Child, rcPos);
ShowWindow(hHolder, SW_HIDE);
ShowWindow(mh_Child, SW_SHOW);
//_ASSERTE(mh_Child && IsWindow(mh_Child));
}
return (mh_Child != NULL);
}
示例14: dreamSock_GetPacket
//-----------------------------------------------------------------------------
// Name: empty()
// Desc:
//-----------------------------------------------------------------------------
int dreamSock_GetPacket(SOCKET sock, char *data, struct sockaddr *from)
{
int ret;
struct sockaddr tempFrom;
socklen_t fromlen;
fromlen = sizeof(tempFrom);
ret = recvfrom(sock, data, 1400, 0, (struct sockaddr *) &tempFrom, &fromlen);
// Copy the address to the from pointer
if(from != NULL)
*(struct sockaddr *) from = tempFrom;
if(ret == -1)
{
#ifdef WIN32
errno = WSAGetLastError();
// Silently handle wouldblock
if(errno == WSAEWOULDBLOCK)
return ret;
if(errno == WSAEMSGSIZE)
{
// ERROR: Oversize packet
return ret;
}
LogString("Error code %d: recvfrom() : %s", errno, strerror(errno));
#else
// Silently handle wouldblock
if(errno == EWOULDBLOCK || errno == ECONNREFUSED)
return ret;
LogString("Error code %d: recvfrom() : %s", errno, strerror(errno));
#endif
return ret;
}
return ret;
}
示例15: LogString
//-----------------------------------------------------------------------------
// Name: empty()
// Desc:
//-----------------------------------------------------------------------------
void CArmyWar::CheckPredictionError(int a)
{
if(a < 0 && a > COMMAND_HISTORY_SIZE)
return;
float errorX =
localClient->serverFrame.origin.x - localClient->frame[a].predictedOrigin.x;
float errorY =
localClient->serverFrame.origin.y - localClient->frame[a].predictedOrigin.y;
// Fix the prediction error
if( (errorX != 0.0f) || (errorY != 0.0f) )
{
localClient->frame[a].predictedOrigin.x = localClient->serverFrame.origin.x;
localClient->frame[a].predictedOrigin.y = localClient->serverFrame.origin.y;
localClient->frame[a].vel.x = localClient->serverFrame.vel.x;
localClient->frame[a].vel.y = localClient->serverFrame.vel.y;
LogString("Prediction error for frame %d: %f, %f\n", a,
errorX, errorY);
}
float errorXrot =
localClient->serverFrame.rot.w - localClient->frame[a].predictedRot.w;
float errorYrot =
localClient->serverFrame.rot.y - localClient->frame[a].predictedRot.y;
// Fix the prediction error
if( (errorXrot != 0.0f) || (errorYrot != 0.0f) )
{
localClient->frame[a].predictedRot.w = localClient->serverFrame.rot.w;
localClient->frame[a].predictedRot.y = localClient->serverFrame.rot.y;
LogString("Prediction rot error for frame %d: %f, %f\n", a,
errorXrot, errorYrot);
}
}