SHSetUnreadMailCountW
関数指定アカウントの未読メール件数を設定する。
シグネチャ
// SHELL32.dll (Unicode / -W)
#include <windows.h>
HRESULT SHSetUnreadMailCountW(
LPCWSTR pszMailAddress,
DWORD dwCount,
LPCWSTR pszShellExecuteCommand
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszMailAddress | LPCWSTR | in |
| dwCount | DWORD | in |
| pszShellExecuteCommand | LPCWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// SHELL32.dll (Unicode / -W)
#include <windows.h>
HRESULT SHSetUnreadMailCountW(
LPCWSTR pszMailAddress,
DWORD dwCount,
LPCWSTR pszShellExecuteCommand
);[DllImport("SHELL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int SHSetUnreadMailCountW(
[MarshalAs(UnmanagedType.LPWStr)] string pszMailAddress, // LPCWSTR
uint dwCount, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pszShellExecuteCommand // LPCWSTR
);<DllImport("SHELL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SHSetUnreadMailCountW(
<MarshalAs(UnmanagedType.LPWStr)> pszMailAddress As String, ' LPCWSTR
dwCount As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pszShellExecuteCommand As String ' LPCWSTR
) As Integer
End Function' pszMailAddress : LPCWSTR
' dwCount : DWORD
' pszShellExecuteCommand : LPCWSTR
Declare PtrSafe Function SHSetUnreadMailCountW Lib "shell32" ( _
ByVal pszMailAddress As LongPtr, _
ByVal dwCount As Long, _
ByVal pszShellExecuteCommand As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHSetUnreadMailCountW = ctypes.windll.shell32.SHSetUnreadMailCountW
SHSetUnreadMailCountW.restype = ctypes.c_int
SHSetUnreadMailCountW.argtypes = [
wintypes.LPCWSTR, # pszMailAddress : LPCWSTR
wintypes.DWORD, # dwCount : DWORD
wintypes.LPCWSTR, # pszShellExecuteCommand : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHSetUnreadMailCountW = Fiddle::Function.new(
lib['SHSetUnreadMailCountW'],
[
Fiddle::TYPE_VOIDP, # pszMailAddress : LPCWSTR
-Fiddle::TYPE_INT, # dwCount : DWORD
Fiddle::TYPE_VOIDP, # pszShellExecuteCommand : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shell32")]
extern "system" {
fn SHSetUnreadMailCountW(
pszMailAddress: *const u16, // LPCWSTR
dwCount: u32, // DWORD
pszShellExecuteCommand: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll", CharSet = CharSet.Unicode)]
public static extern int SHSetUnreadMailCountW([MarshalAs(UnmanagedType.LPWStr)] string pszMailAddress, uint dwCount, [MarshalAs(UnmanagedType.LPWStr)] string pszShellExecuteCommand);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHSetUnreadMailCountW' -Namespace Win32 -PassThru
# $api::SHSetUnreadMailCountW(pszMailAddress, dwCount, pszShellExecuteCommand)#uselib "SHELL32.dll"
#func global SHSetUnreadMailCountW "SHSetUnreadMailCountW" wptr, wptr, wptr
; SHSetUnreadMailCountW pszMailAddress, dwCount, pszShellExecuteCommand ; 戻り値は stat
; pszMailAddress : LPCWSTR -> "wptr"
; dwCount : DWORD -> "wptr"
; pszShellExecuteCommand : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global SHSetUnreadMailCountW "SHSetUnreadMailCountW" wstr, int, wstr
; res = SHSetUnreadMailCountW(pszMailAddress, dwCount, pszShellExecuteCommand)
; pszMailAddress : LPCWSTR -> "wstr"
; dwCount : DWORD -> "int"
; pszShellExecuteCommand : LPCWSTR -> "wstr"; HRESULT SHSetUnreadMailCountW(LPCWSTR pszMailAddress, DWORD dwCount, LPCWSTR pszShellExecuteCommand)
#uselib "SHELL32.dll"
#cfunc global SHSetUnreadMailCountW "SHSetUnreadMailCountW" wstr, int, wstr
; res = SHSetUnreadMailCountW(pszMailAddress, dwCount, pszShellExecuteCommand)
; pszMailAddress : LPCWSTR -> "wstr"
; dwCount : DWORD -> "int"
; pszShellExecuteCommand : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHSetUnreadMailCountW = shell32.NewProc("SHSetUnreadMailCountW")
)
// pszMailAddress (LPCWSTR), dwCount (DWORD), pszShellExecuteCommand (LPCWSTR)
r1, _, err := procSHSetUnreadMailCountW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszMailAddress))),
uintptr(dwCount),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszShellExecuteCommand))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SHSetUnreadMailCountW(
pszMailAddress: PWideChar; // LPCWSTR
dwCount: DWORD; // DWORD
pszShellExecuteCommand: PWideChar // LPCWSTR
): Integer; stdcall;
external 'SHELL32.dll' name 'SHSetUnreadMailCountW';result := DllCall("SHELL32\SHSetUnreadMailCountW"
, "WStr", pszMailAddress ; LPCWSTR
, "UInt", dwCount ; DWORD
, "WStr", pszShellExecuteCommand ; LPCWSTR
, "Int") ; return: HRESULT●SHSetUnreadMailCountW(pszMailAddress, dwCount, pszShellExecuteCommand) = DLL("SHELL32.dll", "int SHSetUnreadMailCountW(char*, dword, char*)")
# 呼び出し: SHSetUnreadMailCountW(pszMailAddress, dwCount, pszShellExecuteCommand)
# pszMailAddress : LPCWSTR -> "char*"
# dwCount : DWORD -> "dword"
# pszShellExecuteCommand : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。