示例#1
0
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   // Create the tray icon
   TCHAR szHello[MAX_LOADSTRING];
   LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);

	if (!TrayIcon.Create(hInstance,
						hWnd,                            // Parent window
						WM_ICON_NOTIFY,                  // Icon notify message to use
						szHello,                         // tooltip
						::LoadIcon(hInstance, (LPCTSTR)IDI_APPICON),
						IDR_POPUP_MENU))
		return FALSE;

   //ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}
示例#2
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	if (!m_TrayIcon.Create(this, WM_ICON_NOTIFY, GUI_APP_CAPTION, theApp.LoadIcon(IDI_SMALL_PASS), IDR_MAINFRAME))
		return -1;

	theApp.SetTrayIcon();

	if(!m_TrayIcon.SetMenuDefaultItem(2,TRUE))
		return -1;
	
	DWORD dwFlags;
	if(InternetGetConnectedState(&dwFlags, 0))
		theApp.m_DownloadCommand.InitNetCommand();
	else
		SetTimer(1, 600000, NULL);

	if(!theApp.m_RegisterRequest.m_IsUploaded)
		SetTimer(2, 300000, NULL);

	// CG: The following line was added by the Splash Screen component.
	CSplashWnd::ShowSplashScreen(this);

	return 0;
}
示例#3
0
int CMainDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CPasseckDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_TrayIcon.Create(this, WM_ICON_NOTIFY, GUI_APP_CAPTION, theApp.LoadIcon(IDI_SMALL_PASS), IDR_MAINFRAME))
		return -1;

	if(!m_TrayIcon.SetMenuDefaultItem(0, TRUE))
		return -1;
	
	CSplashWnd::ShowSplashScreen(this);

	return 0;
}
示例#4
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	HWND hWnd;

	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	InitCtrls.dwICC = ICC_STANDARD_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	hInst = hInstance; // Store instance handle in our global variable

	hWnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_COMPOSITED, szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
	//hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
	hWndMain = hWnd;

	if (!hWnd)
	{
		return FALSE;
	}

	// Create the tray icon
	if (!TrayIcon.Create(hInstance,
		hWnd,                            // Parent window
		WM_ICON_NOTIFY,                  // Icon notify message to use
		_T("dhcpsv"),  // tooltip
		::LoadIcon(hInstance, (LPCTSTR)IDI_DHCPSVGUI),
		IDC_DHCPSVGUI)) 
		return FALSE;

	TrayIcon.SetIconList(IDI_ICON_GREEN, IDI_ICON_RED);

//	ShowWindow(hWnd, nCmdShow);
	ShowWindow(hWnd, SW_HIDE);
	UpdateWindow(hWnd);

	return TRUE;
}