Ejemplo n.º 1
0
int _tmain(int argc, _TCHAR* argv[])
{
	CreateTrayIcon();
	Sleep(1000000);
	system( "pause" );
	return 0;
}
Ejemplo n.º 2
0
void MainDialog::OnWindowInitialized(TNotifyUI& msg)
{
    module::getScreenCaptureModule()->initCapture(m_hWnd);
	module::getLoginModule()->addObserver(this, BIND_CALLBACK_2(MainDialog::MKOForLoginModuleCallBack));
	module::getUserListModule()->addObserver(this, BIND_CALLBACK_2(MainDialog::MKOForUserListModuleCallBack));
	module::getSessionModule()->addObserver(this, BIND_CALLBACK_2(MainDialog::MKOForSessionModuleCallBack));

	m_pbtnSysConfig = (CButtonUI*)m_PaintManager.FindControl(_T("sysconfig"));
	m_pbtnOnlineStatus = (CButtonUI*)m_PaintManager.FindControl(_T("onlineStatus"));
	m_pbtnMyFace = (CButtonUI*)m_PaintManager.FindControl(_T("myfacebtn"));
    m_pEditSignature = (CEditUI*)m_PaintManager.FindControl(_T("signature"));
	m_ptxtUname = (CTextUI*)m_PaintManager.FindControl(_T("unametxt"));
	m_pbtnClose = (CButtonUI*)m_PaintManager.FindControl(_T("closebtn"));
	m_pbtnMinMize = (CButtonUI*)m_PaintManager.FindControl(_T("minbtn"));

    m_pTextUnreadMsgCount = static_cast<CTextUI*>(m_PaintManager.FindControl(_T("msgCount")));
    PTR_VOID(m_pTextUnreadMsgCount);

    _FreshMySignature();

	if (m_ptxtUname)
	{
		CString strVersion;
		strVersion.Format(_T("V.%d"), TEAMTALK_VERSION);
		m_ptxtUname->SetToolTip(strVersion);
	}
	//加载图标
	LoadIcons();
	//创建系统托盘
	CreateTrayIcon();
	//初始化
	Initilize();
}
Ejemplo n.º 3
0
LRESULT CMainDlg::OnSend(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{  
  HWND     hWndEmail = GetDlgItem(IDC_EMAIL);
  HWND     hWndDesc = GetDlgItem(IDC_DESCRIPTION);
  int      nEmailLen = ::GetWindowTextLength(hWndEmail);
  int      nDescLen = ::GetWindowTextLength(hWndDesc);

  LPTSTR lpStr = m_sEmailFrom.GetBufferSetLength(nEmailLen+1);
  ::GetWindowText(hWndEmail, lpStr, nEmailLen+1);
  m_sEmailFrom.ReleaseBuffer();

  lpStr = m_sDescription.GetBufferSetLength(nDescLen+1);
  ::GetWindowText(hWndDesc, lpStr, nDescLen+1);
  m_sDescription.ReleaseBuffer();

  //
  // If an email address was entered, verify that
  // it [1] contains a @ and [2] the last . comes
  // after the @.
  //
  if (m_sEmailFrom.GetLength() &&
      (m_sEmailFrom.Find(_T('@')) < 0 ||
       m_sEmailFrom.ReverseFind(_T('.')) < m_sEmailFrom.Find(_T('@'))))
  {
     // alert user
     TCHAR szBuf[256];
     ::LoadString(_Module.GetResourceInstance(), IDS_INVALID_EMAIL, szBuf, 255);
     MessageBox(szBuf, _T("Invalid E-mail address"), MB_OK);
     
     // select email
     ::SetFocus(hWndEmail);

     return 0;
  }

  // Write user email and problem description to XML
  AddUserInfoToCrashDescriptorXML(m_sEmailFrom, m_sDescription);
  
  m_ctx.m_sAppName = m_sAppName;
  m_ctx.m_sAppVersion = m_sAppVersion;
  m_ctx.m_sZipName = m_sZipName;
  m_ctx.m_sEmailTo = m_sEmailTo;
  m_ctx.m_sEmailFrom = m_sEmailFrom;
  m_ctx.m_sEmailSubject = m_sEmailSubject;
  m_ctx.m_sEmailText = m_sDescription;
  m_ctx.m_sUrl = m_sUrl;
  memcpy(&m_ctx.m_uPriorities, &m_uPriorities, 3*sizeof(UINT));

  DWORD dwThreadId = 0;
  m_hSenderThread = CreateThread(NULL, 0, SenderThread, (LPVOID)&m_ctx, NULL, &dwThreadId);

  ShowWindow(SW_HIDE);
  CreateTrayIcon(true, m_hWnd);
  m_dlgProgress.m_pctx = &m_ctx;
  m_dlgProgress.Start();    
  SetTimer(0, 500);
    
  return 0;
}
Ejemplo n.º 4
0
LRESULT CErrorReportDlg::OnSend(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{  
    HWND     hWndEmail = GetDlgItem(IDC_EMAIL);
    HWND     hWndDesc = GetDlgItem(IDC_DESCRIPTION);
    int      nEmailLen = ::GetWindowTextLength(hWndEmail);
    int      nDescLen = ::GetWindowTextLength(hWndDesc);

    LPTSTR lpStr = g_CrashInfo.GetReport(0).m_sEmailFrom.GetBufferSetLength(nEmailLen+1);
    ::GetWindowText(hWndEmail, lpStr, nEmailLen+1);
    g_CrashInfo.GetReport(0).m_sEmailFrom.ReleaseBuffer();

    lpStr = g_CrashInfo.GetReport(0).m_sDescription.GetBufferSetLength(nDescLen+1);
    ::GetWindowText(hWndDesc, lpStr, nDescLen+1);
    g_CrashInfo.GetReport(0).m_sDescription.ReleaseBuffer();

    //
    // If an email address was entered, verify that
    // it [1] contains a @ and [2] the last . comes
    // after the @.
    //

    if (g_CrashInfo.GetReport(0).m_sEmailFrom.GetLength() &&
        (g_CrashInfo.GetReport(0).m_sEmailFrom.Find(_T('@')) < 0 ||
        g_CrashInfo.GetReport(0).m_sEmailFrom.ReverseFind(_T('.')) < 
        g_CrashInfo.GetReport(0).m_sEmailFrom.Find(_T('@'))))
    {
        DWORD dwFlags = 0;
        CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading"));
        if(sRTL.CompareNoCase(_T("1"))==0)
            dwFlags = MB_RTLREADING;

        // alert user     
        MessageBox(
            Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("InvalidEmailText")), 
            Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("InvalidEmailCaption")), 
            MB_OK|dwFlags);

        // select email
        ::SetFocus(hWndEmail);

        return 0;
    }

    // Write user email and problem description to XML
    g_CrashInfo.AddUserInfoToCrashDescriptionXML(
        g_CrashInfo.GetReport(0).m_sEmailFrom, g_CrashInfo.GetReport(0).m_sDescription);

    ShowWindow(SW_HIDE);
    CreateTrayIcon(true, m_hWnd);
    g_ErrorReportSender.SetExportFlag(FALSE, _T(""));
    g_ErrorReportSender.DoWork(COMPRESS_REPORT|RESTART_APP|SEND_REPORT);
    m_dlgProgress.Start(FALSE);    
    SetTimer(0, 500);

    // Notify user has confirmed error report submission
    g_ErrorReportSender.FeedbackReady(0);

    return 0;
}
Ejemplo n.º 5
0
void CErrorReportDlg::CloseDialog(int nVal)
{
    // Remove tray icon  
    CreateTrayIcon(FALSE, m_hWnd);

    DestroyWindow();
    ::PostQuitMessage(nVal);
}
Ejemplo n.º 6
0
LRESULT CErrorReportDlg::OnSendClick(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{  
	// This method is called when user clicks the "Send Report" button
	    
	TCHAR szBuffer[1024] = _T("");
    CString sEmail;	
	CString sDesc;
	// Get E-mail field's text
	m_editEmail.GetWindowText(szBuffer, 1024);	
	sEmail = szBuffer;
	// Get description field's text
	m_editDesc.GetWindowText(szBuffer, 1024);
	sDesc = szBuffer;
		
	// Update those fields in crash report data and check the result
    CErrorReportSender* pSender = CErrorReportSender::GetInstance();
	if(!pSender->GetCrashInfo()->UpdateUserInfo(sEmail, sDesc))
	{
		// Failure - display alert message and repeat again

		// Check window mirroring settings
        DWORD dwFlags = 0;
		CString sRTL = pSender->GetLangStr(_T("Settings"), _T("RTLReading"));
        if(sRTL.CompareNoCase(_T("1"))==0)
            dwFlags = MB_RTLREADING;

        // Alert user     
        MessageBox(
			pSender->GetLangStr(_T("MainDlg"), _T("InvalidEmailText")), 
            pSender->GetLangStr(_T("MainDlg"), _T("InvalidEmailCaption")), 
            MB_OK|dwFlags);

        // Set focus to Email field
        ::SetFocus(m_editEmail);

		return 0;
	}
	
	/* Now we are ready to send error report in background. */

	// Hide the dialog
    ShowWindow(SW_HIDE);

	// Display tray icon
    CreateTrayIcon(true, m_hWnd);
    
	// Show progress dialog
	m_dlgProgress.Start(FALSE);        

	// Run worker thread that will compress and send error report.
	pSender->Run();
    
    return 0;
}
Ejemplo n.º 7
0
void CErrorReportDlg::CloseDialog(int nVal)
{
    // Remove tray icon.  
    CreateTrayIcon(FALSE, m_hWnd);

	// Destroy window
    DestroyWindow();

	// Exit the message loop
    ::PostQuitMessage(nVal);
}
Ejemplo n.º 8
0
void COutputDialog::OnSysCommand(UINT nID, LPARAM lParam)
{
	// 최소화 버튼을 눌렀을때
	if(nID == SC_MINIMIZE && m_chkTrayMin.GetCheck())
	{ 
		CreateTrayIcon();
		ShowWindow(SW_HIDE);
		return;
	}

	CDialog::OnSysCommand(nID, lParam);
}
Ejemplo n.º 9
0
void MainDialog::OnWindowInitialized(TNotifyUI& msg)
{
	m_pbtnSysConfig = (CButtonUI*)m_PaintManager.FindControl(_T("sysconfig"));
	m_pbtnOnlineStatus = (CButtonUI*)m_PaintManager.FindControl(_T("onlineStatus"));
	m_pbtnMyFace = (CButtonUI*)m_PaintManager.FindControl(_T("myfacebtn"));
	m_ptxtUname = (CTextUI*)m_PaintManager.FindControl(_T("unametxt"));
	m_pbtnClose = (CButtonUI*)m_PaintManager.FindControl(_T("closebtn"));
	m_pbtnMinMize = (CButtonUI*)m_PaintManager.FindControl(_T("minbtn"));
	//加载图标
	LoadIcons();
	//创建系统托盘
	CreateTrayIcon();
	//初始化
	Initilize();
}
Ejemplo n.º 10
0
Window::Window()
  : mUI( new Ui::Window )
{
  mUI->setupUi( this );

  setWindowTitle( qApp->applicationName() );

  CreateActions();
  CreateTrayIcon();

  connect( mTrayIcon, SIGNAL( activated(QSystemTrayIcon::ActivationReason) ), this, SLOT( TrayIconActivated(QSystemTrayIcon::ActivationReason) ) );
  connect( &mCore, SIGNAL( HandleGameClientRestartRequired(bool) ), this, SLOT( HandleGameClientRestartRequired(bool) ) );

  QTimer::singleShot( 1000, this, SLOT(HandleFirstStartCheck()) );
}
Ejemplo n.º 11
0
LauncherForm::LauncherForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::LauncherForm)
{
    ui->setupUi(this);

    pop_up_needed_.setKey("4668074d-98a4-4052-b8fb-0a3a7a84905c");
    pop_up_needed_.create(1);

    connect(&kv_process_, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
            this, &LauncherForm::onProcessEnd);
    connect(&timer_, &QTimer::timeout, this, &LauncherForm::checkSharedMemory);

    timer_.start(300);
    setWindowFlags(Qt::SubWindow);
    CreateTrayIcon();
}
Ejemplo n.º 12
0
void WinConsole::Run()
{
	if (!m_appMode || m_addParam)
	{
		return;
	}

	CreateTrayIcon();

	LoadPrefs();
	ApplyPrefs();

	BuildMenu();

	if (m_showWebUI && !m_autoParam && mayStartBrowser)
	{
		ShowWebUI();
	}
	mayStartBrowser = false;

	int counter = 0;
	while (!IsStopped())
	{
		MSG msg;
		if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			usleep(20 * 1000);
			counter += 20;
			if (counter >= 200)
			{
				UpdateTrayIcon();
				counter = 0;
			}
		}
	}

	Shell_NotifyIcon(NIM_DELETE, m_iconData);
}
Ejemplo n.º 13
0
int main(int argc, char *argv[]) {
	Gio gio;

	gtk_init(&argc, &argv);
	gio->monitor = g_volume_monitor_get();

    g_signal_connect(gio->monitor , "volume-added", G_CALLBACK(on_volume_connected), gio);
    g_signal_connect(gio->monitor , "volume-removed", G_CALLBACK(on_volume_disconnected), gio);
    g_signal_connect(gio->monitor , "mount-added", G_CALLBACK(on_volume_mounted), gio);
    g_signal_connect(gio->monitor , "mount-removed", G_CALLBACK(on_volume_unmounted), gio);
	icon_size = gtk_icon_size_register ("",18,18);
	g_timeout_add(1000, (GSourceFunc) TimerFuncReturnStatusIcon, response_widget);
	tray_icon = CreateTrayIcon();

	mountray_init(gio);

	gtk_main();
    return 0;
}
Ejemplo n.º 14
0
Window::Window()
    : mUI( new Ui::Window )
{
    mUI->setupUi( this );

    setWindowTitle( qApp->applicationName() );

    CreateActions();
    CreateTrayIcon();

    connect( mTrayIcon, SIGNAL( activated(QSystemTrayIcon::ActivationReason) ), this, SLOT( TrayIconActivated(QSystemTrayIcon::ActivationReason) ) );
    connect( &mCore, SIGNAL( HandleGameClientRestartRequired(bool) ), this, SLOT( HandleGameClientRestartRequired(bool) ) );

#ifdef Q_WS_WIN
    // Notify user the first time that the app runs in the taskbar
    QSettings settings;
    if( !settings.contains("taskbarHint") ) {
        settings.setValue( "taskbarHint", true );
        mTrayIcon->showMessage( tr( "Heads up!" ), "Track-o-Bot runs in your taskbar! Right click the icon for more options." );
    }
#endif
}
Ejemplo n.º 15
0
bool CTrayIcon::CreateTrayBallon(SString strText, eTrayIconType trayIconType, bool useSound)
{
    if (!m_bTrayIconExists)
        if (!CreateTrayIcon())
            return false;

    auto currentTime = GetTickCount64_();

    if ((currentTime - m_llLastBalloonTime) < TRAY_BALLOON_INTERVAL)
        return false;
    else
        m_llLastBalloonTime = currentTime;

    m_pNID->dwInfoFlags = 0;
    m_pNID->uFlags = NIF_ICON | NIF_TIP | NIF_INFO;
    StringCchCopyW(m_pNID->szInfo, ARRAYSIZE(m_pNID->szInfo), SharedUtil::MbUTF8ToUTF16(strText).c_str());

    switch (trayIconType)
    {
        case ICON_TYPE_INFO:
            m_pNID->dwInfoFlags |= NIIF_INFO;
            break;
        case ICON_TYPE_WARNING:
            m_pNID->dwInfoFlags |= NIIF_WARNING;
            break;
        case ICON_TYPE_ERROR:
            m_pNID->dwInfoFlags |= NIIF_ERROR;
            break;
        case ICON_TYPE_DEFAULT:
        default:
            break;
    }

    if (!useSound)
        m_pNID->dwInfoFlags |= NIIF_NOSOUND;

    return Shell_NotifyIconW(NIM_MODIFY, m_pNID) == TRUE;
}
Ejemplo n.º 16
0
LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg){
	case WM_WTSSESSION_CHANGE:
		if (wParam == WTS_SESSION_LOCK && g_wMaskAdv & OPT_HIDEIFLOCK && !g_bWindowHidden) // Windows locked
			PostMessage(hWnd,WM_USER + 40, 0, 0);
		return 0;

	case WM_USER + 24:
		if (lParam == WM_LBUTTONDBLCLK)
			PostMessage(hWnd,WM_USER + 52, 0, 0);
		return 0;

	case WM_USER+40: // hide
		{
			if (g_bWindowHidden || g_fOptionsOpen) // already hidden or in options, no hiding
				break;

			DWORD dwWndPID; // remember foreground window
			HWND hForegroundWnd = GetForegroundWindow();
			GetWindowThreadProcessId(hForegroundWnd,&dwWndPID);
			if (g_dwMirandaPID == dwWndPID)
				hOldForegroundWindow = hForegroundWnd;

			EnumWindows(EnumWindowsProc, 0);

			if (g_wMask & OPT_CHANGESTATUS) // is this even needed?
			{
				BYTE bReqMode = db_get_b(NULL, MOD_NAME, "stattype", 2);
				unsigned uMode = (STATUS_ARR_TO_ID[bReqMode]);
				DBVARIANT dbVar;
				if (g_wMask & OPT_USEDEFMSG || db_get_ts(NULL,MOD_NAME,"statmsg",&dbVar))
				{
					TCHAR *ptszDefMsg = GetDefStatusMsg(uMode, 0);
					ChangeAllProtoStatuses(uMode, ptszDefMsg);
					mir_free(ptszDefMsg);
				}
				else
				{
					if (ServiceExists(MS_VARS_FORMATSTRING))
					{
						TCHAR *ptszParsed = variables_parse(dbVar.ptszVal, 0, 0);
						ChangeAllProtoStatuses(uMode, ptszParsed);
						mir_free(ptszParsed);
					}
					else
						ChangeAllProtoStatuses(uMode, dbVar.ptszVal);
					db_free(&dbVar);
				}
			}

			pcli->pfnTrayIconDestroy (pcli->hwndContactList);
			pcli->pfnUninitTray();

			if (g_wMask & OPT_TRAYICON)
				CreateTrayIcon(true);

			// disable popups
			if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1)
			{
				// save current
				g_bOldSetting |= OLD_POPUP;
				CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
			}

			// disable sounds
			if ((g_wMask & OPT_DISABLESNDS) && db_get_b(NULL,"Skin","UseSound",1))
			{
				// save current
				g_bOldSetting |= OLD_SOUND;
				db_set_b(NULL,"Skin","UseSound",0);
			}

			g_bWindowHidden = true;

			g_bOldSetting |= OLD_WASHIDDEN;
			db_set_b(NULL, MOD_NAME, "OldSetting", g_bOldSetting);
		}
		return 0;

	case WM_USER+52: // back
		{
			if (!g_bWindowHidden || g_fPassRequested)
				break;

			if (g_wMask & OPT_REQPASS){  //password request
				DBVARIANT dbVar;
				if (!db_get_s(NULL,MOD_NAME, "password", &dbVar)) {
					g_fPassRequested = true;

					strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
					db_free(&dbVar);

					int res = DialogBox(g_hInstance,(MAKEINTRESOURCE(IDD_PASSDIALOGNEW)),GetForegroundWindow(), DlgStdInProc);

					g_fPassRequested = false;
					if(res != IDOK) return 0;
				}
			}

			if (g_wMask & OPT_CHANGESTATUS && g_wMask & OPT_SETONLINEBACK) // set back to some status
				BackAllProtoStatuses();

			HWND_ITEM *pCurWnd = g_pMirWnds;
			while (pCurWnd != NULL)
			{
				HWND_ITEM *pNextWnd = pCurWnd->next;
				TCHAR szTemp[32];
				GetClassName(pCurWnd->hWnd,szTemp,32);

				if (IsWindow(pCurWnd->hWnd) && lstrcmp(szTemp,_T("SysShadow")) != 0) // precaution
					ShowWindow(pCurWnd->hWnd, SW_SHOW);

				delete pCurWnd; // bye-bye
				pCurWnd = pNextWnd; // traverse to next item
			}
			g_pMirWnds = NULL;

			if (hOldForegroundWindow)
			{
				SetForegroundWindow(hOldForegroundWindow);
				hOldForegroundWindow = NULL;
			}

			RestoreOldSettings();

			if (g_TrayIcon) CreateTrayIcon(false);

			pcli->pfnInitTray();
			pcli->pfnTrayIconInit(pcli->hwndContactList);

			// force a redraw
			// should prevent drawing problems
			InvalidateRect(pcli->hwndContactList,NULL,true);
			UpdateWindow(pcli->hwndContactList);

			PostMessage(hWnd, WM_MOUSEMOVE, 0, (LPARAM)MAKELONG(2, 2)); // reset core's IDLE
			g_bWindowHidden = false;

			db_set_b(NULL, MOD_NAME, "OldSetting", 0);
		}
		return 0;
	}
	return(DefWindowProc(hWnd, uMsg, wParam, lParam));
}
Ejemplo n.º 17
0
void AutoIt_App::Run(void)
{
	char	szOldWorkingDir[_MAX_PATH+1];
	char	szTempFileName[_MAX_PATH+1];


	// Parse the command line options (get scriptname, reveal mode, single cmd, etc.)
	ParseCmdLine();

	// If we are in single command mode (/c) then manually add a line of script, otherwise
	// load a script
	if (m_bSingleCmdMode == true)
	{
		// Create a "loaded" script that contains a single line - cunning eh? :)
		//MessageBox(NULL, m_sSingleLine.c_str(), "", MB_OK);

		g_oScriptFile.AddLine(1, m_sSingleLine.c_str(), -1);
	}
	else
	{
		// Check that we can load the script file.  Returns the FULLPATH of the script loaded
		if (g_oScriptFile.LoadScript(m_szScriptFileName) == false)
		{
			g_nExitCode = 1;						// Main exit code
			return;									// Error loading script
		}
		else
			GetFullPathName(m_szScriptFileName, _MAX_PATH, szTempFileName, &m_szScriptFilePart);
	}

	// Prepare the script for use
	g_oScriptFile.PrepareScript();

	// Perform initial check of the script (check userfunctions, etc)
	if (g_oScript.InitScript(m_szScriptFileName) != AUT_OK)
	{
		g_oScriptFile.UnloadScript();
		g_nExitCode = 1;						// Main exit code
		return;									// Error initialising script
	}

	// Save the current working directory
	GetCurrentDirectory(_MAX_PATH, szOldWorkingDir);

	// Register our classes (including the GUI class) and create the main windows
	RegisterClass();
	WindowCreate();

	// Show the tray icon if required
	if (g_bTrayIconInitial == true)
		CreateTrayIcon();


	// Run the script from line 1, the Execute() function will run the windows message queue
	g_oScript.Execute(1);

	// Unload the script (even if one wasn't loaded - this is OK)
	g_oScriptFile.UnloadScript();

	// Restore the old working directory
	SetCurrentDirectory(szOldWorkingDir);

} // Run()
Ejemplo n.º 18
0
LRESULT CErrorReportDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{  
  CreateTrayIcon(FALSE, m_hWnd);
  CloseDialog(0);  
  return 0;
}
Ejemplo n.º 19
0
LRESULT CMainDlg::OnSend(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{  
  HWND     hWndEmail = GetDlgItem(IDC_EMAIL);
  HWND     hWndDesc = GetDlgItem(IDC_DESCRIPTION);
  int      nEmailLen = ::GetWindowTextLength(hWndEmail);
  int      nDescLen = ::GetWindowTextLength(hWndDesc);

  LPTSTR lpStr = g_CrashInfo.m_sEmailFrom.GetBufferSetLength(nEmailLen+1);
  ::GetWindowText(hWndEmail, lpStr, nEmailLen+1);
  g_CrashInfo.m_sEmailFrom.ReleaseBuffer();

  lpStr = g_CrashInfo.m_sDescription.GetBufferSetLength(nDescLen+1);
  ::GetWindowText(hWndDesc, lpStr, nDescLen+1);
  g_CrashInfo.m_sDescription.ReleaseBuffer();

  //
  // If an email address was entered, verify that
  // it [1] contains a @ and [2] the last . comes
  // after the @.
  //
  if (g_CrashInfo.m_sEmailFrom.GetLength() &&
      (g_CrashInfo.m_sEmailFrom.Find(_T('@')) < 0 ||
       g_CrashInfo.m_sEmailFrom.ReverseFind(_T('.')) < g_CrashInfo.m_sEmailFrom.Find(_T('@'))))
  {
    DWORD dwFlags = 0;
    CString sRTL = Utility::GetINIString(_T("Settings"), _T("RTLReading"));
    if(sRTL.CompareNoCase(_T("1"))==0)
      dwFlags = MB_RTLREADING;
  
     // alert user     
     MessageBox(
       Utility::GetINIString(_T("MainDlg"), _T("InvalidEmailText")), 
       Utility::GetINIString(_T("MainDlg"), _T("InvalidEmailCaption")), 
       MB_OK|dwFlags);
     
     // select email
     ::SetFocus(hWndEmail);

     return 0;
  }

  // Write user email and problem description to XML
  AddUserInfoToCrashDescriptorXML(g_CrashInfo.m_sEmailFrom, g_CrashInfo.m_sDescription);
  
  m_ctx.m_sAppName = g_CrashInfo.m_sAppName;
  m_ctx.m_sAppVersion = g_CrashInfo.m_sAppVersion;
  m_ctx.m_sErrorReportDirName = g_CrashInfo.m_sErrorReportDirName;
  m_ctx.m_sEmailTo = g_CrashInfo.m_sEmailTo;
  m_ctx.m_sEmailFrom = g_CrashInfo.m_sEmailFrom;
  m_ctx.m_sEmailSubject = g_CrashInfo.m_sEmailSubject;
  m_ctx.m_sEmailText = g_CrashInfo.m_sDescription;
  m_ctx.m_sUrl = g_CrashInfo.m_sUrl;
  memcpy(&m_ctx.m_uPriorities, &g_CrashInfo.m_uPriorities, 3*sizeof(UINT));

  DWORD dwThreadId = 0;
  m_hSenderThread = CreateThread(NULL, 0, SenderThread, (LPVOID)&m_ctx, NULL, &dwThreadId);

  ShowWindow(SW_HIDE);
  CreateTrayIcon(true, m_hWnd);
  m_dlgProgress.m_pctx = &m_ctx;
  m_dlgProgress.Start(FALSE);    
  SetTimer(0, 500);
    
  return 0;
}
Ejemplo n.º 20
0
LRESULT AutoIt_App::WndProcHandler (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	static UINT s_uTaskbarRestart;				// Holds taskbar recreate message

	// What window is the message for? (note, g_hWnd may be NULL during startup WM_CREATE)
	if (hWnd == g_hWnd || g_hWnd == NULL)
	{
		//
		// Main window messages
		//

		switch (iMsg)
		{
			// Window initial creation
			case WM_CREATE:
				AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: WM_CREATE\n")

				// Start the main timer used for flashing the "pause" icon
				SetTimer(hWnd, AUT_MAIN_TIMER_ID, AUT_MAIN_TIMER_DELAY, NULL);

				// Register a message so we know if explorer crashes and we have to redraw taskbar
				s_uTaskbarRestart = RegisterWindowMessage("TaskbarCreated");

				return 0;

			// Some form of timer has been triggered - check it out
			case WM_TIMER:
				HandleTimer(hWnd, wParam, lParam);

				return 0;

			// Menu command received
			case WM_COMMAND:
				if (HandleCommand(hWnd, iMsg, wParam, lParam) == true)
					 return 0;                              // completely handled
				break;

			// Window close clicked, if this returns 0 then user will be prevented from closing
			case WM_CLOSE:
				AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: WM_CLOSE\n")

				// Notify the script that close was requested but DON'T allow the system to continue
				// with the defaut WM_CLOSE - we will call DestroyWindow() ourselves from the script
				g_bTrayExitClicked = true;
				g_bKillWorkerThreads = true;			// Ask worker threads to stop (otherwise the script
														// may be blocked - e.g InetGet on a big download)
				//break;
				return 0;

				// Window is being destroyed
			case WM_DESTROY:
				AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: WM_DESTROY\n")

				KillTimer(hWnd, AUT_MAIN_TIMER_ID);		// Remove any timers in use
				DestroyTrayIcon();						// Remove tray icon if present
				PostQuitMessage(0);						// Tell the message loop to stop
				return 0;

			// Window is getting focus
			case WM_SETFOCUS:
				SetFocus(g_hWndEdit);                         // Put focus on the main edit window
				return 0;

			// Window has been resized in some way
			case WM_SIZE:
				MoveWindow(g_hWndEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
				return 0;

			// Popup menu accessed
			case AUT_WM_NOTIFYICON:
				NotifyIcon(hWnd, iMsg, wParam, lParam);
				return 0;

			case WM_HOTKEY:                                        // Ignore when paused
				if (!g_bScriptPaused)
				{
					 g_HotKeyQueue[g_HotKeyNext++] = wParam;     // Store the hotkey ID pressed
					 if (g_HotKeyNext >= AUT_HOTKEYQUEUESIZE)
						  g_HotKeyNext = 0;
				}

				//MessageBox(NULL, "", "Hotkey pressed", MB_OK);
				break;

			default:
				// If the icon was visible and explorer crashed then redraw
				if(iMsg == s_uTaskbarRestart && g_bTrayIcon == true)
				{
					AUT_DEBUGMSG("==> AutoIt_App::WndProc, g_hWnd: TaskbarRestart received - redrawing trayicon\n")
					DestroyTrayIcon();
					CreateTrayIcon();
				}
				break;

		} // end main switch

	}

	// If not handled, return the default
	return DefWindowProc(hWnd, iMsg, wParam, lParam);

} // WndProcHandler()
Ejemplo n.º 21
0
SjMainWindow::SjMainWindow(QWidget *parent) :
	//QDialog(parent),
	QMainWindow(parent),
	ui(new Ui::SjMainWindow)
	, _ConnectAfterLogin(false)
	, _fixed(false)
	, _activatedcount(0)
	, _wifi_processing(false)
	, _moving(false)
{
	ui->setupUi(this);
	setWindowFlags(Qt::Dialog);
	setFixedSize(this->size());

	ui->b_Cancel->hide();

#ifndef Q_OS_MAC
	FontHelper::SetFont(this);
	ui->eLogin->setFont(FontHelper::pt(14));
	ui->ePsw->setFont(FontHelper::pt(14));
	
	ui->menuBar->setVisible(false);
#endif

	ui->eLogin->setAttribute(Qt::WA_MacShowFocusRect, 0);
	ui->ePsw->setAttribute(Qt::WA_MacShowFocusRect, 0);

	ui->L_Version->setText(QString("v ") + SJ_VERSION + ", build " + QString::number(SJ_BUILD_NUM) );

	CreateTrayIcon();
	_TrayIcon->show();

	connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(ac_StdQuit()));

	{
		SETTINGS_OBJ;
		if (settings.contains("pos"))
		{
			QPoint p = settings.value("pos").toPoint();
			WndManager::Instance()->trans(p, this);
		}
//		_WndStart = pos();
		ui->cb_Rememberme->setChecked(settings.value("cb_Rememberme", true).toBool());

		if (ui->cb_Rememberme->isChecked())
		{
			if (settings.contains("eLogin"))
				ui->eLogin->setText(settings.value("eLogin", "").toString());
			if (settings.contains("ePsw"))
				ui->ePsw->setText(settings.value("ePsw", "").toString());
		}
	}

	StatusDisconnected();

	if (!ui->eLogin->text().isEmpty() && ui->ePsw->text().isEmpty())
		ui->ePsw->setFocus();
	else
		ui->eLogin->setFocus();
	DisableButtonsOnLogout();

//	WndManager::DoShape(this);

	QTimer::singleShot(210, this, SLOT(Timer_Constructed()));
}