Exemplo n.º 1
0
EXTERN_C HRESULT WINAPI GdippDllGetVersion(DLLVERSIONINFO* pdvi)
{
   if (!pdvi || pdvi->cbSize < sizeof(DLLVERSIONINFO)) {
      return E_INVALIDARG;
   }

   const UINT cbSize = pdvi->cbSize;
   ZeroMemory(pdvi, cbSize);
   pdvi->cbSize = cbSize;

   HRSRC hRsrc = FindResource(GetDLLInstance(), MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
   if (!hRsrc) {
      return E_FAIL;
   }

   HGLOBAL hGlobal = LoadResource(GetDLLInstance(), hRsrc);
   if (!hGlobal) {
      return E_FAIL;
   }

   const WORD* lpwPtr = (const WORD*)LockResource(hGlobal);
   if (lpwPtr[1] != sizeof(VS_FIXEDFILEINFO)) {
      return E_FAIL;
   }

   const VS_FIXEDFILEINFO* pvffi = (const VS_FIXEDFILEINFO*)(lpwPtr + 20);
   if (pvffi->dwSignature != VS_FFI_SIGNATURE ||
         pvffi->dwStrucVersion != VS_FFI_STRUCVERSION) {
      return E_FAIL;
   }

   //8.0.2006.1027
   // -> Major: 8, Minor: 2006, Build: 1027
   pdvi->dwMajorVersion = HIWORD(pvffi->dwFileVersionMS);
   pdvi->dwMinorVersion = LOWORD(pvffi->dwFileVersionMS) * 10 + HIWORD(pvffi->dwFileVersionLS);
   pdvi->dwBuildNumber  = LOWORD(pvffi->dwFileVersionLS);
   pdvi->dwPlatformID   = DLLVER_PLATFORM_NT;

   if (pdvi->cbSize < sizeof(DLLVERSIONINFO2)) {
      return S_OK;
   }

   DLLVERSIONINFO2* pdvi2 = (DLLVERSIONINFO2*)pdvi;
   pdvi2->ullVersion      = MAKEDLLVERULL(pdvi->dwMajorVersion, pdvi->dwMinorVersion, pdvi->dwBuildNumber, 2);
   return S_OK;
}
void ShowAboutIntel (AboutRecordPtr aboutPtr)
{
	PlatformData * platform = static_cast<PlatformData *>(aboutPtr->platformData);
	
	HWND h = reinterpret_cast<HWND>(platform->hwnd);

    DialogBoxParam(GetDLLInstance(), 
		           MAKEINTRESOURCE( IDD_ABOUT ),
	               h, 
				   AboutDlgProcIntel, 
				   0);
}
string GetPresetName(string str, HWND parent)
{
    if (DialogBoxParam(GetDLLInstance(), 
		           MAKEINTRESOURCE( IDD_GETNAME ),
	               parent, 
				   DlgGetNameProc, 
				   reinterpret_cast<LONG_PTR>(&str)) == IDOK)
	{
		return str;
	}

	return "";
}
Exemplo n.º 4
0
//-------------------------------------------------------------------------------
//
// DoUI
//
// Pop the UI and return true if the last item was the OK button.
// 
//-------------------------------------------------------------------------------
Boolean DoUI(void)
{
	PlatformData* platform = (PlatformData*)(gFilterRecord->platformData);

	INT_PTR result = DialogBoxParam(GetDLLInstance(),
							(LPSTR)"DISSOLVEDIALOG",
							(HWND)platform->hwnd,
							(DLGPROC)DissolveProc,
							NULL);
	//used by the DissolveProc routine, don't let the error go further
	*gResult = noErr;
	return (result == kDOK);
}
Exemplo n.º 5
0
Boolean DoUI (GPtr globals)
{

	PlatformData *platform;

	platform = (PlatformData*)((FilterRecordPtr) gStuff)->platformData;

	/* Query the user for percent dissolve. */

	INT_PTR    nResult = DialogBoxParam(GetDLLInstance(),
							 (LPSTR)"COLORMUNGERPARAM",
							 (HWND)platform->hwnd,
							 (DLGPROC)FilterProc,
							 (LPARAM)globals);

	return (nResult == OK);

}	
unsigned8 ShowLoadDialog (bool showAlphaGroup, bool showMipMapGroup, HWND parent)
{
	//encode flags into results
	unsigned8 result = LoadInfoEnum::USE_NONE;
	result |=  showAlphaGroup ? LoadInfoEnum::USE_SEPARATEALPHA :  LoadInfoEnum::USE_NONE;
	result |=  showMipMapGroup ? LoadInfoEnum::USE_MIPMAPS :  LoadInfoEnum::USE_NONE;

	if (DialogBoxParam(GetDLLInstance(), 
					MAKEINTRESOURCE( IDD_LOADDIALOG ),
					parent, 
					DlgLoadProc, 
					reinterpret_cast<LONG_PTR>(&result)) == IDOK)
	{
		return result;
	}

	return 0;
}
Exemplo n.º 7
0
Boolean DoUI (GPtr globals)
{

	INT_PTR nResult;
	PlatformData *platform;

	platform = (PlatformData*)((FilterRecordPtr) gStuff)->platformData;

	/* Query the user for settings. */

	nResult = DialogBoxParam(GetDLLInstance(),
							 (LPSTR)"POORMANSTYPETOOLPARAM",
							 (HWND)platform->hwnd,
							 (DLGPROC)PoorMansTypeToolProc,
							 (LPARAM)globals);
	
	return (nResult == OK);

}	
Exemplo n.º 8
0
BOOL AddEasyHookEnv()
{
	TCHAR dir[MAX_PATH];
	int dirlen = GetModuleFileName(GetDLLInstance(), dir, MAX_PATH);
	LPTSTR lpfilename=dir+dirlen;
	while (lpfilename>dir && *lpfilename!=_T('\\') && *lpfilename!=_T('/')) --lpfilename;
	*lpfilename = 0;
	_tcscat(dir, _T(";"));
	dirlen = _tcslen(dir);
	int sz=GetEnvironmentVariable(_T("path"), NULL, 0);
	LPTSTR lpPath = (LPTSTR)malloc((sz+dirlen+2)*sizeof(TCHAR));
	GetEnvironmentVariable(_T("path"), lpPath, sz);
	if (!_tcsstr(lpPath, dir))
	{
		if (lpPath[sz-2]!=_T(';'))
			_tcscat(lpPath, _T(";"));
		_tcscat(lpPath, dir);
		SetEnvironmentVariable(_T("path"), lpPath);
	}
	free(lpPath);
	return true;
}
Exemplo n.º 9
0
void InitializeMenu(GPtr globals, HWND hDlg, int item)
{
	HWND hWnd = GetDlgItem(hDlg, item);
	if (hWnd == NULL) return;

	// clear the pupup menu
	SendMessage(hWnd, CB_RESETCONTENT, (WPARAM)0, (LPARAM)0);

	// the layers are read from the current ReadImageDocumentDesc
	// the first one in the list is the target
	// the actual layers are then added
	if (item == kDLayersPopUp)
	{
		if (gDocDesc == NULL) return;

		SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)"Target Layer");

		ReadLayerDesc * layerDesc = gDocDesc->layersDescriptor;

		while (layerDesc != NULL)
		{
			SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)layerDesc->name);
			layerDesc = layerDesc->next;
		}
	}

	// For Photoshop 7 you can now get at the scrap/clipboard document
	// you can't write to it and it probably doesn't have other layers
	// at this time.
	else if (item == kDDocPopUp)
	{
		// char madeUpName[256];
		int16 counter = 1;
		
		ReadImageDocumentDesc * localDesc = gDocInfo;

		while (localDesc != NULL && gStuff->hasImageScrap)
		{
			std::ostringstream madeUpName;
			madeUpName << "DocDesc " << counter;
			SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)madeUpName.str().c_str());
			localDesc = localDesc->next;
			counter++;
		}
	}

	// The size pop up is a static menu from the resources of this plugin
	else if (item == kDSize)
	{
		char			text[256];
		DWORD			error;
		MENUITEMINFO	mii;

		HMENU hMenu = LoadMenu(GetDLLInstance(), "POORMANSTYPETOOLMENU");
		if (hMenu == NULL)
		{
			error = GetLastError();
			return;
		}

		mii.cbSize = sizeof(MENUITEMINFO);
		mii.fMask = MIIM_SUBMENU;
		if (!GetMenuItemInfo(hMenu, 0, TRUE, &mii))
		{
			error = GetLastError();
			return;
		}

		if (mii.hSubMenu == NULL)
		{
			error = GetLastError();
			return;
		}

		hMenu = mii.hSubMenu;

		mii.fMask = MIIM_TYPE;
		mii.fType = MFT_STRING;
		mii.dwTypeData = text;
		mii.cch = sizeof(text);

		int menuItems = GetMenuItemCount(hMenu);
		if (menuItems == 0)
		{
			error = GetLastError();
			return;
		}

		for(int a = 0; a < menuItems; a++)
		{
			if (!GetMenuItemInfo(hMenu, a, TRUE, &mii))
			{
				error = GetLastError();
				return;
			}
			mii.cch = sizeof(text);
			SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)text);
		}
	}
	else
		return; // an unknown menu id
}