|
Как сменить курсор у отдельно взятого static в Delphi (WinApi)?
Как сменить курсор у отдельно взятого static ?
Сделал так:
{ Регистрация класса: }
lc.style := cs_hredraw or cs_vredraw;
lc.lpfnWndProc := @MyLblWndProc;
lc.cbClsExtra := 0;
lc.cbWndExtra := 0;
lc.hInstance := hInstance;
lc.hIcon := ExtractIcon(hInstance,PChar(Paramstr(0)),0);
lc.hCursor := LoadCursor(0,IDC_HAND);
lc.hbrBackground := COLOR_BTNFACE;
lc.lpszMenuName := nil;
lc.lpszClassName := 'static_web';
if RegisterClass(lc) = 0 then halt(0);
lbl1:=CreateWindowEx(0,'static_web','www.site.com',bs_pushbutton or ws_child or ws_visible or ws_tabstop, 46, 5, 66, 13, myWnd,0,hInstance,nil);
lbl2:=CreateWindowEx (0,'static','http://www.site.ru',bs_pushbutton or ws_child or ws_visible or ws_tabstop, 46, 23, 90, 15, myWnd,0,hInstance,nil);
///пробовал и так
// Сохранение старой и установка новой оконной процедуры:
stWNDproc:= Pointer(GetWindowLong(lbl2, GWL_WNDPROC));
SetWindowLong(lbl1, GWL_WNDPROC, longint(@MyLblWndProc));
//и так
if not GetClassInfo(hInstance,'static',st_lc) then Halt(0);
stWNDproc:=st_lc.lpfnWndProc;
function MyLblWndProc(wnd: hWnd; msg, wParam,
lParam: longint): longint; stdcall;
begin
case msg of
wm_LButtonDown:
begin
messagebox (mywnd,'запускаем сайт','error',mb_ok);
end;
else Result := CallWindowProc(stWNDproc, wnd, msg, wparam, lparam);
end;
end;
в обоих случаях, при запуске "недопустимая операция".
|