我如何获得该项目>选项>版本信息>键盘编程 [英] How do I get the project > options > version info > keys programmatically

查看:62
本文介绍了我如何获得该项目>选项>版本信息>键盘编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Delphi RAD Studio 10.2



如何从Project>中的设置中获取信息?选项>版本信息?我在谈论KEYS。像LegalCopyright,FileDescription和评论这样的东西?这些存储在dbproj文件中,但我需要知道如何在代码中获取这些键值,以便我可以在应用程序的某些位置显示它们。



我知道如何从项目中获取标题>选项>申请>外观>标题。这很简单。这只是Application.Title。但上面的关键是让我不知所措。我可以编写一些代码来从dproj文件中的XML中获取值,但似乎我们不应该这样做。



希望有人可以提供帮助。谢谢,



基思



顺便问一下,这是否是一个问德尔福的好地方问题吗? Embarcadero论坛从我所看到的并不是什么好事。我一直在将Borland Delphi 7项目升级到RAD Studio 10.2。早在2000年初,usenet小组就是出类拔萃的好东西,但是众所周知,这些小组已经成为渡渡鸟的方式了。我真的需要一个坚实的地方来解答德尔福的问题。 :-)



我尝试了什么:



很少。我无法在网上找到任何可以帮助我解决这个问题的方法。我花了一个多小时搜索。

I'm on Delphi RAD Studio 10.2

How do you get the information from the settings in Project > Options > Version Info? I'm talking about the KEYS. Things like "LegalCopyright", "FileDescription", and "Comments" from that? These are stored in the dbproj file but I need to know how to get those key values in code so I can display them in some places in my application.

I know how to get the Title from Project > Options > Application > Appearance > Title. That's easy. It's just Application.Title. But the keys above are eluding me. I could write some code to get the values from the XML in the dproj file but it doesn't seem like we should have to do that.

Hope someone can help. Thanks,

Keith

By the way, does this tend to be a good place to ask Delphi questions? The Embarcadero forums are NOT any good from what I can see. I've been upgrading a Borland Delphi 7 project to RAD Studio 10.2. Back in the early 2000's the usenet groups were great for this sort of thing but those have gone the way of the dodo as we all know. I really need a solid place to get Delphi questions answered. :-)

What I have tried:

Very little. I can't find anything online that helps me figure this out. I've spent over an hour searching.

推荐答案

procedure TForm1.FormCreate(Sender: TObject);

   function ReadVerInfo(const fn: string;
                        var Desc: string;
                        const lv: integer = 0;
                        const ky: string = ''): string;
   var
     VerHandle,
     VerSize        : DWORD;
     pItem,
     pVerInfo       : Pointer;
     FixedFileInfo  : PVSFixedFileInfo;
     il             : UINT;
     version, key   : string;
     sRes,
     LangS, CharS	: string;
     pFName         : array [0..MAX_PATH-1] of Char;
   begin
     version:=''; Desc:=''; sRes:='';
     if fn<>'' then begin
       StrPCopy(pFName,fn);
       VerHandle:=0;
       VerSize:=GetFileVersionInfoSize(pFName,VerHandle);
       if VerSize=0 then Exit;
       GetMem(pVerInfo,VerSize);
       try
         if GetFileVersionInfo(pFName,VerHandle,VerSize,pVerInfo)
         then
         begin
           LangS:='0409'; CharS:='04E4';
           il:=0; pItem:=nil; FixedFileInfo:=nil;
           if VerQueryValue(pVerInfo,
                            '\VarFileInfo\Translation',pItem,il)
           then
           begin
             LangS:=IntToHex(  Integer(pItem^) and


0000FFFF,4);
CharS:= IntToHex(((整数(pItem ^)和
0000FFFF ,4); CharS:=IntToHex(((Integer(pItem^) and


FFFF0000)shr 16)
FFFF0000) shr 16) and


这篇关于我如何获得该项目&gt;选项&gt;版本信息&gt;键盘编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆