Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

GoldFish

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GoldFish

    Example of 32-bit SDK layered window animation

    Code:
    '+--------------------------------------------------------------------------+
    '|                                GoldFish                                  |
    '|                                                                          |
    '|                   Example of 32-bit layered animation                    |
    '|                                                                          |
    '|   This is a FLAT API transposition of a C# project written by Davidwu    |
    '|                            www.cnpopsoft.com                             | 
    '|                                                                          |
    '+--------------------------------------------------------------------------+
    '|                                                                          |
    '|                         Author Patrice TERRIER                           |
    '|                            copyright(c) 2008                             |
    '|                           www.zapsolution.com                            |
    '|                        [email protected]                          |
    '|                                                                          |
    '+--------------------------------------------------------------------------+
    '|                  Project started on : 09-19-2008 (MM-DD-YYYY)            |
    '|                        Last revised : 09-20-2008 (MM-DD-YYYY)            |
    '+--------------------------------------------------------------------------+
    
    #COMPILE EXE "GoldFish.exe"
    
    #INCLUDE "GoldFish.inc"
    
    '------------------------------------------------------------------------------------------
    ' LOCAL section
    '-----------------------------------------------------------------------------------------
    %FRAME_SizeX = 84 '// Must match the animation frame width
    %FRAME_SizeY = 84 '// Must match the animation frame height
    
    GLOBAL gsImageFullPathName AS STRING
    
    '// Load the GDI+ Dll
    FUNCTION zGdipStart() AS LONG
        DIM GpInput AS GdiplusStartupInput
        GpInput.GdiplusVersion = 1
        IF GdiplusStartup(hGDIplus&, GpInput) = 0 THEN FUNCTION = hGDIplus&
    END FUNCTION
    
    '// GDIPLUS unload (unload the GDIPLUS.DLL)
    SUB zGdipEnd(BYREF hGDIplus AS LONG)
      ' Unload the GDI+ Dll
        IF hGDIplus THEN CALL GdiplusShutdown(hGDIplus): hGDIplus = 0
    END SUB
    
    '// Main entry point
    FUNCTION WINMAIN (BYVAL hInstance     AS LONG, _
                      BYVAL hPrevInstance AS LONG, _
                      BYVAL lpCmdLine     AS ASCIIZ PTR, _
                      BYVAL iCmdShow      AS LONG) AS LONG
    
        LOCAL Msg         AS tagMsg
        LOCAL wc          AS WNDCLASSEXA
        LOCAL zClass      AS ASCIIZ * 80
        LOCAL dwExStyle   AS DWORD
        LOCAL dwStyle     AS DWORD
        LOCAL rc          AS RECT
        LOCAL x           AS LONG
        LOCAL y           AS LONG
        LOCAL hMutex      AS DWORD
        LOCAL hFound      AS DWORD
        LOCAL hMain       AS DWORD
    '
        LOCAL IsInitialized        AS LONG
        LOCAL hGDIplus             AS LONG ' GDIPLUS
    
        zClass = "ZLAYERED"
    '
        hMutex = CreateMutex(BYVAL %Null, 0, zClass)
        IF hMutex THEN
           IF GetLastError = %ERROR_ALREADY_EXISTS THEN
              DO
                 hFound = FindWindow(zClass, ""): IF hFound THEN EXIT DO
                 WHILE PeekMessage(Msg, %NULL, %NULL, %NULL, %PM_REMOVE): WEND
              LOOP
              IF IsIconic(hFound) THEN CALL ShowWindow(hFound, %SW_RESTORE)
              CALL SetForeGroundWindow(hFound)
              FUNCTION = 0
              EXIT FUNCTION
           END IF
        END IF
    
        wc.cbSize = SIZEOF(wc)
        IsInitialized = GetClassInfoEx(GetModuleHandle(""), zClass, wc)
        IF IsInitialized    = 0 THEN
           wc.cbSize        = SIZEOF(wc)
           wc.style         = %CS_HREDRAW OR %CS_VREDRAW OR %CS_DBLCLKS ' OR %CS_DROPSHADOW
           wc.lpfnWndProc   = CODEPTR(WndProc)
           wc.cbClsExtra    = 0
           wc.cbWndExtra    = 0
           wc.hInstance     = GetModuleHandle("")
           wc.hIcon         = LoadIcon(wc.hInstance, "PROGRAM")
           wc.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)
           wc.hbrBackground = %NULL
           wc.lpszMenuName  = %NULL
           wc.lpszClassName = VARPTR(zClass)
           wc.hIconSm       = wc.hIcon
           IF RegisterClassEx(wc) THEN IsInitialized = %TRUE
        END IF
    '
        IF IsInitialized THEN
    
    '      // Init GDIPLUS
           hGDIplus = zGdipStart()
    
         ' Window Extended Style
           dwExStyle = %WS_EX_LAYERED OR %WS_EX_TOPMOST
         ' Windows Style, avoid using %WS_CLIPSIBLINGS OR %WS_CLIPCHILDREN with the Skin Engine
           dwStyle = %WS_POPUP ' OR %WS_CLIPCHILDREN OR %WS_CLIPSIBLINGS
    '
           CALL SetRect(rc, 0, 0, %FRAME_SizeX, %FRAME_SizeY)
    '      // Note: indeed we don't need AdjustWindowRectEx, because we use do not use a non-client area
    '      // but it won't hurt anything to keep it, in case we change our mind ;)
           CALL AdjustWindowRectEx(rc, dwStyle, %FALSE, dwExStyle)  ' Adjust Window To True Requested Size
    '
           x = MAX&((GetSystemMetrics(%SM_CXSCREEN) - rc.nRight - rc.nLeft) \ 2, 0)
           y = MAX&((GetSystemMetrics(%SM_CYSCREEN) - rc.nBottom - rc.nTop) \ 2, 0)
    '
         ' Create The Window
           MyTitle$ = "GoldFish"
           hMain = CreateWindowEx(dwExStyle, _         ' Extended Style For The Window
                                  zClass, _               ' Class Name
                                  (MyTitle$), _           ' Window Title
                                  dwStyle, _              ' Defined Window Style
                                  x, y, _                 ' Window Position
                                  rc.nRight - rc.nLeft, _ ' Calculate Window Width
                                  rc.nBottom - rc.nTop, _ ' Calculate Window Height
                                  %NULL, _                ' No Parent Window
                                  %NULL, _                ' No Menu
                                  wc.hInstance, _         ' Instance
                                  BYVAL %NULL)            ' Dont Pass Anything To WM_CREATE
    '
           IF hMain THEN
              gsImageFullPathName = "GoldFish.png"
              CALL SetImage(hMain, (gsImageFullPathName), 255)
              CALL ShowWindow(hMain, %SW_SHOW)
    
              CALL SetTimer(hMain, 1, 50, %NULL)
              WHILE GetMessage(Msg, %NULL, 0, 0)
                    CALL TranslateMessage(Msg)
                    CALL DispatchMessage(Msg)
              WEND
              CALL KillTimer(hMain, 1)
    
              FUNCTION = msg.wParam
           END IF
    
    '      // UNLOAD GDIPLUS
           CALL zGdipEnd(hGDIplus)
    
        END IF
    '
        IF hMutex THEN CALL CloseHandle(hMutex)
    '
    END FUNCTION
    
    '// Main window procedure
    FUNCTION WndProc(BYVAL hWnd AS LONG, BYVAL Msg AS LONG, BYVAL wParam AS LONG, BYVAL lParam AS LONG) EXPORT AS LONG
    
        SELECT CASE LONG Msg
    
        CASE %WM_KEYDOWN
             IF wParam = &H1B& THEN '// VK_ESCAPE
                CALL DestroyWindow(hWnd)
             END IF
             
        CASE %WM_TIMER
             CALL SetImage(hWnd, (gsImageFullPathName), 255)
             
        CASE %WM_NCHITTEST
             FUNCTION = %HTCAPTION: EXIT FUNCTION
    
        CASE %WM_DESTROY
             CALL PostQuitMessage(0)
             FUNCTION = 0: EXIT FUNCTION
        END SELECT
    
        FUNCTION = DefWindowProc(hWnd, Msg, wParam, lParam)
    
    END FUNCTION
    
    SUB SetImage(BYVAL hWnd AS LONG, zFileName AS ASCIIZ, BYVAL alpha AS LONG)
        LOCAL graphics, DesktopDC, hMemDC, hBmp, OldBmp, Img, imgW, imgH, ImgAttr, x, y, nStepX, nStepY AS LONG
        LOCAL rw AS RECT, bmp AS BITMAP, bi AS BITMAPINFO
        LOCAL dwp AS DWORD PTR
        LOCAL bf AS BLENDFUNCTION
        LOCAL lp, ptSrc AS POINTAPI
        LOCAL lpSize AS SIZEL
    
        STATIC ToTheRight, nFrame AS LONG
        
        CALL GetWindowRect(hWnd, rw)
        lpSize.Cx = rw.nRight - rw.nLeft: lpSize.Cy = rw.nBottom - rw.nTop
    
        RANDOMIZE(TIMER)
        nStepX = 3: nStepY = (RND - 0.5) * 1.5
        lp.Y = rw.nTop + nStepY
        IF ToTheRight THEN
           IF rw.nRight < GetSystemMetrics(%SM_CXSCREEN) + lpSize.Cx THEN
              lp.X = rw.nLeft + nStepX
           ELSE
              ToTheRight = 0
              lp.X = rw.nLeft - nStepX
           END IF
        ELSE
           IF rw.nLeft > - lpSize.Cx THEN
              lp.X = rw.nLeft - nStepX
           ELSE
              ToTheRight = -1
              lp.X = rw.nLeft + nStepX
           END IF
        END IF
        
        INCR nFrame: IF nFrame > 20 THEN nFrame = 1
    
        IF GdipLoadImageFromFile((UCODE$(zFileName)), Img) = 0 THEN
    
           IF ToTheRight THEN CALL GdipImageRotateFlip(Img, 4)
           CALL GdipGetImageWidth(Img, imgW)
           CALL GdipGetImageHeight(Img, imgH)
      
           DesktopDC = GetDC(0)
          
           '// Draw active frame to new memory DC
           hMemDC = CreateCompatibleDC(DesktopDC)
           hBmp = CreateCompatibleBitmap(DesktopDC, imgW, imgH)
           OldBmp = SelectObject(hMemDC, hBmp)
           IF GdipCreateFromHDC(hMemDC, graphics) = 0 THEN
              CALL GdipSetInterpolationMode(graphics, 2)
              CALL GdipDrawImageRectRectI(graphics, Img, 0, 0, lpSize.Cx, lpSize.Cy, nFrame * lpSize.Cx - lpSize.Cx, 0, lpSize.Cx, lpSize.Cy, 2, ImgAttr)
              CALL GdipDeleteGraphics(graphics)
              CALL GdipDisposeImage(Img)
           END IF
          
           CALL GetObject(hBmp, sizeof(bmp), bmp)
          
           bf.BlendOp             = %AC_SRC_OVER
           bf.BlendFlags          = 0
           bf.AlphaFormat         = %AC_SRC_ALPHA '// Use source alpha
           bf.SourceConstantAlpha = 255
          
           CALL UpdateLayeredWindow (hWnd, DesktopDC, lp, lpSize, hMemDC, ptSrc, 0, bf, %ULW_ALPHA)
    
        END IF
        
        CALL SelectObject(hMemDC, OldBmp)
        CALL DeleteObject(hBmp)
        CALL DeleteDC(hMemDC)
        CALL ReleaseDC(0, DesktopDC)
    END SUB
    And now the GoldFish include file

    Code:
    %NULL                                           = 0
    %FALSE                                          = 0
    %TRUE                                           = 1
    %ERROR_ALREADY_EXISTS                           = 183&
    %AC_SRC_OVER                                    = &H00
    %AC_SRC_ALPHA                                   = &H01
    %SW_SHOW                                        = 5&
    %SW_RESTORE                                     = 9&
    %WM_DESTROY                                     = &H0002???
    %WM_NCHITTEST                                   = &H0084???
    %WM_KEYDOWN                                     = &H0100???
    %WM_TIMER                                       = &H0113???
    %HTCAPTION                                      = 2&
    %WS_POPUP                                       = &H80000000&
    %WS_EX_TOPMOST                                  = &H00000008&
    %WS_EX_LAYERED                                  = &H00080000&
    %CS_VREDRAW                                     = &H0001???
    %CS_HREDRAW                                     = &H0002???
    %CS_DBLCLKS                                     = &H0008???
    %PM_REMOVE                                      = &H0001???
    %ULW_ALPHA                                      = &H00000002???
    %SM_CXSCREEN                                    = 0&
    %SM_CYSCREEN                                    = 1&
    %IDC_ARROW                                      = 32512???
    
    TYPE POINTAPI
       x AS LONG   ' LONG x
       y AS LONG   ' LONG y
    END TYPE
    
    TYPE SIZEL
       cx AS LONG   ' LONG x
       cy AS LONG   ' LONG y
    END TYPE
    
    TYPE RECT
       nLeft   AS LONG   ' LONG left
       nTop    AS LONG   ' LONG top
       nRight  AS LONG   ' LONG right
       nBottom AS LONG   ' LONG bottom
    END TYPE
    
    TYPE SECURITY_ATTRIBUTES
       nLength              AS DWORD   ' DWORD nLength
       lpSecurityDescriptor AS DWORD   ' LPVOID lpSecurityDescriptor
       bInheritHandle       AS LONG    ' BOOL bInheritHandle
    END TYPE
    
    TYPE tagMSG
       hwnd    AS DWORD      ' HWND hwnd
       message AS DWORD      ' UINT message
       wParam  AS DWORD      ' WPARAM wParam
       lParam  AS LONG       ' LPARAM lParam
       time    AS DWORD      ' DWORD time
       pt      AS POINTAPI   ' POINT pt
    END TYPE
    
    TYPE BITMAP
       bmType       AS LONG       ' LONG
       bmWidth      AS LONG       ' LONG
       bmHeight     AS LONG       ' LONG
       bmWidthBytes AS LONG       ' LONG
       bmPlanes     AS WORD       ' WORD
       bmBitsPixel  AS WORD       ' WORD
       bmBits       AS BYTE PTR   ' LPVOID
    END TYPE
    
    TYPE BLENDFUNCTION
       BlendOp             AS BYTE
       BlendFlags          AS BYTE
       SourceConstantAlpha AS BYTE
       AlphaFormat         AS BYTE
    END TYPE
    
    TYPE WNDCLASSEXA
       cbSize        AS DWORD        ' UINT        cbSize
       ' /* Win 3.x */
       style         AS DWORD        ' UINT        style
       lpfnWndProc   AS DWORD        ' WNDPROC     lpfnWndProc
       cbClsExtra    AS LONG         ' int         cbClsExtra
       cbWndExtra    AS LONG         ' int         cbWndExtra
       hInstance     AS DWORD        ' HINSTANCE   hInstance
       hIcon         AS DWORD        ' HICON       hIcon
       hCursor       AS DWORD        ' HCURSOR     hCursor
       hbrBackground AS DWORD        ' HBRUSH      hbrBackground
       lpszMenuName  AS ASCIIZ PTR   ' LPCSTR      lpszMenuName
       lpszClassName AS ASCIIZ PTR   ' LPCSTR      lpszClassName
       ' /* Win 4.0 */
       hIconSm       AS DWORD        ' HICON       hIconSm
    END TYPE
    
    TYPE BITMAPINFOHEADER
        biSize AS DWORD
        biWidth AS LONG
        biHeight AS LONG
        biPlanes AS WORD
        biBitCount AS WORD
        biCompression AS DWORD
        biSizeImage AS DWORD
        biXPelsPerMeter AS LONG
        biYPelsPerMeter AS LONG
        biClrUsed AS DWORD
        biClrImportant AS DWORD
    END TYPE
    
    TYPE RGBQUAD
        rgbBlue AS BYTE
        rgbGreen AS BYTE
        rgbRed AS BYTE
        rgbReserved AS BYTE
    END TYPE
    
    TYPE BITMAPINFO
        bmiHeader AS BITMAPINFOHEADER
        bmiColors(256) AS RGBQUAD ' Patrice
    END TYPE
    
    TYPE GdiplusStartupInput
       GdiplusVersion AS LONG             ' Must be 1
       DebugEventCallback AS LONG         ' Ignored on free builds
       SuppressBackgroundThread AS LONG   ' FALSE unless you're prepared to call
                                          ' the hook/unhook functions properly
       SuppressExternalCodecs AS LONG     ' FALSE unless you want GDI+ only to use
                                          ' its internal image codecs.
    END TYPE
    
    DECLARE FUNCTION GdiplusStartup LIB "gdiplus.dll" ALIAS "GdiplusStartup" (token&, inputbuf AS GdiplusStartupInput, OPTIONAL BYVAL outputbuf&) AS LONG
    DECLARE FUNCTION GdiplusShutdown LIB "gdiplus.dll" ALIAS "GdiplusShutdown" (BYVAL token&) AS LONG
    DECLARE FUNCTION GdipLoadImageFromFile LIB "gdiplus.dll" ALIAS "GdipLoadImageFromFile" (zFilName AS ASCIIZ, nImage&) AS LONG
    DECLARE FUNCTION GdipGetImageWidth LIB "gdiplus.dll" ALIAS "GdipGetImageWidth" (BYVAL nImage&, nWidth&) AS LONG
    DECLARE FUNCTION GdipGetImageHeight LIB "gdiplus.dll" ALIAS "GdipGetImageHeight" (BYVAL nImage&, Height&) AS LONG
    DECLARE FUNCTION GdipDisposeImage LIB "gdiplus.dll" ALIAS "GdipDisposeImage" (BYVAL nImage&) AS LONG
    DECLARE FUNCTION GdipCreateFromHDC LIB "gdiplus.dll" ALIAS "GdipCreateFromHDC" (BYVAL hdc&, graphics&) AS LONG
    DECLARE FUNCTION GdipDrawImageRectRectI LIB "gdiplus.dll" ALIAS "GdipDrawImageRectRectI" (BYVAL graphics&, BYVAL nImage&, BYVAL dstx&, BYVAL dsty&, BYVAL dstwidth&, BYVAL dstheight&, BYVAL srcx&, BYVAL srcy&, BYVAL srcwidth&, BYVAL srcheight&, _
                                                                                              BYVAL srcUnit&, OPTIONAL BYVAL imageAttributes&, OPTIONAL BYVAL pCALLBACK&, OPTIONAL BYVAL callbackData&) AS LONG
    DECLARE FUNCTION GdipDeleteGraphics LIB "gdiplus.dll" ALIAS "GdipDeleteGraphics" (BYVAL graphics&) AS LONG
    DECLARE FUNCTION GdipSetInterpolationMode LIB "gdiplus.dll" ALIAS "GdipSetInterpolationMode" (BYVAL graphics&, BYVAL interpolation&) AS LONG
    DECLARE FUNCTION GdipImageRotateFlip LIB "gdiplus.dll" ALIAS "GdipImageRotateFlip" (BYVAL nImage&, BYVAL rfType&) AS LONG
    
    DECLARE FUNCTION AdjustWindowRectEx LIB "USER32.DLL" ALIAS "AdjustWindowRectEx" ( _
       BYREF RECT _                        ' __inout LPRECT lpRect
     , BYVAL DWORD _                       ' __in DWORD dwStyle
     , BYVAL LONG _                        ' __in BOOL bMenu
     , BYVAL DWORD _                       ' __in DWORD dwExStyle
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION CloseHandle LIB "KERNEL32.DLL" ALIAS "CloseHandle" ( _
       BYVAL DWORD _                       ' __in HANDLE hObject
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION CreateCompatibleBitmap LIB "GDI32.DLL" ALIAS "CreateCompatibleBitmap" ( _
       BYVAL DWORD _                       ' __in HDC hdc
     , BYVAL LONG _                        ' __in int cx
     , BYVAL LONG _                        ' __in int cy
     ) AS DWORD                            ' HBITMAP
    
    DECLARE FUNCTION CreateCompatibleDC LIB "GDI32.DLL" ALIAS "CreateCompatibleDC" ( _
       BYVAL DWORD _                       ' __in_opt HDC hdc
     ) AS DWORD                            ' HDC
    
    DECLARE FUNCTION CreateMutex LIB "KERNEL32.DLL" ALIAS "CreateMutexA" ( _
       BYREF SECURITY_ATTRIBUTES _         ' __in_opt LPSECURITY_ATTRIBUTES lpMutexAttributes
     , BYVAL LONG _                        ' __in     BOOL bInitialOwner
     , BYREF ASCIIZ _                      ' __in_opt LPCSTR lpName
     ) AS DWORD                            ' HANDLE
    
    DECLARE FUNCTION CreateWindowEx LIB "USER32.DLL" ALIAS "CreateWindowExA" ( _
       BYVAL DWORD _                       ' __in DWORD dwExStyle
     , BYREF ASCIIZ _                      ' __in_opt LPCSTR lpClassName
     , BYREF ASCIIZ _                      ' __in_opt LPCSTR lpWindowName
     , BYVAL DWORD _                       ' __in DWORD dwStyle
     , BYVAL LONG _                        ' __in int X
     , BYVAL LONG _                        ' __in int Y
     , BYVAL LONG _                        ' __in int nWidth
     , BYVAL LONG _                        ' __in int nHeight
     , BYVAL DWORD _                       ' __in_opt HWND hWndParent
     , BYVAL DWORD _                       ' __in_opt HMENU hMenu
     , BYVAL DWORD _                       ' __in_opt HINSTANCE hInstance
     , BYREF ANY _                         ' __in_opt LPVOID lpParam
     ) AS DWORD                            ' HWND
    
    DECLARE FUNCTION DefWindowProc LIB "USER32.DLL" ALIAS "DefWindowProcA" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     , BYVAL DWORD _                       ' __in UINT Msg
     , BYVAL DWORD _                       ' __in WPARAM wParam
     , BYVAL LONG _                        ' __in LPARAM lParam
     ) AS LONG                             ' LRESULT
    
    DECLARE FUNCTION DeleteDC LIB "GDI32.DLL" ALIAS "DeleteDC" ( _
       BYVAL DWORD _                       ' __in HDC hdc
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION DeleteObject LIB "GDI32.DLL" ALIAS "DeleteObject" ( _
       BYVAL DWORD _                       ' __in HGDIOBJ ho
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION DestroyWindow LIB "USER32.DLL" ALIAS "DestroyWindow" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION DispatchMessage LIB "USER32.DLL" ALIAS "DispatchMessageA" ( _
       BYREF tagMSG _                      ' __in CONST MSG *lpMsg
     ) AS LONG                             ' LRESULT
    
    DECLARE FUNCTION FindWindow LIB "USER32.DLL" ALIAS "FindWindowA" ( _
       BYREF ASCIIZ _                      ' __in_opt LPCSTR lpClassName
     , BYREF ASCIIZ _                      ' __in_opt LPCSTR lpWindowName
     ) AS DWORD                            ' HWND
    
    DECLARE FUNCTION GetClassInfoEx LIB "USER32.DLL" ALIAS "GetClassInfoExA" ( _
       BYVAL DWORD _                       ' __in_opt HINSTANCE hInstance
     , BYREF ASCIIZ _                      ' __in LPCSTR lpszClass
     , BYREF WNDCLASSEXA _                 ' __out LPWNDCLASSEXA lpwcx
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION GetDC LIB "USER32.DLL" ALIAS "GetDC" ( _
       BYVAL DWORD _                       ' __in_opt HWND hWnd
     ) AS DWORD                            ' HDC
    
    DECLARE FUNCTION GetLastError LIB "KERNEL32.DLL" ALIAS "GetLastError" ( _
       ) AS DWORD                          ' DWORD
    
    DECLARE FUNCTION GetMessage LIB "USER32.DLL" ALIAS "GetMessageA" ( _
       BYREF tagMSG _                      ' __out LPMSG lpMsg
     , BYVAL DWORD _                       ' __in_opt HWND hWnd
     , BYVAL DWORD _                       ' __in UINT wMsgFilterMin
     , BYVAL DWORD _                       ' __in UINT wMsgFilterMax
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION GetObject LIB "GDI32.DLL" ALIAS "GetObjectA" ( _
       BYVAL DWORD _                       ' __in HANDLE h
     , BYVAL LONG _                        ' __in int c
     , BYREF ANY _                         ' __out_bcount_opt(c) LPVOID pv
     ) AS LONG                             ' int
    
    DECLARE FUNCTION GetSystemMetrics LIB "USER32.DLL" ALIAS "GetSystemMetrics" ( _
       BYVAL LONG _                        ' __in int nIndex
     ) AS LONG                             ' int
    
    DECLARE FUNCTION GetWindowRect LIB "USER32.DLL" ALIAS "GetWindowRect" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     , BYREF RECT _                        ' __out LPRECT lpRect
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION IsIconic LIB "USER32.DLL" ALIAS "IsIconic" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION KillTimer LIB "USER32.DLL" ALIAS "KillTimer" ( _
       BYVAL DWORD _                       ' __in_opt HWND hWnd
     , BYVAL DWORD _                       ' __in UINT_PTR uIDEvent
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION LoadCursor LIB "USER32.DLL" ALIAS "LoadCursorA" ( _
       BYVAL DWORD _                       ' __in_opt HINSTANCE hInstance
     , BYREF ASCIIZ _                      ' __in LPCSTR lpCursorName
     ) AS DWORD                            ' HCURSOR
    
    DECLARE FUNCTION LoadIcon LIB "USER32.DLL" ALIAS "LoadIconA" ( _
       BYVAL DWORD _                       ' __in_opt HINSTANCE hInstance
     , BYREF ASCIIZ _                      ' __in LPCSTR lpIconName
     ) AS DWORD                            ' HICON
    
    DECLARE FUNCTION PeekMessage LIB "USER32.DLL" ALIAS "PeekMessageA" ( _
       BYREF tagMSG _                      ' __out LPMSG lpMsg
     , BYVAL DWORD _                       ' __in_opt HWND hWnd
     , BYVAL DWORD _                       ' __in UINT wMsgFilterMin
     , BYVAL DWORD _                       ' __in UINT wMsgFilterMax
     , BYVAL DWORD _                       ' __in UINT wRemoveMsg
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION RegisterClassEx LIB "USER32.DLL" ALIAS "RegisterClassExA" ( _
       BYREF WNDCLASSEXA _                 ' __in CONST WNDCLASSEXA *
     ) AS WORD                             ' ATOM
    
    DECLARE FUNCTION ReleaseDC LIB "USER32.DLL" ALIAS "ReleaseDC" ( _
       BYVAL DWORD _                       ' __in_opt HWND hWnd
     , BYVAL DWORD _                       ' __in HDC hDC
     ) AS LONG                             ' int
    
    DECLARE FUNCTION SelectObject LIB "GDI32.DLL" ALIAS "SelectObject" ( _
       BYVAL DWORD _                       ' __in HDC hdc
     , BYVAL DWORD _                       ' __in HGDIOBJ h
     ) AS DWORD                            ' HGDIOBJ
    
    DECLARE FUNCTION SetForegroundWindow LIB "USER32.DLL" ALIAS "SetForegroundWindow" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION SetRect LIB "USER32.DLL" ALIAS "SetRect" ( _
       BYREF RECT _                        ' __out LPRECT lprc
     , BYVAL LONG _                        ' __in int xLeft
     , BYVAL LONG _                        ' __in int yTop
     , BYVAL LONG _                        ' __in int xRight
     , BYVAL LONG _                        ' __in int yBottom
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION SetTimer LIB "USER32.DLL" ALIAS "SetTimer" ( _
       BYVAL DWORD _                       ' __in_opt HWND hWnd
     , BYVAL DWORD _                       ' __in UINT_PTR nIDEvent
     , BYVAL DWORD _                       ' __in UINT uElapse
     , BYVAL DWORD _                       ' __in_opt TIMERPROC lpTimerFunc
     ) AS DWORD                            ' UINT_PTR
    
    DECLARE FUNCTION ShowWindow LIB "USER32.DLL" ALIAS "ShowWindow" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     , BYVAL LONG _                        ' __in int nCmdShow
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION TranslateMessage LIB "USER32.DLL" ALIAS "TranslateMessage" ( _
       BYREF tagMSG _                      ' __in CONST MSG *lpMsg
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION UpdateLayeredWindow LIB "USER32.DLL" ALIAS "UpdateLayeredWindow" ( _
       BYVAL DWORD _                       ' __in HWND hWnd
     , BYVAL DWORD _                       ' __in_opt HDC hdcDst
     , BYREF POINTAPI _                    ' __in_opt POINT *pptDst
     , BYREF SIZEL _                       ' __in_opt SIZE *psize
     , BYVAL DWORD _                       ' __in_opt HDC hdcSrc
     , BYREF POINTAPI _                    ' __in_opt POINT *pptSrc
     , BYVAL DWORD _                       ' __in COLORREF crKey
     , BYREF BLENDFUNCTION _               ' __in_opt BLENDFUNCTION *pblend
     , BYVAL DWORD _                       ' __in_opt BLENDFUNCTION *pblend
     ) AS LONG                             ' BOOL
    
    DECLARE FUNCTION GetModuleHandle LIB "KERNEL32.DLL" ALIAS "GetModuleHandleA" (lpModuleName AS ASCIIZ) AS DWORD
    
    DECLARE SUB PostQuitMessage LIB "USER32.DLL" ALIAS "PostQuitMessage" ( _
       BYVAL LONG _                        ' __in int nExitCode
     )                                     ' VOID
    You can also find the full project on José Roca's forum THERE
    Attached Files
    Last edited by Patrice Terrier; 20 Sep 2008, 12:04 PM. Reason: added missing files
    Patrice Terrier
    www.zapsolution.com
    www.objreader.com
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).
Working...
X