// // Internal initialization fills in the data members // Now returns void and throws exceptions. [VH 2005-04-03] // void TModuleVersionInfo::Init(LPCTSTR modFName) { try { uint32 fvHandle; #if defined WINELIB uint32 infoSize = TVersion::GetFileVersionInfoSize((LPTSTR)modFName, (unsigned int *)&fvHandle); #else uint32 infoSize = TVersion::GetFileVersionInfoSize((LPTSTR)modFName, &fvHandle); #endif if (!infoSize) throw 1; // Caught below. TAPointer<uint8> buf(new uint8[uint(infoSize)]); if (!TVersion::GetFileVersionInfo((LPTSTR)modFName, fvHandle, infoSize, buf)) throw 2; // Caught below. // Copy string to buffer so if the -dc compiler switch (Put constant // strings in code segments) is on, VerQueryValue will work under Win16. // This works around a problem in Microsoft's ver.dll which writes to the // string pointed to by subBlockName. // uint vInfoLen; // not really used, but must be passed tchar* subBlockName = viRootStr; if (!TVersion::VerQueryValue(buf, subBlockName, (void **)&FixedInfo, &vInfoLen)) throw 3; // Caught below. subBlockName = viTransStr; uint32 * trans; if (!TVersion::VerQueryValue(buf, subBlockName, (void **)&trans, &vInfoLen)) throw 4; // Caught below. // Assign language and buffer. // // Swap the words so sprintf will print the lang-charset in the correct format. Lang = MkUint32(HiUint16(*trans), LoUint16(*trans)); Buff = buf.Relinquish (); // Take ownership. } catch (...) { // Rethrow dedicated exception. // LPCTSTR msg = 0; TSystemMessage last_error; if (last_error.SysError()) msg = last_error.SysMessage ().c_str(); TXModuleVersionInfo::Raise(msg); } }
LRESULT_U_U_HMENU_Dispatch(TGeneric& i, LRESULT (TGeneric::*f)(uint, uint, HMENU), WPARAM p1, LPARAM p2) { return (i.*f)(LoUint16(p1), HiUint16(p1), reinterpret_cast<HMENU>(p2)); }
v_Activate_Dispatch(TGeneric& i, void (TGeneric::*f)(uint, bool, HWND), WPARAM p1, LPARAM p2) { (i.*f)(LoUint16(p1), (bool)HiUint16(p1), reinterpret_cast<HWND>(p2)); return 0; }
v_U_U_W_Dispatch(TGeneric& i, void (TGeneric::*f)(uint, uint, HWND), WPARAM p1, LPARAM p2) { (i.*f)(LoUint16(p1), HiUint16(p1), reinterpret_cast<HWND>(p2)); return 0; }
i_U_W_U_Dispatch(TGeneric& i, int (TGeneric::*f)(uint, HWND, uint), WPARAM p1, LPARAM p2) { return (i.*f)(LoUint16(p1), reinterpret_cast<HWND>(p2), HiUint16(p1)); }
v_HMENU_U_B_Dispatch(TGeneric& i, void (TGeneric::*f)(HMENU, uint, bool), WPARAM p1, LPARAM p2) { (i.*f)(reinterpret_cast<HMENU>(p1), LoUint16(p2), (bool)HiUint16(p2)); return 0; }
v_U_U_B_Dispatch(TGeneric& i, void (TGeneric::*f)(uint, uint, bool), WPARAM p1, LPARAM p2) { (i.*f)(p1, LoUint16(p2), (bool)HiUint16(p2)); return 0; }
v_B_U_U_Dispatch(TGeneric& i, void (TGeneric::*f)(bool, uint, uint), WPARAM p1, LPARAM p2) { (i.*f)((bool)p1, LoUint16(p2), HiUint16(p2)); return 0; }
v_W_U_U_Dispatch(TGeneric& i, void (TGeneric::*f)(HWND, uint, uint), WPARAM p1, LPARAM p2) { (i.*f)(reinterpret_cast<HWND>(p1), LoUint16(p2), HiUint16(p2)); return 0; }
B_U_U_U_Dispatch(TGeneric& i, bool (TGeneric::*f)(uint, uint, uint), WPARAM p1, LPARAM p2) { return (i.*f)(p1, LoUint16(p2), HiUint16(p2)); }
B_U_U_POINT_Dispatch(TGeneric& i, bool (TGeneric::*f)(uint, uint, const TPoint&), WPARAM p1, LPARAM p2) { TPoint p(p2); return (i.*f)(LoUint16(p1), HiUint16(p1), p); }