bool load_dll(void)
{
	if (NULL == hEngineInst)
	{
		char engine_path[MAX_PATH];
		const char *error = NULL;

		hEngineInst = LoadLibrary(set_my_path(engine_path, BBLEANSKIN_ENGINEDLL));
		*(FARPROC*)&EntryFunc = GetProcAddress(hEngineInst, "EntryFunc");

		if (NULL == EntryFunc)
			error = "Could not load: " BBLEANSKIN_ENGINEDLL;
		else
			if (ENGINE_THISVERSION != EntryFunc(ENGINE_GETVERSION, NULL))
				error = "Wrong version: " BBLEANSKIN_ENGINEDLL;

		if (error)
		{
			free_dll();
			MessageBox(NULL, error, szAppName,
					   MB_OK | MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
			return false;
		}
	}
	return true;
}
void stopEngine(void)
{
	//dbg_printf("Stopped skinner engine");
	if (false == engine_running) return;
	sendToAll(MSGID_UNLOAD);
	EntryFunc(ENGINE_UNSETHOOKS, lpvMem);
	free_exclusion_list();
	free_dll();
	// restore the normal SystemParameter settings, window metrics, etc.
	SystemParametersInfo(SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm_save, SPIF_SENDCHANGE);
	// restore sys-colors
	setTTC(RESTORE_3DC);
	engine_running = false;
}
void startEngine(void)
{
	//dbg_printf("Started skinner engine");
	readSettings();
	set_log_window();

	if (engine_running)
		return;
	if (false == make_exclusion_list())
		return;

	if (false == load_dll())
	{
		free_exclusion_list();
		return;
	}

	bbSkinMsg = RegisterWindowMessage(BBLEANSKIN_WINDOWMSG);

	// save sys-colors
	setTTC(SAVE_3DC);

	// save the normal SystemParameter settings, window metrics, etc.
	ncm_save.cbSize = sizeof(NONCLIENTMETRICS);
	SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof ncm_save, &ncm_save, 0);
	ZeroMemory(&ncm_prev, sizeof(NONCLIENTMETRICS));

	// read styles for skin
	readStyle();
	// possibly set sys-colors
	setTTC(APPLY_3DC);
	// set the system wide window metrics according to style metrics
	setmetrics();
	// set the hook
	EntryFunc(ENGINE_SETHOOKS, lpvMem);
	engine_running = true;

	// now apply to open windows
	if (applyToOpen) sendToAll(MSGID_LOAD);

	//write_bin();
}
Example #4
0
void GLView::EntryFunc(int state) {
  FOREACH_LISTENER EntryFunc(state);
}