Change This API code to delphi language

Please discuss general Delphi programming topics here.

Change This API code to delphi language

Postby ham » August 19th, 2010, 8:51 am

hi,

please help to Change This API code to delphi language ( http://rapidshare.com/files/413848764/33.cls )

Delphi TrayIcon component (or other component ) have this animate?? (i use D2010)

thank you.
ham
Active Member
Active Member
 
Posts: 9
Joined: August 16th, 2010, 1:37 pm

Re: Change This API code to delphi language

Postby Kambiz » August 19th, 2010, 5:30 pm

Delphi 2010 has already TTrayIcon component.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2424
Joined: March 7th, 2003, 7:10 pm

Re: Change This API code to delphi language

Postby ham » August 19th, 2010, 9:09 pm

Kambiz wrote:Delphi 2010 has already TTrayIcon component.


Yes, but i want to make it with animate. For Delphi7 a component (cooltrayicon) exist but i use Delphi 2010 TTrayIcon component and want to make a program with this
animate. for example Windows Live messenger software has this animate when we GoToTray it. Or babylon software has this animate.

See below codes. This contains API code for make a program like babylon ( or windows live messenger ) animate when gotoTray or GofromTray.

thank you.

Code: Select all
Option Explicit
Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
Declare Function DrawAnimatedRects Lib "user32" (ByVal hWnd As Long, ByVal idAni As Long, lprcFrom As RECT, lprcTo As RECT) As Long
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Const GW_CHILD = 5
Public Const GW_HWNDFIRST = 0
Public Const GW_HWNDLAST = 1
Public Const GW_HWNDNEXT = 2
Public Const GW_HWNDPREV = 3
Public Const GWL_WNDPROC = (-4)
Public Const IDANI_OPEN = &H1
Public Const IDANI_CLOSE = &H2
Public Const IDANI_CAPTION = &H3
Public Const WM_USER = &H400
Public rctFrom As RECT
Public rctTo As RECT
Public lngTrayHand As Long
Public lngStartMenuHand As Long
Public lngChildHand As Long
Public strClass As String * 255
Public lngClassNameLen As Long
Public lngRetVal As Long

Public Function TitleToTray(frm As Form)
    lngStartMenuHand = FindWindow("Shell_TrayWnd", vbNullString)
    lngChildHand = GetWindow(lngStartMenuHand, GW_CHILD)
    Do
        lngClassNameLen = GetClassName(lngChildHand, strClass, Len(strClass))
        If InStr(1, strClass, "TrayNotifyWnd") Then
            lngTrayHand = lngChildHand
            Exit Do
        End If
        lngChildHand = GetWindow(lngChildHand, GW_HWNDNEXT)
    Loop
    lngRetVal = GetWindowRect(frm.hWnd, rctFrom)
    lngRetVal = GetWindowRect(lngTrayHand, rctTo)
    lngRetVal = DrawAnimatedRects(frm.hWnd, IDANI_OPEN Or IDANI_CAPTION, rctFrom, rctTo)
End Function

Public Function TrayToTitle(frm As Form)
    lngStartMenuHand = FindWindow("Shell_TrayWnd", vbNullString)
    lngChildHand = GetWindow(lngStartMenuHand, GW_CHILD)
    Do
        lngClassNameLen = GetClassName(lngChildHand, strClass, Len(strClass))
        If InStr(1, strClass, "TrayNotifyWnd") Then
            lngTrayHand = lngChildHand
            Exit Do
        End If
        lngChildHand = GetWindow(lngChildHand, GW_HWNDNEXT)
    Loop
    lngRetVal = GetWindowRect(frm.hWnd, rctFrom)
    lngRetVal = GetWindowRect(lngTrayHand, rctTo)
    lngRetVal = DrawAnimatedRects(frm.hWnd, IDANI_CLOSE Or IDANI_CAPTION, rctTo, rctFrom)
End Function

ham
Active Member
Active Member
 
Posts: 9
Joined: August 16th, 2010, 1:37 pm

Re: Change This API code to delphi language

Postby Kambiz » August 20th, 2010, 7:00 am

Animating of TTrayIcon is as simple as assigning an ImageList to its Icons property and setting the Animate property to true.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2424
Joined: March 7th, 2003, 7:10 pm

Re: Change This API code to delphi language

Postby ham » August 20th, 2010, 9:16 am

Please see attach file.In this package we have two folder. i want to make animate like folder2 program. TTrayIcon has this animate?

Thanks.
Attachments
animate.rar
(9.01 KiB) Downloaded 82 times
ham
Active Member
Active Member
 
Posts: 9
Joined: August 16th, 2010, 1:37 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron