Exemple #1
0
int main( int argc, char **argv )
{
	LCUI_Widget w, root, text;
	LCUI_Graph desktop_image;

	InitConsoleWindow();
	LCUI_Init();
	LCUIDisplay_SetMode( LDM_WINDOWED );
	LCUIDisplay_SetSize( 960, 540 );
	w = LCUIWidget_New("debug-widget");
	text = LCUIWidget_New("textview");
	Widget_Append( w, text );
	TextView_SetTextW( text, L"测试文本内容,呵呵达!\nABCDEFG,abcdefg,[color=#ff0000]color font[/color]");
	Widget_Top( w );
	Widget_Show( w );
	Widget_Resize( w, 320, 240 );
	Widget_Move( w, 200, 200 );
	Widget_SetTitleW( w, L"测试" );
	Graph_Init( &desktop_image );
	Graph_LoadImage( "images/background-image.png", &desktop_image );
	root = LCUIWidget_GetRoot();

	Widget_PullStyle( root, WSS_BACKGROUND );
	root->style.background.color = RGB(255,242,223);
	root->style.background.image = desktop_image;
	root->style.background.size.using_value = TRUE;
	root->style.background.size.value = SV_COVER;
	Widget_PushStyle( root, WSS_BACKGROUND );

	Widget_PullStyle( w, WSS_BACKGROUND | WSS_SHADOW | WSS_BORDER );
	w->style.background.color.value = 0xccffffff;
	w->style.background.size.w.scale = 0.50; 
	w->style.background.size.h.px = 200;
	w->style.background.size.w.type = SVT_SCALE;
	w->style.background.size.h.type = SVT_PX;
	w->style.background.size.using_value = FALSE;
	w->style.background.position.using_value = TRUE;
	w->style.background.position.value = SV_BOTTOM_CENTER;
	w->style.shadow.color = ARGB(200,0,122,204);
	w->style.shadow.x = 2;
	w->style.shadow.y = 2;
	w->style.shadow.spread = 0;
	w->style.shadow.blur = 8;
	w->style.border.top.width = 1;
	w->style.border.right.width = 1;
	w->style.border.bottom.width = 1;
	w->style.border.left.width = 1;
	w->style.border.top.color = RGB(0,122,204);
	w->style.border.right.color = RGB(0,122,204);
	w->style.border.bottom.color = RGB(0,122,204);
	w->style.border.left.color = RGB(0,122,204);
	Widget_PushStyle( w, WSS_BACKGROUND | WSS_SHADOW | WSS_BORDER );
	//LCUITimer_Set( 5000, onTimer, NULL, TRUE );
	return LCUI_Main();
}
Exemple #2
0
BOOL CmmlToolApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	AfxEnableControlContainer();


	if(!AfxOleInit())
	{
		printf("%s", "初始化com失败");
		return FALSE;
	}

	//初始化调试窗口
	InitConsoleWindow();
	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	//SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	CmmlToolDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
Exemple #3
0
int main( int argc, char **argv )
{
	LCUI_Widget root, box;
	
#ifdef LCUI_BUILD_IN_WIN32
	InitConsoleWindow();
#endif
	LCUI_Init();
	LCUIDisplay_SetMode( LDM_WINDOWED );
	LCUIDisplay_SetSize( 960, 540 );
	box = LCUIBuilder_LoadFile("hello.xml");
	if( box ) {
		root = LCUIWidget_GetRoot();
		Widget_Append( root, box );
		Widget_Unwrap( &box );
	}
	return LCUI_Main();
}
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	g_hInstance = hInstance;


	LogString( "vmpi_service_ui startup.\n" );

	// Don't run multiple instances.	
	HANDLE hMutex = CreateMutex( NULL, FALSE, "vmpi_service_ui_mutex" );
	if ( hMutex && GetLastError() == ERROR_ALREADY_EXISTS )
		return 1;


	// Hook spew output.
	SpewOutputFunc( MySpewOutputFunc );
	InitConsoleWindow();
	LogString( "Setup console window.\n" );

	LoadStateFromRegistry();

	// Setup the popup menu.
	if( !LoadPopupMenu() )
	{
		return false;
	}
	UpdatePopupMenuState();


	// Setup the tray icon.
	Msg( "Waiting for jobs...\n" );
	if ( !g_ShellIconMgr.Init( &g_ShellIconMgrHelper, g_pIconTooltip, MYWM_NOTIFYICON, IDI_WAITING_ICON ) )
	{
		return false;
	}


	// Connect to the VMPI service.
	g_ConnMgr.InitClient();

	LogString( "Entering main loop.\n" );
	
	while ( 1 )
	{
		MSG msg;
		msg.message = !WM_QUIT;	// So it doesn't accidentally exit.
		while ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
		{
			if ( msg.message == WM_QUIT )
				break;
			
			TranslateMessage( &msg );
			DispatchMessage( &msg );
		}
		if ( msg.message == WM_QUIT )
			break;
	
		g_ConnMgr.Update();
		if ( !g_ConnMgr.IsConnected() )
		{
			g_ShellIconMgr.ChangeIcon( IDI_UNCONNECTED );
		}

		Sleep( 30 );
	}

	// Important that we call this instead of letting the destructor do it because it deletes its 
	// socket and it needs to cleanup some threads.
	g_ConnMgr.Term();
	
	g_ShellIconMgr.Term();
	
	return 0;
}
BOOL CFileManagerApp::InitInstance()
{
	// InitCommonControls() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	InitCommonControls();

	CWinApp::InitInstance();
#if CONSOLE_WND
	InitConsoleWindow();
#endif

	AfxEnableControlContainer();
	LogTools::InitZToolsLog();
	CCrashHandler ch;
	ch.SetProcessExceptionHandlers();
	ch.SetThreadExceptionHandlers();

	globalData.SetDPIAware ();
	ProcessCmd();
	HANDLE hMetux = CreateMutex(NULL,TRUE,"FileManager_Sqlite3");
	if (hMetux)
	{
		if(ERROR_ALREADY_EXISTS==GetLastError())
		{
			CloseHandle(hMetux);
			CWnd * pDeskTopWnd = CWnd::GetDesktopWindow();
			CWnd *pFind = pDeskTopWnd->GetWindow(GW_CHILD);
			while(pFind)
			{
				if (::GetProp(pFind->m_hWnd,m_pszExeName))
				{
					if (::IsIconic(pFind->m_hWnd))
						pFind->ShowWindow(SW_RESTORE); // 如果主窗口已经最小话,则恢复其大小
					pFind->ShowWindow(SW_SHOW);
					pFind->SetForegroundWindow();
					::SetForegroundWindow(::GetLastActivePopup(pFind->m_hWnd));
					return FALSE; // 前一个运行实例已经存在,退出本实例
				}
				pFind = pFind->GetWindow(GW_HWNDNEXT);
			}
		}
	}

	CFileManagerDlg dlg;
	dlg.m_bRunAtBack = m_bRunAtBack;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	BCGCBProCleanUp ();
	CloseHandle(hMetux);
	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}