Пример #1
0
BOOL CTwain::FileXfer(void)
{
	TW_SETUPFILEXFER twsfx;
	if (!DS(DG_CONTROL, DAT_SETUPFILEXFER, MSG_GET, &twsfx)) {
		return FALSE;
	}
	int nFF = twsfx.Format;
	if (!FileXferReady(nFF, twsfx.FileName)) {
		// application aborted transfer
		return FALSE;
	}
	twsfx.Format = (TW_UINT16)nFF;
	if (!DS(DG_CONTROL, DAT_SETUPFILEXFER, MSG_SET, &twsfx)) {
		FileXferDone(NULL, 0);
		return FALSE;
	}
	if (!DS(DG_IMAGE, DAT_IMAGEFILEXFER, MSG_GET, NULL)) {
		FileXferDone(NULL, 0);
		return FALSE;
	}

	ATLASSERT(nState >= TRANSFER_READY);
	EndXfer();				// acknowledge & end transfer
	ATLASSERT(nState == TRANSFER_READY || nState == SOURCE_ENABLED);
	FlushMessageQueue();

	FileXferDone(twsfx.FileName, 255);
	return TRUE;
}
Пример #2
0
BOOL CTwain::MemoryXfer(void)
{
	ATLASSERT(nState == TRANSFER_READY);
	TW_IMAGEINFO    info;
	TW_SETUPMEMXFER twsx;
	TW_IMAGEMEMXFER mx;

	if (!DS(DG_CONTROL, DAT_SETUPMEMXFER, MSG_GET, &twsx)) {
		return FALSE;
	}

	// Get actual image info
	if (!DS(DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &info)) {
		return FALSE;
	}

	ATLASSERT(nState == TRANSFER_READY);
	if (!MemXferReady(info)) {
		// application aborted transfer
		return FALSE;
	}

	if (!MemXferAlloc(twsx, mx.Memory)) {
		MemXferDone(FALSE);
		return FALSE;
	}

	int iRow = 0;
	while (DS(DG_IMAGE, DAT_IMAGEMEMXFER, MSG_GET, &mx)) {
		// We got a buffer - make sure DS doesn't
		// feed us rows past the end of the image:
		mx.Rows = min(mx.Rows, (unsigned)(info.ImageLength - iRow));
		// Don't call the buffer-handler with 0 rows
		if (mx.Rows != 0) {
			if (!MemXferBuffer(iRow, mx)) {
				// Buffer callback says to abort
				break;
			}
			iRow += mx.Rows;
		}
		if (ResultCode() == TWRC_XFERDONE) {
			// DS says that was the last buffer:
			iRow = info.ImageLength;        // no matter what, we're done
			break;
		}
	}

	MemXferFree(mx.Memory);

	ATLASSERT(nState >= TRANSFER_READY);
	EndXfer();				// acknowledge & end transfer
	ATLASSERT(nState == TRANSFER_READY || nState == SOURCE_ENABLED);
	FlushMessageQueue();

	MemXferDone(iRow == info.ImageLength);
	return TRUE;
}
Пример #3
0
void GAPI_VideoQuit(_THIS)
{
	writeDebugInfo("GAPI_VideoQuit");
	/* Destroy the window and everything associated with it */
	if ( SDL_Window ) 
	{
		/* Delete the screen bitmap (also frees screen->pixels) */
		if ( this->screen ) 
		{
#ifdef HAVE_OPENGL //maks
			if ( this->screen->flags & SDL_OPENGL ) 
			{
				WIN_GL_ShutDown(this);
			}
#endif

			if ( this->screen->flags & SDL_FULLSCREEN ) 
			{
				SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
				bShowTaskBar = 1;
			}


#ifndef NO_CHANGEDISPLAYSETTINGS
			if ( this->screen->flags & SDL_FULLSCREEN ) {
				ChangeDisplaySettings(NULL, 0);
				ShowWindow(SDL_Window, SW_HIDE);
			}
#endif


			
			this->screen->pixels = NULL;
		}
		
		GAPI_QuitGamma(this);
		GAPI_DestroyWindow(this);
		FlushMessageQueue();

		SDL_Window = NULL;

		CloseGAPI();		
	}

	if(gxHandle)
	{
		FreeLibrary(gxHandle);
		gxHandle = NULL;
	}	

	//Make sure restore task bar
	SHFullScreen(GetForegroundWindow(), SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
}
Пример #4
0
void DIB_VideoQuit(_THIS)
{
	/* Destroy the window and everything associated with it */
	if ( SDL_Window ) {
		/* Delete the screen bitmap (also frees screen->pixels) */
		if ( this->screen ) {
#ifdef WIN32_PLATFORM_PSPC
			if ( this->screen->flags & SDL_FULLSCREEN ) {
				/* Unhide taskbar, etc. */
				SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR);
				SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON);
				ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL);
			}
#endif
#ifndef NO_CHANGEDISPLAYSETTINGS
			if ( this->screen->flags & SDL_FULLSCREEN ) {
				ChangeDisplaySettings(NULL, 0);
				ShowWindow(SDL_Window, SW_HIDE);
			}
#endif
#ifdef HAVE_OPENGL //maks
			if ( this->screen->flags & SDL_OPENGL ) {
				WIN_GL_ShutDown(this);
			}
#endif
			this->screen->pixels = NULL;
		}
		if ( screen_bmp ) {
			DeleteObject(screen_bmp);
			screen_bmp = NULL;
		}
		if ( screen_icn ) {
			DestroyIcon(screen_icn);
			screen_icn = NULL;
		}
		DIB_QuitGamma(this);
		DIB_DestroyWindow(this);
		FlushMessageQueue();

		SDL_Window = NULL;
	}
}
Пример #5
0
BOOL CTwain::NativeXfer(void)
{
	TW_UINT32		hNative;
	// Get next native image 
	DS(DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hNative);

	if (TWRC_XFERDONE != rc) {
		// transfer failed for some reason or another
		hNative = NULL;
		if (bTrace) ATLTRACE(_T("TWAIN:NativeXfer failed.\n"));
	}
	ATLASSERT(nState >= TRANSFER_READY);
	EndXfer();				// acknowledge & end transfer
	ATLASSERT(nState == TRANSFER_READY || nState == SOURCE_ENABLED);
	FlushMessageQueue();
	if (hNative) {
		// call back with DIB
		if (bTrace) ATLTRACE(_T("TWAIN: calling DibReceived...\n"));
		DibReceived((HGLOBAL)hNative);
	}
	return (hNative != NULL);
} // NativeXfer