ypmail
04-05-2016, 10:16
Есть скрипт, в котором иконка просто берётся из файла navigation.ico. Нужно сделать так, чтобы эта иконка была зашита в полученный из этого скрипта exe.
Пробовал GUICtrlSetImage(-1, "1.exe", -2). Иконка появляется на кнопке 16x16 или 32x32, или мелкая или крупная и кубиками (у меня она 24x24). Как это обойти?
Нужно, чтобы GUICtrlSetImage выводило иконку именно 24x24.
Код скрипта:
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=1\2.ico
#AutoIt3Wrapper_Res_Icon_Add=D:\3\2\navigation.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <Word.au3>
Global $hParent, $hForm, $hIcon
$hParent = GUICreate('', 116, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)
$hForm = GUICreate('Выбор шаблона таблички', 240, 378, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_DLGMODALFRAME, $hParent)
$hIcon = _WinAPI_GetClassLongEx($hForm, $GCL_HICON)
_WinAPI_DestroyIcon($hIcon)
_WinAPI_SetClassLongEx($hForm, $GCL_HICON, 0)
_WinAPI_SetClassLongEx($hForm, $GCL_HICONSM, 0)
$Button1 = GUICtrlCreateButton(" Документ", 10, 10, 220, 35)
GUICtrlSetFont(-1, 12, 800, 2, "Times New Roman")
GUICtrlSetImage(-1, "D:\3\2\navigation.ico")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $oWord = _Word_Create()
Local $sDocument = "D:\3\2\1.doc"
_Word_DocOpen($oWord, $sDocument)
WinActivate($sDocument)
Exit
EndSwitch
WEnd
Пробовал GUICtrlSetImage(-1, "1.exe", -2). Иконка появляется на кнопке 16x16 или 32x32, или мелкая или крупная и кубиками (у меня она 24x24). Как это обойти?
Нужно, чтобы GUICtrlSetImage выводило иконку именно 24x24.
Код скрипта:
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=1\2.ico
#AutoIt3Wrapper_Res_Icon_Add=D:\3\2\navigation.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <Word.au3>
Global $hParent, $hForm, $hIcon
$hParent = GUICreate('', 116, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)
$hForm = GUICreate('Выбор шаблона таблички', 240, 378, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_DLGMODALFRAME, $hParent)
$hIcon = _WinAPI_GetClassLongEx($hForm, $GCL_HICON)
_WinAPI_DestroyIcon($hIcon)
_WinAPI_SetClassLongEx($hForm, $GCL_HICON, 0)
_WinAPI_SetClassLongEx($hForm, $GCL_HICONSM, 0)
$Button1 = GUICtrlCreateButton(" Документ", 10, 10, 220, 35)
GUICtrlSetFont(-1, 12, 800, 2, "Times New Roman")
GUICtrlSetImage(-1, "D:\3\2\navigation.ico")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $oWord = _Word_Create()
Local $sDocument = "D:\3\2\1.doc"
_Word_DocOpen($oWord, $sDocument)
WinActivate($sDocument)
Exit
EndSwitch
WEnd