本文整理汇总了C++中DisplayMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ DisplayMessage函数的具体用法?C++ DisplayMessage怎么用?C++ DisplayMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DisplayMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateListenSocket
bool CreateListenSocket()
{
int retval;
g_listenSock = socket(AF_INET, SOCK_STREAM, 0);
if(g_listenSock == INVALID_SOCKET)
{
DisplayMessage(); return false;
}
SOCKADDR_IN serveraddr;
ZeroMemory(&serveraddr, sizeof(serveraddr));
serveraddr.sin_family = AF_INET;
serveraddr.sin_port = htons(40100);
serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
retval = bind(g_listenSock, (SOCKADDR*)&serveraddr, sizeof(serveraddr));
if(retval == SOCKET_ERROR)
{
DisplayMessage();
return false;
}
retval = listen(g_listenSock,SOMAXCONN);
if(retval == SOCKET_ERROR)
{
DisplayMessage();
return false;
}
return true;
}
示例2: message
~AllocList()
{
#ifdef _CPPRTTI // this works in MSVC 5.0 - ie. the macro is defined if RTTI is turned on
// but there appears to be no preprocessor way of determining if RTTI is turned on under Watcom
// No, I think it works in Watcom too, actually...
#pragma message("Run-Time Type Identification (RTTI) is enabled")
for (Iterator itLeak(*this) ; !itLeak.Done() ; itLeak.Next())
{
TCHAR buf[256];
::wsprintf(buf,TEXT("Object not deallocated:\nType: %s\nRefCnt: %u"),typeid(*itLeak.Get()).name(),itLeak.Get()->m_nRefCnt);
DisplayMessage(TEXT("Memory Leak!"),buf);
}
#else // ! _CPPRTTI
unsigned nRefs(0);
for (Iterator itLeak(*this) ; !itLeak.Done() ; itLeak.Next())
{
nRefs += itLeak.Get()->m_nRefCnt;
}
if (Size())
{
char buf[256];
::sprintf(buf,"Objects not deallocated:\nNumber of Objects: %u\nNumber of References: %u",Size(),nRefs);
DisplayMessage("Memory Leaks!",buf);
}
#endif // ! _CPPRTTI
g_bAllocListActive = false;
}
示例3: CreateListenSocket
bool CreateListenSocket()
{
int retval;
g_ServerSocket = socket(AF_INET, SOCK_STREAM, 0);
if(g_ServerSocket == INVALID_SOCKET)
{
DisplayMessage(); return false;
}
SOCKADDR_IN serveraddr;
ZeroMemory(&serveraddr, sizeof(serveraddr));
serveraddr.sin_family = AF_INET;
serveraddr.sin_port = htons(40100);
serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
retval = bind(g_ServerSocket, (SOCKADDR*)&serveraddr, sizeof(serveraddr));
if(retval == SOCKET_ERROR)
{
DisplayMessage();
return false;
}
retval = listen(g_ServerSocket,SOMAXCONN);
if(retval == SOCKET_ERROR)
{
DisplayMessage();
return false;
}
HANDLE hEvent = WSACreateEvent();
WSAEventSelect( g_ServerSocket, hEvent, FD_ACCEPT | FD_CLOSE);
EventList[0] = hEvent;
g_SockCnt++;
return true;
}
示例4: ResourceLoader
bool gameInstance::ResourceLoader()
{
std::ifstream resources[3]; //Otwieramy wszystkie pliki cfg zawierajace dane o obiektach gry
resources[0].open("game/sounds.cfg");
resources[1].open("game/units.cfg");
resources[2].open("game/objs.cfg");
if(!resources[0].good()) { DisplayMessage("Blad!","Nie mozna otworzyc pliku sounds.cfg!"); return false; } //Sprawdzamy czy
if(!resources[1].good()) { DisplayMessage("Blad!","Nie mozna otworzyc pliku units.cfg!"); return false; } //listy sa dostepne
if(!resources[2].good()) { DisplayMessage("Blad!","Nie mozna otworzyc pliku objs.cfg!"); return false; } // do wczytania
std::string line;
for(int i=0;i<3;i++)
{
while(!resources[i].eof()) //Wczytujemy po kolei ka¿dy z plików do odpowiedniej listy
{
getline(resources[i],line);
if(line=="[UNIT]")
{
std::string name,file,sound_movement,sound_attack,sound_death;
int HP,attack,defence;
resources[i]>>line; //Sprawdzamy czy dany wpis w pliku cfg istnieje i czy jest na odpowiedniej pozycji
if(line=="[NAME]") resources[i] >> name; else continue; //wczytujemy dane, albo przerywamy je¿eli s¹ niepoprawne
resources[i] >> line;
if(line=="[BITMAP]") resources[i] >> file; else continue;
resources[i] >> line;
if(line=="[HP]") resources[i] >> HP; else continue;
示例5: GroupPrint
/*
* GroupPrint: Display the members of the group with the given name.
*/
void GroupPrint(char *group_name)
{
UserGroup g;
int i, index;
COLORREF color;
BYTE style;
ID id;
char buf[MAX_CHARNAME + 10];
index = FindGroupByName(group_name);
switch (index)
{
case GROUP_NOMATCH:
GameMessage(GetString(hInst, IDS_BADGROUPNAME));
break;
case GROUP_AMBIGUOUS:
GameMessage(GetString(hInst, IDS_DUPLICATEGROUPNAME));
break;
default:
group_name = groups[index];
GroupLoad(group_name, &g);
GameMessagePrintf(GetString(hInst, IDS_GROUPMEMBERS), MAX_GROUPNAME, group_name);
color = RGB(0, 0, 0);
style = STYLE_NORMAL;
EditBoxStartAdd();
for (i=0; i < g.num_users; i++)
{
if (i != 0)
DisplayMessage(", ", color, style);
id = FindPlayerByNameExact(g.names[i]);
// Show player in red if logged on
if (id == 0 || id == INVALID_ID)
DisplayMessage(g.names[i], color, style);
else
{
sprintf(buf, "~r%s~n", g.names[i]);
DisplayMessage(buf, color, style);
}
}
EditBoxEndAdd();
break;
}
}
示例6: PrepareTemplate
/* #FN#
Reads a keyboard template from a given file */
BOOL
/* #AS#
TRUE if succeeded, otherwise FALSE */
CKeyboardDlg::
PrepareTemplate(
LPSTR pszTemplateFile,
LPSTR pszTemplateDesc,
BOOL bCheckIfExists /*=TRUE*/
)
{
BOOL bResult = FALSE;
if( _IsPathAvailable( pszTemplateFile ) )
{
CFileStatus fsStatus;
if( !bCheckIfExists || CFile::GetStatus( pszTemplateFile, fsStatus ) )
{
if( !CKeyTemplateDlg::ReadKeyTemplate( pszTemplateFile, pszTemplateDesc, s_anKBTable, GetSafeHwnd() ) )
{
DisplayMessage( GetSafeHwnd(), IDS_ERROR_A8K_LOAD, 0, MB_ICONEXCLAMATION | MB_OK );
strcpy( pszTemplateFile, FILE_NONE );
}
else
bResult = TRUE;
}
}
/* Clear the template description */
if( !bResult )
*pszTemplateDesc = '\0';
return bResult;
} /* #OF# CKeyboardDlg::PrepareTemplate */
示例7: MovieToggleReadOnly
void MovieToggleReadOnly(void) {
if(Movie.Status == Playback) {
if(Movie.ReadOnly == 1)
{
Movie.ReadOnly=0;
DisplayMessage("Movie is now read+write.");
}
else
{
Movie.ReadOnly=1;
DisplayMessage("Movie is now read only.");
}
}
}
示例8: ExecuteFunction
logical cClassCode :: ExecuteFunction (char *fname, logical chk_opt )
{
char actname[ID_SIZE];
cfte *cfteptr;
logical term = NO;
BEGINSEQ
static cfte acttbl[] = {
cfte("InsertCheckError",ALINK(this,cClassCode,InsertCheckError)),
cfte("InsertError",ALINK(this,cClassCode,InsertError)),
cfte("InsertErrorNum",ALINK(this,cClassCode,InsertErrorNum)),
cfte("InsertLeaveseq",ALINK(this,cClassCode,InsertLeaveseq)),
cfte("InsertProjError",ALINK(this,cClassCode,InsertProjError)),
};
static srt cftesrt(sizeof(acttbl)/CFTE,CFTE,UNDEF,UNDEF,UNDEF,(char *)acttbl,NO);
if ( !cftesrt.srtkln() )
cftesrt.srtsor(CFTE_KPS,CFTE_KLN,CFTE_KTP);
if ( cfteptr = (cfte *)cftesrt.srtigt(cftesrt.srtssr(gvtxstb(actname,fname,ID_SIZE))) )
{
if ( chk_opt ) LEAVESEQ
term = cfteptr->ActionCall(this);
}
else
term = cClassCodeBase::ExecuteFunction(fname,chk_opt);
if ( term && !chk_opt )
DisplayMessage();
ENDSEQ
return(term);
}
示例9: ReadEntireFile
Win32FileContents ReadEntireFile(const char * Filename){
HANDLE File = CreateFileA(Filename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
if (File == INVALID_HANDLE_VALUE) {
return{ 0, 0 };
}
LARGE_INTEGER Size;
GetFileSizeEx(File, &Size);
Win32FileContents FileContents = {};
FileContents.Size = Size.QuadPart;
FileContents.Data = (unsigned char *)VirtualAlloc(0, Size.LowPart, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
DWORD BytesRead;
ReadFile(File, FileContents.Data, Size.LowPart, &BytesRead, 0);
if (BytesRead != Size.LowPart) {
DisplayMessage(GetLastError());
//TODO: Logging, errors etc
}
return FileContents;
};
示例10: AddClient
bool AddClient(int index)
{
SOCKET ClientSocket;
SOCKADDR_IN sockaddr;
int addrlen = sizeof(sockaddr);
ClientSocket = accept(SockList[index], (SOCKADDR*)&sockaddr, &addrlen);
if(ClientSocket == SOCKET_ERROR)
{
DisplayMessage(); return false;
}
// 이벤트 등록
WSAEVENT hClientEvent = WSACreateEvent();
WSAEventSelect(ClientSocket, hClientEvent, FD_WRITE | FD_READ | FD_CLOSE);
// 전역변수에 저장
SockList[g_SockCnt] = ClientSocket;
EventList[g_SockCnt] = hClientEvent;
g_SockCnt++;
// 접속메세지 전송
char buf[BUFFERSIZE];
int retByte = sprintf(buf, "\n[TCP 서버] 클라이언트 접속: IP주소=%s, 포트 번호=%d\n",
inet_ntoa(sockaddr.sin_addr), ntohs(sockaddr.sin_port));
SendAll(0, buf, retByte);
return true;
}
示例11: Message
void __cdecl
Message(
UINT MsgNumber,
...
)
/*++
Routine Description:
Prints a user message.
Arguments:
MsgNumber - Internal code on message.
Return Value:
None.
--*/
{
va_list valist;
va_start(valist, MsgNumber);
DisplayMessage(NULL, MSGSTR, MsgNumber, valist);
va_end(valist);
}
示例12: Warning
void __cdecl
Warning(
const char *szFilename,
UINT WarningNumber,
...
)
/*++
Routine Description:
Prints a warning message.
Arguments:
Filename - File which caused the warning.
WarningNumber - Internal error code.
Return Value:
None.
--*/
{
va_list valist;
va_start(valist, WarningNumber);
DisplayMessage(szFilename, WARNSTR, WarningNumber, valist);
va_end(valist);
}
示例13: PostNote
void __cdecl
PostNote(
const char *szFilename,
UINT NoteNumber,
...
)
/*++
Routine Description:
Prints a note user.
Arguments:
szFilename - File which caused the warning.
NoteNumber - Internal code on note.
Return Value:
None.
--*/
{
va_list valist;
va_start(valist, NoteNumber);
DisplayMessage(szFilename, NOTESTR, NoteNumber, valist);
va_end(valist);
}
示例14: ExecuteFunction
logical pKFZVS :: ExecuteFunction (char *fname, logical chk_opt )
{
char actname[ID_SIZE];
cfte *cfteptr;
logical term = NO;
BEGINSEQ
static cfte acttbl[] = {
cfte("GetSparte",ALINK(this,pKFZVS,GetSparte)),
};
static srt cftesrt(sizeof(acttbl)/CFTE,CFTE,UNDEF,UNDEF,UNDEF,(char *)acttbl,NO);
if ( !cftesrt.srtkln() )
cftesrt.srtsor(CFTE_KPS,CFTE_KLN,CFTE_KTP);
if ( cfteptr = (cfte *)cftesrt.srtigt(cftesrt.srtssr(gvtxstb(actname,fname,ID_SIZE))) )
{
if ( chk_opt ) LEAVESEQ
cfteptr->LINKINST(this);
term = cfteptr->ActionCall();
}
else
term = pVS_base::ExecuteFunction(fname,chk_opt);
if ( term && !chk_opt )
DisplayMessage();
ENDSEQ
return(term);
}
示例15: main
int main(void)
{
InitHardware();
dmInit();
sei(); // enable interrupts
GoToSleep();
button |= PB_ACK;
while(1)
{
if (button == PB_RELEASE) { // short button press
msg_ptr = DisplayMessage(msg_ptr);
button |= PB_ACK;
}
if (button == PB_LONGPRESS) { // button pressed for some seconds
dmClearDisplay();
dmPrintChar(130); // sad smiley
_delay_ms(500);
GoToSleep();
button |= PB_ACK;
}
} // of while(1)
}