Z
zhengyue
Unregistered / Unconfirmed
GUEST, unregistred user!
动态连接库<br>我在用如下程序调用动态连接库返回的值不正确请问怎么回事?<br>应该怎样改?<br>功能:返回汉字的拼音头<br>var<br> txt1char;<br> txt2:string;<br> moudle:thandle;<br> getpy:Tgetpy;<br>begin <br> moudle:=loadlibrary('pyhead'); //链接动态库<br> @getpy=getprocaddress(moudle,'getpy')//链接动态库已经成功<br> getmem(txt1,sizeof(pchar));<br>txt1=strpcopy(txt1,edit1.txt);<br>txt2:=strpas(getpy(txt1)); //? txt2返回值不正确<br>劳驾各位帮忙,怎样该?<br><br><br>说明:<br>如果不用动态链接库,直接调用getpy函数,着返回值是正确的<br><br>在动态库getpy函数定义为<br>function getpy( hzcharchar)char;<br>begin<br> case WORD(hzchar[0]) shl 8 + WORD(hzchar[1]) of<br> $B0A1..$B0C4 : result := 'A';<br> $B0C5..$B2C0 : result := 'B';<br> $B2C1..$B4ED : result := 'C';<br> $B4EE..$B6E9 : result := 'D';<br> $B6EA..$B7A1 : result := 'E';<br> $B7A2..$B8C0 : result := 'F'; <br> $B8C1..$B9FD : result := 'G';<br> $B9FE..$BBF6 : result := 'H'; <br> $BBF7..$BFA5 : result := 'J'; <br> $BFA6..$C0AB : result := 'K';<br> $C0AC..$C2E7 : result := 'L'; <br> $C2E8..$C4C2 : result := 'M'; <br> $C4C3..$C5B5 : result := 'N';<br> $C5B6..$C5BD : result := 'O'; <br> $C5BE..$C6D9 : result := 'P'; <br> $C6DA..$C8BA : result := 'Q';<br> $C8BB..$C8F5 : result := 'R'; <br> $C8F6..$CBF9 : result := 'S'; <br> $CBFA..$CDD9 : result := 'T';<br> $CDDA..$CEF3 : result := 'W'; <br> $CEF4..$D188 : result := 'X';<br> $D1B9..$D4D0 : result := 'Y';<br> $D4D1..$D7F9 : result := 'Z';<br> else <br> result := char(0);<br> end;<br><br>end;<br>exports getpy; <br><br>