home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / sendun1a / api.bas next >
Encoding:
BASIC Source File  |  1999-10-21  |  4.0 KB  |  125 lines

  1. Attribute VB_Name = "API"
  2. Option Explicit
  3.  
  4.  
  5. Type SYSTEMTIME '16 bit
  6.     wYear As Integer
  7.     wMonth As Integer
  8.     wDayOfWeek As Integer
  9.     wDay As Integer
  10.     wHour As Integer
  11.     wMinute As Integer
  12.     wSecond As Integer
  13.     wMilliseconds As Integer
  14. End Type
  15.  
  16. 'api cacasoft
  17. 'Type TIME_ZONE_INFORMATION ' 172 Bytes
  18. 'Bias As Long
  19. 'StandardName(32) As Integer
  20. 'StandardDate As SYSTEMTIME
  21. 'StandardBias As Long
  22. 'DaylightName(32) As Integer
  23. 'DaylightDate As SYSTEMTIME
  24. 'DaylightBias As Long
  25. 'End Type
  26.  
  27. Type TIME_ZONE_INFORMATION  '32 bit
  28.     Bias As Long
  29.     StandardName(31) As Integer
  30.     StandardDate As SYSTEMTIME
  31.     StandardBias As Long
  32.     DaylightName(31) As Integer
  33.     DaylightDate As SYSTEMTIME
  34.     DaylightBias As Long
  35. End Type
  36.  
  37. Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation _
  38.     As TIME_ZONE_INFORMATION) As Long
  39.     
  40.  
  41. Public Declare Function timeGetTime Lib "winmm.dll" () As Long
  42.  
  43. Public Type MIME_DATA
  44.     SMTP_SERVER As String
  45.     SMTP_PORT   As Long
  46.     SMTP_MAIL   As String
  47.     SMTP_MAILTO As String
  48. End Type
  49.  
  50. Declare Function ShellExecute Lib "shell32.dll" Alias _
  51.     "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, _
  52.         ByVal lpFile As String, ByVal lpParameters As String, ByVal _
  53.             lpDirectory As String, ByVal nShowCmd As Long) As Long
  54.  
  55. 'deshabilitar close
  56. Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
  57. Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
  58. Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
  59. Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nSize As Long, ByVal wFlags As Long) As Long
  60. Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
  61.  
  62. Const MF_BYPOSITION = &H400&
  63. Const MF_REMOVE = &H1000&
  64.  
  65. 'Cambiar de Icono
  66. Public Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
  67. Public Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Any) As Long
  68. Public Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
  69. Public Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  70. Public Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  71.  
  72. 'constants
  73. Public Const GCL_HCURSOR = -12
  74. Global curSelect As StdPicture
  75. Public Function GetLocalTZ(Optional ByRef strTZName As String) As Long
  76.  
  77.     Dim objTimeZone As TIME_ZONE_INFORMATION
  78.     Dim lngResult As Long
  79.     Dim i As Long
  80.     
  81.     lngResult = GetTimeZoneInformation&(objTimeZone)
  82.  
  83.     Select Case lngResult
  84.         Case 0&, 1& 'hora estandar
  85.             GetLocalTZ = -(objTimeZone.Bias + objTimeZone.StandardBias) * 60 'into minutes
  86.  
  87.             For i = 0 To 31
  88.                 If objTimeZone.StandardName(i) = 0 Then Exit For
  89.                 strTZName = strTZName & Chr(objTimeZone.StandardName(i))
  90.             Next
  91.         Case 2& 'dias salvan horas de luz
  92.         
  93.             GetLocalTZ = -(objTimeZone.Bias + objTimeZone.DaylightBias) * 60 'into minutes
  94.             
  95.             For i = 0 To 31
  96.                 If objTimeZone.DaylightName(i) = 0 Then Exit For
  97.                 strTZName = strTZName & Chr(objTimeZone.DaylightName(i))
  98.             Next
  99.     End Select
  100.  
  101. End Function
  102.  
  103. Sub DisableX(frm As Form)
  104.      
  105.     Dim hMenu As Long
  106.     Dim nCount As Long
  107.     
  108.     hMenu = GetSystemMenu(frm.hWnd, 0)
  109.     nCount = GetMenuItemCount(hMenu)
  110.  
  111.     Call RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
  112.     Call RemoveMenu(hMenu, nCount - 2, MF_REMOVE Or MF_BYPOSITION)
  113.  
  114.     DrawMenuBar frm.hWnd
  115.      
  116.     Const SC_SIZE = &HF000
  117.     Const MF_BYCOMMAND = &H0
  118.     
  119.     hMenu = GetSystemMenu(frm.hWnd, 0)
  120.     
  121.     Call DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND)
  122.  
  123.      
  124. End Sub
  125.