Exemple #1
0
bool PacketFileWriter::_WriteBlock(uint16 eq_op, const void *d, uint16 len, bool to_server, const struct timeval &tv) {
	if(out == NULL)
		return(false);

	PacketFileSection s;
	s.opcode = eq_op;
	s.len = len;
	s.tv_sec = tv.tv_sec;
	s.tv_msec = tv.tv_usec/1000;

	if(to_server)
		SetToServer(s);
	else
		SetToClient(s);

	if(fwrite(&s, sizeof(s), 1, out) != 1) {
		fprintf(stderr, "Error writting block header: %s\n", strerror(errno));
		return(false);
	}

	if(fwrite(d, 1, len, out) != len) {
		fprintf(stderr, "Error writting block body: %s\n", strerror(errno));
		return(false);
	}

	if(force_flush)
		fflush(out);

	return(true);
}
Exemple #2
0
bool KINWM::Create(const std::wstring& p_Caption,
                   const Common::KINRect p_Rect,
                   const unsigned int p_BackColor,
                   const unsigned int p_WindowStyle,
                   const WNDPROC p_MessageFunction)
{
    mhInstance = GetModuleHandle(NULL);

    WNDCLASSW WndClass;
    WndClass.style			= CS_CLASSDC;
    WndClass.lpfnWndProc	= (WNDPROC)p_MessageFunction;
    WndClass.cbClsExtra		= 0;
    WndClass.cbWndExtra		= 0;
    WndClass.hInstance		= mhInstance;
    WndClass.hIcon			= LoadIcon (NULL, IDI_APPLICATION);
    WndClass.hCursor		= LoadCursor (NULL, IDC_ARROW);
    WndClass.hbrBackground	= 0;
    WndClass.lpszMenuName	= NULL;
    WndClass.lpszClassName	= p_Caption.c_str();
    RegisterClassW(&WndClass);

    mhWnd = CreateWindowW(p_Caption.c_str(), p_Caption.c_str(), p_WindowStyle,
                          p_Rect.mX, p_Rect.mY, p_Rect.mWidth, p_Rect.mHeight,
                          NULL, NULL, GetModuleHandle(NULL), NULL);

    if(mhWnd == NULL)
    {
        printf("KINWM::Create 실패 - mhWnd가 NULL 입니다.\n");
    }

    SetToClient(Common::KINSize(p_Rect.mWidth, p_Rect.mHeight));

    ShowWindow();

    return true;
}