BOOL CApp::InitInstance()
{
	hGlobalMutex = ::CreateMutex(NULL, TRUE, "GlobalMutex");

	switch(::GetLastError())
	{
		case ERROR_SUCCESS:
		{
			INITCOMMONCONTROLSEX initCtrls;

			initCtrls.dwSize = sizeof(initCtrls);
			initCtrls.dwICC = ICC_TAB_CLASSES;
			InitCommonControlsEx(&initCtrls);

			CMainDialog MainDialog(IDD_MAINDIALOG);
			m_pMainWnd = &MainDialog;
			MainDialog.DoModal();

			return TRUE;
		}

		case ERROR_ALREADY_EXISTS:
		{

			return FALSE;
		}

		default:
		{

			return FALSE;
		}
	}
}
Example #2
0
LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2)
{
// Must be included here!!!
    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    LPCPLINFO lpCPlInfo;

    DebugPrintf ((_T("CPlApplet called - uMsg= %d\n"),uMsg));

    switch (uMsg)
    {
    case CPL_INIT:		// first message, sent once
        return TRUE;

    case CPL_GETCOUNT:	// second message, sent once
        return 1;
        break;

    case CPL_INQUIRE:		// third message, sent once per application
        lpCPlInfo= (LPCPLINFO) lParam2;
        lpCPlInfo->lData= 0;	// Context returned with CPL_DLKCLK
        lpCPlInfo->idIcon= IDI_JOYSTICK;
        lpCPlInfo->idName= IDS_CPL_NAME;
        lpCPlInfo->idInfo= IDS_CPL_DESC;
        break;

    case CPL_DBLCLK:		// application icon double-clicked
    {
        CWnd			cwnd;

        cwnd.Attach(hwndCPl);

        CMainDialog	MainDialog(&cwnd);

        MainDialog.DoModal();

        cwnd.Detach();
    }
    break;

    case CPL_STOP:		// sent once per application before CPL_EXIT
        break;

    case CPL_EXIT:		// sent once before FreeLibrary is called
        break;

    default:
        break;
    }
    return 0;
}
// Do main dialog, return TRUE if canceled
BOOL DoMainDialog(BOOL &optionPlaceStructs, BOOL &optionProcessStatic, BOOL &optionOverwriteComments, BOOL &optionAudioOnDone, BOOL &optionClean, BOOL &optionFullClear)
{
    MainDialog dlg = MainDialog(optionPlaceStructs, optionProcessStatic, optionOverwriteComments, optionAudioOnDone, optionClean, optionFullClear);
    if (dlg.exec())
    {
        #define CHECKSTATE(obj,var) var = dlg.obj->isChecked()
        CHECKSTATE(checkBox1, optionPlaceStructs);
        CHECKSTATE(checkBox2, optionProcessStatic);
        CHECKSTATE(checkBox3, optionOverwriteComments);
        CHECKSTATE(checkBox4, optionAudioOnDone);
        CHECKSTATE(checkBox5, optionClean);
        CHECKSTATE(checkBox6, optionFullClear);
        #undef CHECKSTATE

        return(FALSE);
    }
    return(TRUE);
}
void ribi::sema::QtExtractDialog::on_button_load_clicked()
{
  const std::string filename
    = QFileDialog::getOpenFileName(
      0,"Please select an image to extract the message of",
      QString(),"*.png *.bmp").toStdString();
  if (filename.empty()) return;

  //Convert
  {
    const boost::shared_ptr<const QImage> source {
      new QImage(filename.c_str())
    };
    const boost::shared_ptr<const QImage> result {
      MainDialog().ExtractMessageRed(source)
    };
    QPixmap pixmap { QPixmap::fromImage(*result) };
    ui->label_result->setPixmap(pixmap);
  }
  ui->label_todo->hide();
}