K
kcahcn
Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码没问题。 不过如果把<br>whdc:=form1.Canvas.handle; 改为<br>whdc:=Getdc(form1.handle); <br>GetCharacterPlacement的返回值为0 ,为什么?怎么解决?<br>如果知道窗体的句丙(别的程序的窗体),怎么能成功的利用以下代码。。<br>用GetDC取得DC好像不对。用其他的API取得DC都会导致GetCharacterPlacement的返回值为0。。<br>代码:-<br><br>const maxlength=512;<br><br>var<br> m_gcp:GCP_RESULTS ;<br> m_strOut : array[0..maxlength]of char;<br> m_dx : array [0..maxlength] of integer;<br> m_order : array[0..maxlength]of cardinal;<br> m_caret : array[0..maxlength]of integer;<br> m_class : array [0..maxlength]of char;<br> m_glyphs : array[0..maxlength]of UINT;<br> mess:string;<br> whDC:HDC;<br> ret:integer;<br>begin<br> mess:='abc'#$c7#$c8#$c9#$ca;<br><br> FillMemory(@m_gcp, sizeof(m_gcp), 0);<br> m_gcp.lStructSize := sizeof(GCP_RESULTS);<br> m_gcp.lpOutString := m_strOut;<br> m_gcp.lpOrder := @m_order;<br> m_gcp.lpDx := @m_dx;<br> m_gcp.lpCaretPos := @m_caret;<br> m_gcp.lpClass := @m_class;<br> m_gcp.lpGlyphs := @m_glyphs;<br> m_gcp.nGlyphs := maxlength;<br> Form1.Font.Charset:=ARABIC_CHARSET ;<br> whdc:=form1.Canvas.handle;<br> //SetTextAlign(whDC, TA_LEFT or TA_RTLREADING);<br> ret:=GetCharacterPlacement(whDC, Pchar(mess), 7, 0, m_gcp, 0);<br>...<br>end;