Visual Basic, .NET, ASP, VBA, VBScript
 
  Библиотека кодов  
  Работа с WINDOWS  
     
  Изменение внешнего вида кнопки ПУСК  
  Для изменения внешнего вида кнопки ПУСК вам нужна любая картинка размером 55 пикс * 22 пикс. под именем temp.bmp
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Const SRCCOPY = &HCC0020

Dim hwndTB As Long ' handle taskbar'а
Dim hWndSB As Long ' handle окна кнопки ПУСК
Dim hDcSB As Long ' handle содержимого кнопки ПУСК
Dim mRect As RECT ' координаты кнопки ПУСК
Dim hDcTmp As Long ' handle новой картинки
Dim hBmpTmp As Long ' временная картинка
Dim hBmpTmp2 As Long ' временная картинка
Dim nWidth As Long ' ширина кнопки ПУСК
Dim nHeight As Long ' высота кнопки ПУСК
Dim sPath As String ' путь к картинке

Private Sub Form_Load()
' получить handle taskbar и кнопки ПУСК
hwndTB = FindWindow("Shell_TrayWnd", "")
hWndSB = FindWindowEx(hwndTB, 0, "button", vbNullString)
' получить dc кнопки ПУСК
hDcSB = GetWindowDC(hWndSB)
' получить координаты кнопки ПУСК
Call GetWindowRect(hWndSB, mRect)
' ширина и высота
nWidth = mRect.Right - mRect.Left
nHeight = mRect.Bottom - mRect.Top
hDcTmp = CreateCompatibleDC(hDcSB)
hBmpTmp = CreateCompatibleBitmap(hDcTmp, nWidth, nHeight)
' установить путь для загрузки картинки
sPath = App.Path & "\temp.bmp"
hBmpTmp2 = SelectObject(hDcTmp, LoadPicture(sPath))
End Sub

Private Sub tmrPaint_Timer()
' рисовать кнопку ПУСК
Call BitBlt(hDcSB, 0, 0, nWidth, nHeight, hDcTmp, 0, 0, SRCCOPY)
End Sub

Private Sub Form_Unload(Cancel As Integer)
' очистить кнопку ПУСК
hBmpTmp = SelectObject(hDcTmp, hBmpTmp2)
DeleteObject hBmpTmp
DeleteDC hDcTmp
End Sub
 
     
  VBNet online (всего: 52050)  
 

Логин:

Пароль:

Регистрация, забыли пароль?


В чате сейчас человек
 
     
  VBNet рекомендует  
   
     
  Лучшие материалы  
 
ActiveX контролы (112)
Hitman74_Library (36119)
WindowsXPControls (20739)
FlexGridPlus (19374)
DSMAniGifControl (18295)
FreeButton (15157)
Примеры кода (546)
Parol (18027)
Passworder (9299)
Screen saver (7654)
Kerish AI (5817)
Folder_L (5768)
Статьи по VB (136)
Мое второе впечатление... (11236)
VB .NET: дорога в будущее (11161)
Основы SQL (9225)
Сообщения Windows в Vi... (8788)
Классовая теория прогр... (8619)
 
     
Техническая поддержка MTW-хостинг | © Copyright 2002-2011 VBNet.RU | Пишите нам