Unable to invoke Code Completion due to errors in source code - 前些天用delphi编程遇到的

    这种错误: Unable to invoke Code Completion due to errors in source code , 其实以前都时常遇到的,没有太过在意,只是不能用delphi的提示吧了,即你写edit1按下点之后不能出现提示属性,今天才正式去面对这个问题,用大富翁的chm手册查询 , 结果就是编程时,可能不经意的用了些非法字符,只要把整个pas里的文件复制到记事本里,查找非法字符去掉就可以了,原来是这种低级错误,以后要注意点才行,不过用了delphi这么久才去处理这问题,我都算懒了,哈哈…

CTRL的ASCII - delphi的程序

由于帮朋友编程序,程式是用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 [...]