如何得到windows标准的statusbar上的文本?(100分)

  • 主题发起人 主题发起人 cAkk
  • 开始时间 开始时间
C

cAkk

Unregistered / Unconfirmed
GUEST, unregistred user!
要求很简单,只要能得到标准的statusbar上的文本就可以了.<br><br>注意:一定要是"标准"的statusbar,比如vb,vc的程序做出来的,delphi自己<br>的不是标准statusbar.<br><br>提示: 使用消息SB_GETTEXT
 
考虑先得到statusbar的handle,然后用api来可以的吧?!<br>
 
delphi为什么要什么都自己搞一套?连对话框都不一样?!<br>而且我认为delphi界面没有VB的看着舒服...
 
邹光先: 怎样都可以,只要能得到文本(别告诉我用眼睛看)
 
&gt;&gt;别告诉我用眼睛看<br>用别人的眼睛看,以后问他,可以吗?<br><br>哈哈哈哈哈哈哈哈!<br><br>收剑,拂袖,狂笑,扬长而去,<br>留下cAkk气得半死。。。。
 
小声地问一句,delphi的statusbar 和别的不一样吗?<br>请指教。
 
api 不太会。
 
var<br>&nbsp; sText: string;<br>...<br>SendMessage(StatusBar.Handle, SB_GETTEXT, 0, Integer(PChar(sText)));<br><br>以下是MSDN中对消息SB_GETTEXT的解释:<br>The SB_GETTEXT message retrieves the text from the specified part of a status window. <br><br>SB_GETTEXT <br>&nbsp; &nbsp; wParam = (WPARAM) iPart; <br>&nbsp; &nbsp; lParam = (LPARAM) (LPSTR) szText; <br><br>Parameters<br>iPart <br>&nbsp; Zero-based index of the part from which to retrieve text. <br>szText <br>&nbsp; Pointer to the buffer that receives the text. This parameter is a null-terminated string. <br><br>Return Values<br>Returns a 32-bit value that consists of two 16-bit values. The low word specifies the length, in characters, of the text. The high word specifies the type of operation used to draw the text. The type can be one of the following values: 0 The text is drawn with a border to appear lower than the plane of the window. <br>SBT_NOBORDERS The text is drawn without borders. <br>SBT_POPOUT The text is drawn with a border to appear higher than the plane of the window. <br>SBT_RTLREADING The text will be displayed in the opposite direction to the text in the parent window. <br><br><br>If the text has the SBT_OWNERDRAW drawing type, this message returns the 32-bit value associated with the text instead of the length and operation type. <br><br>Remarks<br>Normal windows display text left-to-right (LTR). Windows can be mirrored to display languages such as Hebrew or Arabic that read right-to-left (RTL). If SBT_RTLREADING is set, the szText string will read in the opposite direction from the text in the parent window.<br><br>
 
xWolf: 你试过吗? 我以前就是这么做的,好像不行.
 
g = &nbsp;cAkk打了一个饱咯。
 
&gt;一定要是"标准"的statusbar,比如vb,vc的程序做出来的,delphi自己<br>&gt;的不是标准statusbar<br>似乎不能说是"标准"的吧,在windows的静态类中没有它。<br>不过是vb,vc所实现的statusbar,<br>delphi于是自己也实现了一个。<br><br>用钩子应该可以吧。
 
"标准"的statusbar是comctrl.dll(名字可能不准确)里面的,类似listview等....<br>vb,vc都是这样实现的.
 
"标准"的statusbar是通过comctl32.dll中的CreateStatusWindowA创建的,<br>Delphi中Commctrl中CreateStatusWindow即是,<br>用SB_GETTEXT确实得不到Text,我刚刚试了.
 
再打一个饱咯.
 
g<br><br>再加100悬赏答案.
 
&nbsp;先得到statusbar的窗口Handle,再用Message Hook得道该Handle的所有消息,<br>最后由你的程序将这些消息发给statusbar的Handle.
 
后退
顶部