Date: 02-16-2022
Return to Index
created by gbSnippets
'Primary Code:
UTC - Greenwich, England
Local Time - where the PC is located
TYPE SYSTEMTIME
wYear AS WORD
wMonth AS WORD
wDayOfWeek AS WORD
wDay AS WORD
wHour AS WORD
wMinute AS WORD
wSecond AS WORD
wMilliseconds AS WORD
END TYPE
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Include "commctrl.inc"
%IDC_Calendar = 500
Global hDlg,hCalendar as Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Calendar",300,300,400,400, %WS_OverlappedWindow To hDlg
Control Add "SysMonthCal32", hDlg, %IDC_Calendar, "Test", -200,-200, 180,160, %WS_Child or %WS_Visible
Control Handle hDlg, %IDC_Calendar To hCalendar
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local x,y,iResult As Long, pt as Point
Static DT As SystemTime
Select Case Cb.msg
Case %WM_ContextMenu
pt.x = Lo(Integer,Cb.LParam) : pt.y = Hi(Integer, Cb.LParam)
ScreenToClient hDlg, pt 'x and y are now dialog client coordinates
Control Set Loc hDlg, %IDC_Calendar, pt.x,pt.y
Case %WM_Notify
Select Case Cb.NMID
Case %IDC_Calendar
Select Case CB.nmcode
Case %MCN_Select
iResult = DateTime_GetSystemtime(hCalendar, DT)
Dialog Set Text hDlg, Str$(DT.wmonth) + "-" + Str$(DT.wday) + "-" + Str$(DT.wyear)
Control Set Loc hDlg, %IDC_Calendar, -200,-200
End Select
End Select
End Select
End Function
'gbs_00771
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm