求助,关于THotKey不能区分Num、Left/Right的问题(已经参考季老大的贴)

天马座的流星拳 2007-11-15 11:16:40
参考贴子:
http://topic.csdn.net/t/20051205/12/4438415.html
http://topic.csdn.net/t/20051206/09/4440364.html

BCB:
我已经看过了05年12月季老大的贴子,不过,季老大的办法可以区别“Left与Num 4”,但不是区分“Num 4与4”。
不知道还有没有更完美一些的办法?

我自己试过保存到INI中时,如果不使用ShortCutToText,而是直接保存Integer值,读取出来倒可以区分出“Num 4与4”,但是就分不出“Left与Num 4”。
好像是ShortCutToText有BUG。苦啊。

哪怕是重新写一个方法或者单元文件也在所不惜!!!


//代码就我就拿原来的吧,也方便大家一起讨论
//读取
AnsiString str = ReadString("Hotkey", "htkPan", NULL, "Hotkey.ini");
if (str.SubString(1,6)=="hkExt ") {
HotKey1->HotKey = StrToInt(str.Delete(1,6));
HotKey1->Modifiers = THKModifiers(HotKey1->Modifiers) << hkExt;
}
else
HotKey1->HotKey = StrToInt(str);

//保存:
AnsiString str = HotKey1->Modifiers.Contains(hkExt) ? "hkExt " : "";
str += IntToStr(HotKey1->HotKey);
WriteString("Hotkey", "htkPan", str, "Hotkey.ini");
...全文
76 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
原来是硬键值呀,难怪动不了他呢。
alloutoflove 2007-11-21
  • 打赏
  • 举报
回复
额...Num 4是个硬键值, 和NumLock无关...
i_love_pc 2007-11-15
  • 打赏
  • 举报
回复
看看是否跟小键盘锁有关系!!
Waiting4you 2007-11-15
  • 打赏
  • 举报
回复
你是说区分NumLock锁开和NumLock锁关的状态? 就Hotkey这个控件来说是没戏了,它封装的是windows自带的HOTKEY,它先天对这个不区分。

要不你在它OnChange里自己加判断NumLock状态的 GetKeyboardState

  • 打赏
  • 举报
回复
哈哈,真办法。
不过还是不区分开NumLock的状态:不管是什么时候,他的值不一样,但显示的都是Num 4。
帮人帮到底,有什么办法可以最终一起解决的吗?
Waiting4you 2007-11-15
  • 打赏
  • 举报
回复
试试这样:(这里的hk1是THotKey)

取HotKey数据:
DWORD dwHK1 = SendMessage(hk1->Handle, HKM_GETHOTKEY,0,0);

把dwHK1还原到THotKey里:
SendMessage(hk2->Handle, HKM_SETHOTKEY,dwHK1,0);

这个dwHK1里的数据包含了HotKey和Modifiers,保存时只要保存这个数字就可以了,比较方便。我在我的机器上试是可以的。
3rd-party components For support in the project, a required 3rd-party controls must be declared in the SkinManager.ThirdParty property. Use a special design-time editor for handy adding of required controls. -------------------------------------------------------------------------------- List of supported components : - Standard VCL (TPanel, TEdit, TMemo, TListBox, TComboBox, TMaskEdit, TStringGrid, TDrawGrid, TCheckListBox, TRichEdit, THotKey, TTreeView, TListView, TDBGrid, TDBEdit, TDBMemo, TDBListBox, TDBLookupListBox, TDBRichEdit, TGroupBox, TButton, TCheckBox, TRadioButton and others) - Windows system dialogs (File open/save, Font dialog, Color dialog and others) - DevExpress grids and other controls which supports LookAndFeel technology - RXLib (TCurrencyEdit, TTextListBox, TRxRichEdit, TRxDrawGrid, TRxDBGrid, TRxDBLookupList, TRxDBRichEdit and others) - JVCL (JvValidateEdit, JvEdit, JvMemo, JvRichEdit and others) - EhLib controls - TPNGImageList - TntControls Unicode - Most TMS edits and grids - Billenium effects - TSynEdit, TSynMemo, TDBSynEdit - Virtual Controls (TVirtualStringTree and TVirtualDrawTree) - most Woll2Woll InfoPower 4000 controls - TmxFlatEdit, TmxFlatFloatEdit, TmxFlatMaskEdit, TmxFlatMemo, TmxFlatRichEdit, TmxFlatListBox, TmxFlatDirectoryListBox, TmxFlatFileListBox, mxFlatCheckListBox and others - ImageEn library - TRichView, TRichViewEdit, TDBRichViewEdit and TDBRichView - TVirtualExplorerListView, TVirtualExplorerTreeview - Raize controls (TRzPanel, TRzGroupBox, TRzEdit, TRzMaskEdit, TRzNumericEdit, TRzExpandEdit, TRzHotKeyEdit, TRzTreeView, TRzCheckTree, TRzMemo, TRzRichEdit, TRzShellTree, TRzShellList, TRzRankListBox, TRzListBox, TRzTabbedListBox, TRzCheckList, TRzEditListBox, TRzComboBox, TRzImageComboBox, TRzMRUComboBox, TRzShellCombo, TRzLabel, TRzURLLabel, TRzDateTimeEdit) - TWebBrowser -------------------------------------------------------------------------------- Some instructions for 3rd-party features using in the AlphaControls full release : 1. Most standard and 3rd-party controls Skinned automatically if required controls are declared in the SkinManager.ThirdParty property and SkinManager.SkinningRules.srThirdParty property is true 2. TntControls Unicode Most controls from AlphaControls package may have support of Unicode (in Delphi6-2009). In this case used the TntControls package (thanks TNT authors, TntControls must be installed already). For using this feature should be uncommented the TNTUNICODE key in the sDefs.inc file (should be {$DEFINE TNTUNICODE}) and AlphaControls package must be reinstalled (sources needed). Note : don't forget backup all projects before opening after package installation, some Unicode data may be lost if compiled without TNTUNICODE key. 3. TPngImageList Since version 6 AlphaControls have native support of PNG format (TsAlphaImageList was added also). Buttons and menus from AlphaControls have support of TPngImageList component also. For work with this component the USEPNG key should be defined in the sDefs.inc file (must be {$DEFINE USEPNG}). TPNGImageList is a freeware component with sources that may be used for work with PNG glyphs in any application. May be downloaded from http://www.thany.org/article/32/PngComponents 4. DevExpress grids and other controls - Install DevExpress and AlphaControls - Enable the 'DEVEX6' or 'DEVEX2011' key in the sDefs.inc file (AlphaControls), must be {$DEFINE DEVEX6} - Be sure that latest version of DevExpress is installed, or check a list of supported DevExpress versions in the beginning of the acLFPainter.pas file (AlphaControls) - Configure the sSkinManager component and compile the project. In the run-time will be skinned all DevExpress controls which have LookAndFeel property properly supported. LookAndFeel.NativeStyle property must be False. 'DEVEX' key must be enabled (in the sDefs.inc file) before AlphaControls installing (must be {$DEFINE DEVEX}). 5. Billenium Effects This package is supported authomatically 6. TWebBrowser The ADDWEBBROWSER key should be enabled in the sDefs.inc file before a package installing. Sources of the package are required. TWebBrowser type should be added in sSkinManager1.ThirdParty list as 'WebBrowser'

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧