Exemple #1
0
void KPR_system_alert(xsMachine* the)
{
	int argc = xsToInteger(xsArgc);
	MSGBOXPARAMSW params;
	xsStringValue string;
	xsIntegerValue result;
	xsVars(1);
	params.cbSize = sizeof(params);
	params.hwndOwner = NULL;
	params.hInstance = FskMainGetHInstance();
	params.lpszText = NULL;
	params.lpszCaption = xsStringToWideString("Kinoma Code");
	params.dwStyle = MB_ICONSTOP;
	params.dwContextHelpId = 0;
	params.lpfnMsgBoxCallback = NULL;
	params.dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
	if ((argc > 0) && xsTest(xsArg(0))) {
		if (xsFindString(xsArg(0), xsID_type, &string)) {
			if (!FskStrCompare(string, "about"))
				params.dwStyle = MB_ICONINFORMATION;
			else if (!FskStrCompare(string, "stop"))
				params.dwStyle = MB_ICONSTOP;
			else if (!FskStrCompare(string, "note"))
				params.dwStyle = MB_ICONEXCLAMATION;
		}
		if (xsFindResult(xsArg(0), xsID_prompt)) {
			xsVar(0) = xsResult;
		}
		if (xsFindResult(xsArg(0), xsID_info)) {
			xsVar(0) = xsCall1(xsVar(0), xsID("concat"), xsString("\n\n"));
			xsVar(0) = xsCall1(xsVar(0), xsID("concat"), xsResult);
		}
		params.lpszText = xsStringToWideString(xsToString(xsVar(0)));
		if (xsFindResult(xsArg(0), xsID_buttons)) {
			if (xsIsInstanceOf(xsResult, xsArrayPrototype)) {
				xsIntegerValue c = xsToInteger(xsGet(xsResult, xsID_length));
				if (c == 3)
					params.dwStyle |= MB_YESNOCANCEL;
				else if (c == 2)
					params.dwStyle |= MB_OKCANCEL;
				else
					params.dwStyle |= MB_OK;
			}
		}
	}
	result = MessageBoxIndirectW(&params);
	if (params.lpszText)
		CoTaskMemFree((LPVOID *)params.lpszText);
	if (params.lpszCaption)
		CoTaskMemFree((LPVOID *)params.lpszCaption);
	if ((argc > 1) && xsTest(xsArg(1)))
		(void)xsCallFunction1(xsArg(1), xsNull, ((result == IDYES) || (result == IDOK)) ? xsTrue : (result == IDNO) ? xsFalse : xsUndefined);
}
Exemple #2
0
void MainWnd_OnAbout(HWND hwnd)
{
    WCHAR szAbout[MAX_PATH];
    LoadStringW(g_hInstance, IDS_ABOUT, szAbout, _countof(szAbout));

    MSGBOXPARAMS Params;
    ZeroMemory(&Params, sizeof(Params));
    Params.cbSize = sizeof(Params);
    Params.hwndOwner = hwnd;
    Params.hInstance = g_hInstance;
    Params.lpszText = szAbout;
    Params.lpszCaption = g_szTitle;
    Params.dwStyle = MB_OK | MB_USERICON;
    Params.lpszIcon = MAKEINTRESOURCEW(1);
    Params.dwLanguageId = LANG_USER_DEFAULT;
    MessageBoxIndirectW(&Params);
}
Exemple #3
0
void ConEmuAbout::OnInfo_About(LPCWSTR asPageName /*= NULL*/)
{
	InitCommCtrls();

	bool bOk = false;

	{
		DontEnable de;
		HWND hParent = (ghOpWnd && IsWindowVisible(ghOpWnd)) ? ghOpWnd : ghWnd;
		// Modal dialog
		INT_PTR iRc = DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hParent, aboutProc, (LPARAM)asPageName);
		bOk = (iRc != 0 && iRc != -1);

		ZeroStruct(m_Btns);
		mh_AboutDlg = NULL;

		#ifdef _DEBUG
		// Any problems with dialog resource?
		if (!bOk) DisplayLastError(L"DialogBoxParam(IDD_ABOUT) failed");
		#endif
	}

	if (!bOk)
	{
		WCHAR szTitle[255];
		LPCWSTR pszBits = WIN3264TEST(L"x86",L"x64");
		LPCWSTR pszDebug = L"";
		#ifdef _DEBUG
		pszDebug = L"[DEBUG] ";
		#endif
		_wsprintf(szTitle, SKIPLEN(countof(szTitle)) L"About ConEmu (%02u%02u%02u%s %s%s)", 
			(MVV_1%100),MVV_2,MVV_3,_T(MVV_4a), pszDebug, pszBits);
		DontEnable de;
		MSGBOXPARAMS mb = {sizeof(MSGBOXPARAMS), ghWnd, g_hInstance,
			pAbout,
			szTitle,
			MB_USERICON, MAKEINTRESOURCE(IMAGE_ICON), 0, NULL, LANG_NEUTRAL
		};
		MessageBoxIndirectW(&mb);
		//MessageBoxW(ghWnd, pHelp, szTitle, MB_ICONQUESTION);
	}
}