Beispiel #1
0
void OnDropFiles(HDROP hDrop)
{
	char path[256];

	DragQueryFile(hDrop, 0, path, sizeof(path));
	DragFinish(hDrop);
	OpenMedia(path);
}
Beispiel #2
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	WNDCLASS wndclass;
	RECT rect;
	int nWidth, nHeight;
	MSG msg;

#ifdef STACKWALKER
	InitAllocCheck();
#endif
	memset(&wndclass, 0, sizeof(WNDCLASS));
	wndclass.style = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc = (WNDPROC)WindowProc;
	wndclass.hInstance = hInstance;
	wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
	wndclass.lpszClassName = _T("GoodPlayerClass");
	RegisterClass(&wndclass);

	g_hInstance = hInstance;
	GetClientRect(GetDesktopWindow(), &rect);
	nWidth = 320;
	if (nWidth > rect.right)
		nWidth = rect.right;
	nHeight = 240;
	if (nHeight > rect.bottom)
		nHeight = rect.bottom;
	g_hMain = CreateWindow(wndclass.lpszClassName, _T("GoodPlayer"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, nWidth, nHeight, NULL, NULL, hInstance, NULL);
	ShowWindow(g_hMain, nCmdShow);
	UpdateWindow(g_hMain);

	if (lpCmdLine[0] != _T('\0'))
	{
		if (lpCmdLine[0] == _T('"'))
		{
			++lpCmdLine;
			lpCmdLine[_tcslen(lpCmdLine) - 1] = _T('\0');
		}
		OpenMedia(lpCmdLine);
	}

	while (GetMessage(&msg, NULL, 0, 0))
   	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
#ifdef STACKWALKER
	DeInitAllocCheck();
#endif
	return msg.wParam;
}
Beispiel #3
0
void OnOpen(void)
{
	OPENFILENAME file;
	TCHAR str[255] = {0};

	memset(&file, 0, sizeof(OPENFILENAME));
	file.lStructSize = sizeof(OPENFILENAME);
	file.hwndOwner = g_hMain;
	file.hInstance = g_hInstance;
	file.lpstrFilter = _T("All Files\0*.*\0");
	file.lpstrFile = str;
	file.nMaxFile = 255;
	file.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
	if (GetOpenFileName(&file))
		OpenMedia(file.lpstrFile);
}
static IOReturn
PrintSpeedForBSDNode ( const char * bsdNode )
{
	
	IOReturn		error			= kIOReturnError;
	int 			fileDescriptor	= 0;
	UInt16			speed			= 0;
	char 			deviceName[MAXPATHLEN];
	
	if ( strncmp ( bsdNode, "/dev/rdisk", 10 ) == 0 )
	{
		 sprintf ( deviceName, "%s", bsdNode );
	}
	
	else if ( strncmp ( bsdNode, "/dev/disk", 9 ) == 0 )
	{
		sprintf ( deviceName, "%s", bsdNode );
	}
	
	else if ( strncmp ( bsdNode, "disk", 4 ) == 0 )
	{
		sprintf ( deviceName, "%s%s", "/dev/", bsdNode );
	}
	
	else
	{
		goto ErrorExit;
	}
	
	fileDescriptor = OpenMedia ( deviceName );
	require ( ( fileDescriptor > 0 ), ErrorExit );
	
	speed = GetSpeed ( fileDescriptor );
	printf ( "%s: speed = %d KB/s\n", deviceName, speed );
	
	CloseMedia ( fileDescriptor );
	
	
ErrorExit:
	
	
	return error;
	
}
Beispiel #5
0
EC_S32 EngOpenMedia(MediaEngineHandle handle, const char*pMediaPath, VideoScreen *pVideoScreen)
{
    return OpenMedia(handle,
                     (EC_CONST_PCHAR)pMediaPath,
                     (MediaEngVideoScreen*)pVideoScreen);
}