获取状态栏文本

时间:2013-03-02 23:33:41

标签: c++ windows winapi statusbar

我正在尝试从我的程序状态栏中检索文本,以便我可以在wm_drawitem事件期间使用它。以下代码返回statustext的零值,而不是第一个窗格文本。

char statusText[1024];

int nLength = SendMessage(hStatus, SB_GETTEXTLENGTH, (WPARAM)0, 0);
int len = SendMessage (hStatus, SB_GETTEXT, (WPARAM)0, (LPARAM)statusText);

我缺少什么想法?

状态栏的设置如下:

int parts[3] = { 100, 408, 508};
SendMessage(hStatus, SB_SETPARTS, 3, (LPARAM)&parts);
SendMessage(hStatus, SB_SETTEXT, SBT_OWNERDRAW|SBT_NOBORDERS|0, (LPARAM)"Ready");
SendMessage(hStatus, SB_SETTEXT, SBT_OWNERDRAW|SBT_NOBORDERS|1, (LPARAM)NULL);
SendMessage(hStatus, SB_SETTEXT, SBT_OWNERDRAW|SBT_NOBORDERS|2, (LPARAM)timeStr); 
SendMessage(hStatus, SB_SETBKCOLOR , 0, (LPARAM)RGB(219,227,250));

0 个答案:

没有答案