Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Sancho5555

Новый участник


Сообщения: 8
Благодарности: 2

Профиль | Отправить PM | Цитировать


Вложения
Тип файла: rar Test.rar
(49.3 Kb, 3 просмотров)

Нужен совет. Хочу сделать смену иконки на выделенном объекте.
При таком коде (Хедер SetCursor.nsh) наблюдается мерцание курсора:
Скрытый текст
Код: Выделить весь код
!define OCR_NORMAL      32512
!define OCR_IBEAM       32513
!define OCR_WAIT        32514
!define OCR_CROSS       32515
!define OCR_UP          32516
!define OCR_SIZENWSE    32642
!define OCR_SIZENESW    32643
!define OCR_SIZEWE      32644
!define OCR_SIZENS      32645
!define OCR_SIZEALL     32646
!define OCR_NO          32648
!define OCR_HAND        32649
!define OCR_APPSTARTING 32650

!define SetSystemCursor `!insertmacro SetSystemCursor`
!macro SetSystemCursor Cursor	
System::Call USER32::LoadCursor(i,i${${Cursor}})i.s
System::Call USER32::SetCursor(is)	
!macroend

!define SetFileCursor `!insertmacro SetFileCursor`
!macro SetFileCursor File
System::Call USER32::LoadCursorFromFile(t"${File}")i.s
System::Call USER32::SetCursor(is)
!macroend

А при таком:
Скрытый текст
Код: Выделить весь код
!define OCR_NORMAL      32512
!define OCR_IBEAM       32513
!define OCR_WAIT        32514
!define OCR_CROSS       32515
!define OCR_UP          32516
!define OCR_SIZENWSE    32642
!define OCR_SIZENESW    32643
!define OCR_SIZEWE      32644
!define OCR_SIZENS      32645
!define OCR_SIZEALL     32646
!define OCR_NO          32648
!define OCR_HAND        32649
!define OCR_APPSTARTING 32650

!macro SetCursor
 System::Call user32::SetClassLong(i${Msg},i-12,ir0) 
!macroend

!define SetSystemCursor `!insertmacro SetSystemCursor`
!macro SetSystemCursor Msg Cursor
 System::Call `user32::LoadImage(i0, i ${${Cursor}}, i ${IMAGE_CURSOR}, i 0, i 0, i ${LR_SHARED}) i.r0`
 Push ${Msg}
 !insertmacro SetCursor
!macroend

!define SetFileCursor `!insertmacro SetFileCursor`
!macro SetFileCursor Msg File
 System::Call `user32::LoadImage(i0, t "${File}", i ${IMAGE_CURSOR}, i 0, i 0, i ${LR_LOADFROMFILE}) i.r0`
 Push ${Msg}
 !insertmacro SetCursor
!macroend

происходит применение курсора на все объекты одного класса. Например на кнопку или BMP картинку.
Вот сам код:
Скрытый текст
Код: Выделить весь код
Name "Test"
OutFile "test.exe"

!include MUI2.nsh
!include SetCursor.nsh
!insertmacro MUI_LANGUAGE Russian

Var hCtl
Var Button1
Var Button2
Var Bitmap1
Var Bitmap1_hImage
Var Label1

Page custom Create

Function Create
  
  nsDialogs::Create 1044
  Pop $hCtl
  ${If} $hCtl == error
    Abort
  ${EndIf}
  ${SetSystemCursor} $hCtl OCR_NO
	
	
  ${NSD_CreateButton} 82u 46u 49u 14u "1"
  Pop $Button1
  ${SetSystemCursor} $Button1 OCR_HAND
	
  ${NSD_CreateButton} 180u 46u 49u 14u "2"
  Pop $Button2
	
  ${NSD_CreateLabel} 113u 84u 65u 14u "Проверка"
  Pop $Label1
  
  ${NSD_CreateBitmap} 7u 7u 57u 53u ""
  Pop $Bitmap1
  File "/oname=$PLUGINSDIR\3.bmp" "3.bmp"
  ${NSD_SetImage} $Bitmap1 "$PLUGINSDIR\3.bmp" $Bitmap1_hImage
  ${SetFileCursor} $Bitmap1 `$EXEDIR\cursor1.cur`
	
  nsDialogs::Show $hCtl
FunctionEnd

Section
SectionEnd

Последний раз редактировалось Sancho5555, 01-09-2015 в 05:58.


Отправлено: 03:49, 01-09-2015 | #1804