这篇文章主要围绕delphi–可以从VistaShell获取48×48或64×64图标?展开,旨在为您提供一份详细的参考资料。我们将全面介绍delphi–可以从VistaShell获取48×48或64
这篇文章主要围绕delphi – 可以从Vista Shell获取48×48或64×64图标?展开,旨在为您提供一份详细的参考资料。我们将全面介绍delphi – 可以从Vista Shell获取48×48或64×64图标?,同时也会为您带来Android:MediaCodec:在Nexus上为480×480生成了糟糕的视频,而640×640效果很好、bash – 是否可以从子shell获取退出代码?、c – 从64×64位乘法获得前64位的合理便携方式?、c# – 如何使用Windows shell获取文件扩展名的大图标?的实用方法。
本文目录一览:- delphi – 可以从Vista Shell获取48×48或64×64图标?
- Android:MediaCodec:在Nexus上为480×480生成了糟糕的视频,而640×640效果很好
- bash – 是否可以从子shell获取退出代码?
- c – 从64×64位乘法获得前64位的合理便携方式?
- c# – 如何使用Windows shell获取文件扩展名的大图标?
delphi – 可以从Vista Shell获取48×48或64×64图标?
我想从一个代表文件夹路径的图像列表中选择一个图标,并在timage中显示一个48×48或64×64的图标。
// load the large system image for the current path into Image1 SHGetFileInfo( PChar( CurrentPath ),FILE_ATTRIBUTE_norMAL,SFI,SizeOf( TSHFileInfo ),SHGFI_ICON or SHGFI_LARGEICON or SHGFI_SHELLICONSIZE or SHGFI_SYSICONINDEX or SHGFI_TYPENAME or SHGFI_disPLAYNAME ); aimageIndex := SFI.iIcon; ImageList2.GetBitmap( aimageIndex,Image1.Picture.Bitmap );
法案
解决方法
这里有一个例子在delphi中
uses ShellApi,Commctrl,ShlObj; const SHIL_LARGE = $00; //The image size is normally 32x32 pixels. However,if the Use large icons option is selected from the Effects section of the Appearance tab in display Properties,the image is 48x48 pixels. SHIL_SMALL = $01; //These images are the Shell standard small icon size of 16x16,but the size can be customized by the user. SHIL_EXTRALARGE= $02; //These images are the Shell standard extra-large icon size. This is typically 48x48,but the size can be customized by the user. SHIL_SYSSMALL = $03; //These images are the size specified by GetSystemMetrics called with SM_CXSMICON and GetSystemMetrics called with SM_CYSMICON. SHIL_JUMBO = $04; //Windows Vista and later. The image is normally 256x256 pixels. IID_IImageList: TGUID= '{46EB5926-582E-4017-9FDF-E8998DAA0950}'; function GetimageListSH(SHIL_FLAG:Cardinal): HIMAGELIST; type _SHGetimageList = function (iImageList: integer; const riid: TGUID; var ppv: Pointer): hResult; stdcall; var Handle : THandle; SHGetimageList: _SHGetimageList; begin Result:= 0; Handle:= LoadLibrary('Shell32.dll'); if Handle<> S_OK then try SHGetimageList:= GetProcAddress(Handle,PChar(727)); if Assigned(SHGetimageList) and (Win32Platform = VER_PLATFORM_WIN32_NT) then SHGetimageList(SHIL_FLAG,IID_IImageList,Pointer(Result)); finally FreeLibrary(Handle); end; end; Procedure GetIconFromFile(aFile:String; var aIcon : TIcon;SHIL_FLAG:Cardinal); var aimgList : HIMAGELIST; SFI : TSHFileInfo; Begin //Get the index of the imagelist SHGetFileInfo(PChar(aFile),SHGFI_ICON or SHGFI_LARGEICON or SHGFI_SHELLICONSIZE or SHGFI_SYSICONINDEX or SHGFI_TYPENAME or SHGFI_disPLAYNAME ); if not Assigned(aIcon) then aIcon:= TIcon.Create; //get the imagelist aimgList:= GetimageListSH(SHIL_FLAG); //extract the icon handle aIcon.Handle:= ImageList_GetIcon(aimgList,Pred(ImageList_GetimageCount(aimgList)),ILD_norMAL); End;
你可以这样使用这些功能
var hicon :TIcon; begin hicon:= TIcon.Create; try GetIconFromFile('C:\Tools\reflector\readme.htm',hicon,SHIL_JUMBO); Image1.Picture.Icon.Assign(hIcon); //assign to timage finally hIcon.Free; end; end;
Android:MediaCodec:在Nexus上为480×480生成了糟糕的视频,而640×640效果很好
我正在使用MediaCodec(和Mediamuxer)在Android上渲染Mpeg4 / avc视频.
我正在测试LG Nexus 4&三星galaxy 5.
在三星,rendered video looks as expected的640×640和480×480帧尺寸.
但是,在Nexus上,480×480产生了bad looking video,而640×640产生了一个很好的视频.
Quesion是:是什么原因?这是一个我不知道的错误或“功能”.
是否有一个众所周知的帧大小我们可以依赖于在所有Android设备上正确渲染?或者我们需要在各种设备上进行测试吗?
解决方法:
关于“众所周知的框架尺寸” – 谷歌要求设备供应商满足要求 – http://source.android.com/compatibility/index.html,doc在这里:http://static.googleusercontent.com/media/source.android.com/en//compatibility/android-cdd.pdf
它具有编解码器部分5(精确值为5.2和5.3),您可以在其中找到与编解码器相关的请求.
要检查它谷歌提供涵盖所有所需分辨率的CTS测试.因此,建议是坚持本文档的决议并由CTS测试覆盖
bash – 是否可以从子shell获取退出代码?
bash -c "some_command" do something with code of some_command here
是否可以获取some_command的代码?我不直接在运行脚本的shell中执行some_command,因为我不想改变它的环境.
当然,它也可能包含一个来自bash的代码,以防在命令甚至被执行之前发生错误(错误的文件名,whatnot).
c – 从64×64位乘法获得前64位的合理便携方式?
在C/C++中有一个合理的可移植方式来为128位结果乘以两个64位整数并得到结果的前64位而不是底部的64位吗?我需要这个来在任意大小的表上分配哈希函数.
解决方法
下图显示了一种从两个64位数字计算128位乘积的方法.每个黑色矩形代表一个64位数字.方法的64位输入X和Y被分成标记为a,b,c和d的32位块.然后执行四次32×32位乘法,得到四个标记为a * c,b * c,a * d和b * d的64位乘积.必须移动并添加四个产品以计算最终答案.
请注意,128位乘积的低32位仅由部分乘积b * d的低32位决定.接下来的32位由以下的低32位决定
mid34 = ((b*c) & 0xffffffff) + ((a*d) & 0xffffffff) + ((b*d) >> 32);
请注意,mid34是三个32位数的总和,因此实际上是一个34位的总和. mid34的高两位充当64×64位乘法的前64位的进位.
这将我们带到演示代码. top64函数计算64×64乘法的高64位.允许在注释中显示较低64位的计算有点冗长.主函数利用128位整数通过简单的测试用例验证结果.进一步的测试留给读者练习.
#include <stdio.h>#include <stdint.h>typedef unsigned __int128 uint128_t;uint64_t top64( uint64_t x,uint64_t y ){ uint64_t a = x >> 32,b = x & 0xffffffff; uint64_t c = y >> 32,d = y & 0xffffffff; uint64_t ac = a * c; uint64_t bc = b * c; uint64_t ad = a * d; uint64_t bd = b * d; uint64_t mid34 = (bd >> 32) + (bc & 0xffffffff) + (ad & 0xffffffff); uint64_t upper64 = ac + (bc >> 32) + (ad >> 32) + (mid34 >> 32);// uint64_t lower64 = (mid34 << 32) | (bd & 0xffffffff); return upper64;}int main( void ){ uint64_t x = 0x0000000100000003; uint64_t y = 0x55555555ffffffff; uint128_t m = x,n = y; uint128_t p = m * n; uint64_t top = p >> 64; printf( "%016llx %016llx\n",top,top64( x,y ) );}
c# – 如何使用Windows shell获取文件扩展名的大图标?
// DLL Import [DllImport("shell32")] private static extern IntPtr SHGetFileInfo( string pszPath,uint dwFileAttributes,ref SHFILEINFO psfi,uint cbFileInfo,uint uFlags); // Constants/Enums private const int FILE_ATTRIBUTE_norMAL = 0x80; private enum SHGetFileInfoConstants : int { SHGFI_ICON = 0x100,// get icon SHGFI_disPLAYNAME = 0x200,// get display name SHGFI_TYPENAME = 0x400,// get type name SHGFI_ATTRIBUTES = 0x800,// get attributes SHGFI_ICONLOCATION = 0x1000,// get icon location SHGFI_EXETYPE = 0x2000,// return exe type SHGFI_SYSICONINDEX = 0x4000,// get system icon index SHGFI_LINKOVERLAY = 0x8000,// put a link overlay on icon SHGFI_SELECTED = 0x10000,// show icon in selected state SHGFI_ATTR_SPECIFIED = 0x20000,// get only specified attributes SHGFI_LARGEICON = 0x0,// get large icon SHGFI_SMALLICON = 0x1,// get small icon SHGFI_OPENICON = 0x2,// get open icon SHGFI_SHELLICONSIZE = 0x4,// get shell size icon SHGFI_PIDL = 0x8,// pszPath is a pidl SHGFI_USEFILEATTRIBUTES = 0x10,// use passed dwFileAttribute SHGFI_ADDOVERLAYS = 0x000000020,// apply the appropriate overlays SHGFI_OVERLAYINDEX = 0x000000040 // Get the index of the overlay } public static Icon GetSmallIconForExtension(string extension) { // Get the small icon and clone it,as we MUST destroy the handle when we are done. SHFILEINFO shinfo = new SHFILEINFO(); IntPtr ptr = SHGetFileInfo( extension,FILE_ATTRIBUTE_norMAL,ref shinfo,(uint)Marshal.SizeOf(shinfo),(int)(SHGetFileInfoConstants.SHGFI_ICON | SHGetFileInfoConstants.SHGFI_SMALLICON | SHGetFileInfoConstants.SHGFI_USEFILEATTRIBUTES | SHGetFileInfoConstants.SHGFI_TYPENAME)); Icon icon = Icon.FromHandle(shinfo.hIcon).Clone() as Icon; DestroyIcon(shinfo.hIcon); return icon; } public static Icon GetLargeIconForExtension(string extension) { // Get the small icon and clone it,(int)( SHGetFileInfoConstants.SHGFI_ICON | SHGetFileInfoConstants.SHGFI_LARGEICON | SHGetFileInfoConstants.SHGFI_USEFILEATTRIBUTES | SHGetFileInfoConstants.SHGFI_TYPENAME )); Icon icon = Icon.FromHandle(shinfo.hIcon).Clone() as Icon; DestroyIcon(shinfo.hIcon); return icon; }
从上述方法之一获取图标后,我将其转换为位图,如下所示:
Image image = icon.ToBitmap();
在上面指定SHGetFileInfoConstants.SHGFI_LARGEICON时,我得到32×32大小的位图图像.但是,在Windows资源管理器中,当您选择查看中等图标时,您将获得48×48大小的图标.
我想要48×48大小的图标(不是32×32).我需要做什么?
解决方法
SHGetImageList
的文档中给出:
> 16×16 =小
> 32×32 =大
> 48×48 = extralarge
> 256×256 = jumbo
所以当你要求“大”图标时,你会得到32×32.如果你想要超大图标,你需要从SHIL_EXTRALARGE图像列表中获取它们.
关于delphi – 可以从Vista Shell获取48×48或64×64图标?的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于Android:MediaCodec:在Nexus上为480×480生成了糟糕的视频,而640×640效果很好、bash – 是否可以从子shell获取退出代码?、c – 从64×64位乘法获得前64位的合理便携方式?、c# – 如何使用Windows shell获取文件扩展名的大图标?的相关知识,请在本站寻找。
本文标签: