delphi
RSS聚合
Donation and iPhone Development
又土鳖了一把
Pro JavaScript Techniques 的中文版上市
AppTapp 的打包问题
将 Debian APT 引入 iPhone
升级到 WordPress 2.5
The life of a programmer…
百度Hi:战术不错,战略存疑
忍耐:从“myspace中国”到“聚友”
Facebook的核心竞争力
“新广告的媒体”和“新媒体的广告”
串联blog服务公益,哈达网推“达芬奇·计划”
有道推“相关博文推荐”wordpress插件
G宝盘推新功能:文件收件箱
哪吒启用新域名并对web站进行多项升级
Apr
28
由于帮朋友编程序,程式是用delphi编写,编的是com程序,用的控件是spcomm,要输入Ctrl + Z 键,但总是得不到预想的效果,
我原先这样用的:
var
ss:string
begin
// #17 是ctrl键的ascii码,#90是Z的ascii码,#13是回车的ascii码
ss:=#17#90#13
Comm1.WriteCommData(Pchar(ss),Length(ss));
end;
但总是不对,后来在网上查到CTRL+ Z 是用组合键的ASCII码的,不是#17#90#13了事,应该这样,
ctrl + a 应该是 #1
.
.
.
ctrl + z 应该是 #25
ctrl + z 应该是 #26
经这样实践之后就ok了。
下边是个输出ctrl + a~z的函数
CtrlStr(a) 等于#1 , 写得有点复杂.
function CtrlStr(fstr:string):string;
var
vstr:string;
begin
fstr:=uppercase(fstr);
if fstr='A' then
vstr:=#1
else if fstr='B' then
vstr:=#2
else if fstr='C' then
vstr:=#3
else if fstr='D' then
vstr:=#4
else if fstr='E' then
vstr:=#5
else if fstr='F' then
vstr:=#6
else if fstr='G' then
vstr:=#7
else if fstr='H' then
vstr:=#8
else if fstr='I' then
vstr:=#9
else if fstr='J' then
vstr:=#10
else if fstr='K' then
vstr:=#11
else if fstr='L' then
vstr:=#12
else if fstr='M' then
vstr:=#13
else if fstr='N' then
vstr:=#14
else if fstr='O' then
vstr:=#15
else if fstr='P' then
vstr:=#16
else if fstr='Q' then
vstr:=#17
else if fstr='R' then
vstr:=#18
else if fstr='S' then
vstr:=#19
else if fstr='T' then
vstr:=#20
else if fstr='U' then
vstr:=#21
else if fstr='v' then
vstr:=#22
else if fstr='W' then
vstr:=#23
else if fstr='X' then
vstr:=#24
else if fstr='Y' then
vstr:=#25
else if fstr='Z' then
vstr:=#26
else
vstr:='';
result:=vstr;
end;
我原先这样用的:
var
ss:string
begin
// #17 是ctrl键的ascii码,#90是Z的ascii码,#13是回车的ascii码
ss:=#17#90#13
Comm1.WriteCommData(Pchar(ss),Length(ss));
end;
但总是不对,后来在网上查到CTRL+ Z 是用组合键的ASCII码的,不是#17#90#13了事,应该这样,
ctrl + a 应该是 #1
.
.
.
ctrl + z 应该是 #25
ctrl + z 应该是 #26
经这样实践之后就ok了。
下边是个输出ctrl + a~z的函数
CtrlStr(a) 等于#1 , 写得有点复杂.
function CtrlStr(fstr:string):string;
var
vstr:string;
begin
fstr:=uppercase(fstr);
if fstr='A' then
vstr:=#1
else if fstr='B' then
vstr:=#2
else if fstr='C' then
vstr:=#3
else if fstr='D' then
vstr:=#4
else if fstr='E' then
vstr:=#5
else if fstr='F' then
vstr:=#6
else if fstr='G' then
vstr:=#7
else if fstr='H' then
vstr:=#8
else if fstr='I' then
vstr:=#9
else if fstr='J' then
vstr:=#10
else if fstr='K' then
vstr:=#11
else if fstr='L' then
vstr:=#12
else if fstr='M' then
vstr:=#13
else if fstr='N' then
vstr:=#14
else if fstr='O' then
vstr:=#15
else if fstr='P' then
vstr:=#16
else if fstr='Q' then
vstr:=#17
else if fstr='R' then
vstr:=#18
else if fstr='S' then
vstr:=#19
else if fstr='T' then
vstr:=#20
else if fstr='U' then
vstr:=#21
else if fstr='v' then
vstr:=#22
else if fstr='W' then
vstr:=#23
else if fstr='X' then
vstr:=#24
else if fstr='Y' then
vstr:=#25
else if fstr='Z' then
vstr:=#26
else
vstr:='';
result:=vstr;
end;




