ホーム › Globalization › GetCalendarSupportedDateRange
GetCalendarSupportedDateRange
関数暦がサポートする日付範囲を取得する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL GetCalendarSupportedDateRange(
DWORD Calendar,
CALDATETIME* lpCalMinDateTime,
CALDATETIME* lpCalMaxDateTime
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Calendar | DWORD | in |
| lpCalMinDateTime | CALDATETIME* | out |
| lpCalMaxDateTime | CALDATETIME* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL GetCalendarSupportedDateRange(
DWORD Calendar,
CALDATETIME* lpCalMinDateTime,
CALDATETIME* lpCalMaxDateTime
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool GetCalendarSupportedDateRange(
uint Calendar, // DWORD
IntPtr lpCalMinDateTime, // CALDATETIME* out
IntPtr lpCalMaxDateTime // CALDATETIME* out
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function GetCalendarSupportedDateRange(
Calendar As UInteger, ' DWORD
lpCalMinDateTime As IntPtr, ' CALDATETIME* out
lpCalMaxDateTime As IntPtr ' CALDATETIME* out
) As Boolean
End Function' Calendar : DWORD
' lpCalMinDateTime : CALDATETIME* out
' lpCalMaxDateTime : CALDATETIME* out
Declare PtrSafe Function GetCalendarSupportedDateRange Lib "kernel32" ( _
ByVal Calendar As Long, _
ByVal lpCalMinDateTime As LongPtr, _
ByVal lpCalMaxDateTime As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetCalendarSupportedDateRange = ctypes.windll.kernel32.GetCalendarSupportedDateRange
GetCalendarSupportedDateRange.restype = wintypes.BOOL
GetCalendarSupportedDateRange.argtypes = [
wintypes.DWORD, # Calendar : DWORD
ctypes.c_void_p, # lpCalMinDateTime : CALDATETIME* out
ctypes.c_void_p, # lpCalMaxDateTime : CALDATETIME* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetCalendarSupportedDateRange = Fiddle::Function.new(
lib['GetCalendarSupportedDateRange'],
[
-Fiddle::TYPE_INT, # Calendar : DWORD
Fiddle::TYPE_VOIDP, # lpCalMinDateTime : CALDATETIME* out
Fiddle::TYPE_VOIDP, # lpCalMaxDateTime : CALDATETIME* out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn GetCalendarSupportedDateRange(
Calendar: u32, // DWORD
lpCalMinDateTime: *mut CALDATETIME, // CALDATETIME* out
lpCalMaxDateTime: *mut CALDATETIME // CALDATETIME* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool GetCalendarSupportedDateRange(uint Calendar, IntPtr lpCalMinDateTime, IntPtr lpCalMaxDateTime);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetCalendarSupportedDateRange' -Namespace Win32 -PassThru
# $api::GetCalendarSupportedDateRange(Calendar, lpCalMinDateTime, lpCalMaxDateTime)#uselib "KERNEL32.dll"
#func global GetCalendarSupportedDateRange "GetCalendarSupportedDateRange" sptr, sptr, sptr
; GetCalendarSupportedDateRange Calendar, varptr(lpCalMinDateTime), varptr(lpCalMaxDateTime) ; 戻り値は stat
; Calendar : DWORD -> "sptr"
; lpCalMinDateTime : CALDATETIME* out -> "sptr"
; lpCalMaxDateTime : CALDATETIME* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global GetCalendarSupportedDateRange "GetCalendarSupportedDateRange" int, var, var ; res = GetCalendarSupportedDateRange(Calendar, lpCalMinDateTime, lpCalMaxDateTime) ; Calendar : DWORD -> "int" ; lpCalMinDateTime : CALDATETIME* out -> "var" ; lpCalMaxDateTime : CALDATETIME* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global GetCalendarSupportedDateRange "GetCalendarSupportedDateRange" int, sptr, sptr ; res = GetCalendarSupportedDateRange(Calendar, varptr(lpCalMinDateTime), varptr(lpCalMaxDateTime)) ; Calendar : DWORD -> "int" ; lpCalMinDateTime : CALDATETIME* out -> "sptr" ; lpCalMaxDateTime : CALDATETIME* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetCalendarSupportedDateRange(DWORD Calendar, CALDATETIME* lpCalMinDateTime, CALDATETIME* lpCalMaxDateTime) #uselib "KERNEL32.dll" #cfunc global GetCalendarSupportedDateRange "GetCalendarSupportedDateRange" int, var, var ; res = GetCalendarSupportedDateRange(Calendar, lpCalMinDateTime, lpCalMaxDateTime) ; Calendar : DWORD -> "int" ; lpCalMinDateTime : CALDATETIME* out -> "var" ; lpCalMaxDateTime : CALDATETIME* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetCalendarSupportedDateRange(DWORD Calendar, CALDATETIME* lpCalMinDateTime, CALDATETIME* lpCalMaxDateTime) #uselib "KERNEL32.dll" #cfunc global GetCalendarSupportedDateRange "GetCalendarSupportedDateRange" int, intptr, intptr ; res = GetCalendarSupportedDateRange(Calendar, varptr(lpCalMinDateTime), varptr(lpCalMaxDateTime)) ; Calendar : DWORD -> "int" ; lpCalMinDateTime : CALDATETIME* out -> "intptr" ; lpCalMaxDateTime : CALDATETIME* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetCalendarSupportedDateRange = kernel32.NewProc("GetCalendarSupportedDateRange")
)
// Calendar (DWORD), lpCalMinDateTime (CALDATETIME* out), lpCalMaxDateTime (CALDATETIME* out)
r1, _, err := procGetCalendarSupportedDateRange.Call(
uintptr(Calendar),
uintptr(lpCalMinDateTime),
uintptr(lpCalMaxDateTime),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetCalendarSupportedDateRange(
Calendar: DWORD; // DWORD
lpCalMinDateTime: Pointer; // CALDATETIME* out
lpCalMaxDateTime: Pointer // CALDATETIME* out
): BOOL; stdcall;
external 'KERNEL32.dll' name 'GetCalendarSupportedDateRange';result := DllCall("KERNEL32\GetCalendarSupportedDateRange"
, "UInt", Calendar ; DWORD
, "Ptr", lpCalMinDateTime ; CALDATETIME* out
, "Ptr", lpCalMaxDateTime ; CALDATETIME* out
, "Int") ; return: BOOL●GetCalendarSupportedDateRange(Calendar, lpCalMinDateTime, lpCalMaxDateTime) = DLL("KERNEL32.dll", "bool GetCalendarSupportedDateRange(dword, void*, void*)")
# 呼び出し: GetCalendarSupportedDateRange(Calendar, lpCalMinDateTime, lpCalMaxDateTime)
# Calendar : DWORD -> "dword"
# lpCalMinDateTime : CALDATETIME* out -> "void*"
# lpCalMaxDateTime : CALDATETIME* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。