213 lines
6.3 KiB
Plaintext
213 lines
6.3 KiB
Plaintext
*--------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
|
|
*--------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
*< FOXBIN2PRG: Version="1.21" SourceFile="ctl32_common.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
|
|
*
|
|
*
|
|
DEFINE CLASS _util AS custom
|
|
*< CLASSDATA: Baseclass="custom" Timestamp="" Scale="Pixels" Uniqueid="" />
|
|
|
|
#INCLUDE "ctl32.h"
|
|
*<DefinedPropArrayMethod>
|
|
*m: _hinstance
|
|
*m: _hosthwnd
|
|
*m: _isthemeactive
|
|
*m: _objtoclient
|
|
*m: _osversion
|
|
*m: _strformatbytesize
|
|
*m: _themestatus
|
|
*m: _vfpwndproc
|
|
*p: ctlabout
|
|
*p: ctlversion
|
|
*</DefinedPropArrayMethod>
|
|
|
|
*<PropValue>
|
|
ctlabout = ctl32_util - Carlos Alloatti
|
|
ctlversion = 20061010
|
|
Name = "_util"
|
|
*</PropValue>
|
|
|
|
PROCEDURE Init
|
|
|
|
Local Array laDeclaredDlls(1,3)
|
|
Local lnLen
|
|
m.lnLen = Adlls(m.laDeclaredDlls)
|
|
|
|
*!* win32api is used instead of the library name, check these:
|
|
*!* blogs.msdn.com/calvin_hsia/archive/2006/04/27/585305.aspx
|
|
*!* blogs.msdn.com/calvin_hsia/archive/2006/04/24/582479.aspx
|
|
*!* "User32.dll, Gdi32.dll, Kernel32.dll , Advapi32.dll and Mpr.dll are searched (in that order)"
|
|
|
|
If Ascan(m.laDeclaredDlls, [GetWindowLong], 1, m.lnLen , 2, 15) = 0
|
|
Declare Integer GetWindowLong In win32api As GetWindowLong;
|
|
Integer HWnd, ;
|
|
Integer nIndex
|
|
Endif
|
|
|
|
If This._OSVersion() >= CON_OS_WINXP Then
|
|
If Ascan(m.laDeclaredDlls, [IsThemeActive], 1, m.lnLen , 2, 15) = 0
|
|
Declare Integer IsThemeActive In uxtheme.Dll As IsThemeActive
|
|
Endif
|
|
Endif
|
|
|
|
If Ascan(m.laDeclaredDlls, [StrFormatByteSize], 1, m.lnLen , 2, 15) = 0
|
|
Declare Integer StrFormatByteSize In shlwapi;
|
|
integer dw,;
|
|
string szBuf,;
|
|
integer uiBufSize
|
|
Endif
|
|
|
|
ENDPROC
|
|
|
|
PROCEDURE _hinstance
|
|
*!* The GetWindowLong function retrieves information about the specified window.
|
|
|
|
*!* GWL_HINSTANCE retrieves a handle to the application instance.
|
|
|
|
Return GetWindowLong(_vfp.HWnd, GWL_HINSTANCE)
|
|
|
|
ENDPROC
|
|
|
|
PROCEDURE _hosthwnd
|
|
*!* the control must have a parent window. In the case of a standard form, its the
|
|
*!* hWnd of the form. If we have a Top Level Form, we have
|
|
*!* to find the hWnd of the "inner" window of the Form
|
|
|
|
Local m.nhwnd
|
|
|
|
If ThisForm.ShowWindow = CON_SHOWWIN_ASTOPLEVELFORM Or ThisForm.ScrollBars > 0 Then
|
|
*!* Get hWnd of client window of Top Level Form //Craig Boyd//
|
|
#If Version(CON_VER_NUM) >= 900
|
|
m.nhwnd = Sys(2327, Sys(2325, Sys(2326, ThisForm.HWnd)))
|
|
#Else
|
|
m.nhwnd = GetWindow(ThisForm.HWnd, GW_CHILD)
|
|
#Endif
|
|
Else
|
|
m.nhwnd = ThisForm.HWnd
|
|
Endif
|
|
|
|
Return m.nhwnd
|
|
ENDPROC
|
|
|
|
PROCEDURE _isthemeactive
|
|
*!* Tests if a visual style for the current application is active.
|
|
|
|
Return (This._OSVersion() >= CON_OS_WINXP) And (IsThemeActive() = 1)
|
|
|
|
ENDPROC
|
|
|
|
PROCEDURE _objtoclient
|
|
*!* This replaces OBJTOCLIENT that has bugs with pageframes
|
|
|
|
Parameters toControl, tcPosition
|
|
|
|
Local lnPosition As Integer
|
|
|
|
m.tcPosition = Upper(m.tcPosition)
|
|
m.lnPosition = 0
|
|
|
|
Do Case
|
|
|
|
Case m.tcPosition $ [TB]
|
|
Do While Not Upper(m.toControl.BaseClass) == [FORM]
|
|
If Pemstatus(m.toControl, [Top], CON_PEMSTAT_DEFINED) Then
|
|
m.lnPosition = m.lnPosition + m.toControl.Top
|
|
Endif
|
|
If Upper(m.toControl.BaseClass) == [PAGE] Then
|
|
If m.toControl.Parent.TabOrientation = CON_TABOR_TOP Then && Top
|
|
m.lnPosition = m.lnPosition + ;
|
|
m.toControl.Parent.Height - ;
|
|
m.toControl.Parent.PageHeight - ;
|
|
m.toControl.Parent.BorderWidth * 2
|
|
Else
|
|
m.lnPosition = m.lnPosition + 1
|
|
Endif
|
|
Endif
|
|
m.toControl = m.toControl.Parent
|
|
Enddo
|
|
|
|
If m.tcPosition == [B] Then
|
|
m.lnPosition = m.lnPosition + This.Height
|
|
Endif
|
|
|
|
Case m.tcPosition $ [LR]
|
|
Do While Not Upper(m.toControl.BaseClass) == [FORM]
|
|
If Pemstatus(m.toControl, [Left], CON_PEMSTAT_DEFINED) Then
|
|
m.lnPosition = m.lnPosition + m.toControl.Left
|
|
Endif
|
|
If Upper(m.toControl.BaseClass) == [PAGE]
|
|
If m.toControl.Parent.TabOrientation = CON_TABOR_LEFT Then && Left
|
|
m.lnPosition = m.lnPosition + ;
|
|
m.toControl.Parent.Width - ;
|
|
m.toControl.Parent.PageWidth - ;
|
|
m.toControl.Parent.BorderWidth * 2
|
|
Else
|
|
m.lnPosition = m.lnPosition + 1
|
|
Endif
|
|
Endif
|
|
m.toControl = m.toControl.Parent
|
|
Enddo
|
|
|
|
If m.tcPosition == [R] Then
|
|
m.lnPosition = m.lnPosition + This.Width
|
|
Endif
|
|
|
|
Endcase
|
|
|
|
Return m.lnPosition
|
|
|
|
ENDPROC
|
|
|
|
PROCEDURE _osversion
|
|
*!* Returns a numeric value representing the operating system version
|
|
*!* Check ctl32.h for possible values
|
|
*!* ie CON_OS_WINXPSP2 = 5010200
|
|
|
|
Return Val(Os(3)) * 1000000 + Val(Os(4)) * 10000 + Val(Os(8)) * 100 + Val(Os(9))
|
|
|
|
ENDPROC
|
|
|
|
PROCEDURE _strformatbytesize
|
|
*!* Converts a numeric value into a string that represents the number expressed
|
|
*!* as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size.
|
|
|
|
Lparameters tnSize
|
|
|
|
Local lcBuffer
|
|
|
|
m.lcBuffer = Space(254)
|
|
|
|
StrFormatByteSize(m.tnSize, @m.lcBuffer, Len(m.lcBuffer))
|
|
|
|
m.lcBuffer = Alltrim(m.lcBuffer)
|
|
|
|
* Remove chr(0)
|
|
m.lcBuffer = Left(m.lcBuffer, Len(m.lcBuffer)-1)
|
|
|
|
Return m.lcBuffer
|
|
ENDPROC
|
|
|
|
PROCEDURE _themestatus
|
|
*!* Returns the global status of Themes for a VFP Form
|
|
|
|
Return ;
|
|
This._OSVersion() >= CON_OS_WINXP ;
|
|
And IsThemeActive() = 1 ;
|
|
And _Screen.Themes ;
|
|
And Thisform.Themes
|
|
|
|
ENDPROC
|
|
|
|
PROCEDURE _vfpwndproc
|
|
*!* The GetWindowLong function retrieves information about the specified window.
|
|
|
|
*!* GWL_WNDPROC retrieves the address of the window procedure,
|
|
*!* or a handle representing the address of the window procedure.
|
|
*!* You must use the CallWindowProc function to call the window procedure.
|
|
|
|
Return GetWindowLong(_vfp.HWnd, GWL_WNDPROC)
|
|
|
|
ENDPROC
|
|
|
|
ENDDEFINE
|