本文整理汇总了C++中SyncDocument::sendPauseCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncDocument::sendPauseCommand方法的具体用法?C++ SyncDocument::sendPauseCommand怎么用?C++ SyncDocument::sendPauseCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyncDocument
的用法示例。
在下文中一共展示了SyncDocument::sendPauseCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
{
#ifdef _DEBUG
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
/* _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); */
// _CrtSetBreakAlloc(254);
#endif
hInst = hInstance;
CoInitialize(NULL);
WSADATA wsa;
if (0 != WSAStartup(MAKEWORD(2, 0), &wsa))
die("Failed to init network");
SOCKET serverSocket = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in sin;
memset(&sin, 0, sizeof sin);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(1338);
if (SOCKET_ERROR == bind(serverSocket, (struct sockaddr *)&sin,
sizeof(sin)))
die("Could not start server");
while (listen(serverSocket, SOMAXCONN) == SOCKET_ERROR)
; /* nothing */
ATOM mainClass = registerMainWindowClass(hInstance);
ATOM trackViewClass = registerTrackViewWindowClass(hInstance);
if (!mainClass || !trackViewClass)
die("Window Registration Failed!");
trackView = new TrackView();
trackView->setDocument(&document);
hwnd = CreateWindowExW(
0,
mainWindowClassName,
mainWindowTitleW,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, // x, y
CW_USEDEFAULT, CW_USEDEFAULT, // width, height
NULL, NULL, hInstance, NULL
);
if (NULL == hwnd)
die("Window Creation Failed!");
fileNew();
HACCEL accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR));
ShowWindow(hwnd, TRUE);
UpdateWindow(hwnd);
bool done = false;
MSG msg;
bool guiConnected = false;
while (!done)
{
if (!document.clientSocket.connected())
{
SOCKET clientSocket = INVALID_SOCKET;
fd_set fds;
FD_ZERO(&fds);
#pragma warning(suppress: 4127)
FD_SET(serverSocket, &fds);
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
// look for new clients
if (select(0, &fds, NULL, NULL, &timeout) > 0)
{
SendMessage(statusBarWin, SB_SETTEXT, 0, (LPARAM)"Accepting...");
sockaddr_in client;
clientSocket = clientConnect(serverSocket, &client);
if (INVALID_SOCKET != clientSocket)
{
char temp[256];
snprintf(temp, 256, "Connected to %s", inet_ntoa(client.sin_addr));
SendMessage(statusBarWin, SB_SETTEXT, 0, (LPARAM)temp);
document.clientSocket = NetworkSocket(clientSocket);
document.clientRemap.clear();
document.sendPauseCommand(true);
document.sendSetRowCommand(trackView->getEditRow());
guiConnected = true;
}
else SendMessage(statusBarWin, SB_SETTEXT, 0, (LPARAM)"Not Connected.");
}
}
if (document.clientSocket.connected())
//.........这里部分代码省略.........