1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#![allow(non_camel_case_types, non_snake_case)]
use crate::co;
use crate::decl::*;
use crate::macros::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::taskschd::vts::*;
com_interface! { IRegisteredTask: "9c86f320-dee3-4dd1-b972-a303f26b061e";
/// [`IRegisteredTask`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nn-taskschd-iregisteredtask)
/// COM interface.
///
/// Automatically calls
/// [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release)
/// when the object goes out of scope.
}
impl oleaut_IDispatch for IRegisteredTask {}
impl taskschd_IRegisteredTask for IRegisteredTask {}
/// This trait is enabled with the `taskschd` feature, and provides methods for
/// [`IRegisteredTask`](crate::IRegisteredTask).
///
/// Prefer importing this trait through the prelude:
///
/// ```no_run
/// use winsafe::prelude::*;
/// ```
pub trait taskschd_IRegisteredTask: oleaut_IDispatch {
fn_com_interface_get! { get_Definition: IRegisteredTaskVT => ITaskDefinition;
/// [`IRegisteredTask::get_Definition`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_definition)
/// method.
}
/// [`IRegisteredTask::get_Enabled`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_enabled)
/// method.
#[must_use]
fn get_Enabled(&self) -> HrResult<bool> {
let mut enabled = i16::default();
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).get_Enabled)(self.ptr(), &mut enabled) })
.to_hrresult()
.map(|_| enabled != 0)
}
/// [`IRegisteredTask::get_LastRunTime`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_lastruntime)
/// method.
#[must_use]
fn get_LastRunTime(&self) -> HrResult<f64> {
let mut rt = f64::default();
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).get_LastRunTime)(self.ptr(), &mut rt) })
.to_hrresult()
.map(|_| rt)
}
/// [`IRegisteredTask::get_LastTaskResult`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_lasttaskresult)
/// method.
#[must_use]
fn get_LastTaskResult(&self) -> HrResult<i32> {
let mut r = 0i32;
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).get_LastTaskResult)(self.ptr(), &mut r) })
.to_hrresult()
.map(|_| r)
}
fn_com_bstr_get! { get_Name: IRegisteredTaskVT;
/// [`IRegisteredTask::get_Name`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_name)
/// method.
}
/// [`IRegisteredTask::get_NextRunTime`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_nextruntime)
/// method.
#[must_use]
fn get_NextRunTime(&self) -> HrResult<f64> {
let mut rt = f64::default();
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).get_NextRunTime)(self.ptr(), &mut rt) })
.to_hrresult()
.map(|_| rt)
}
/// [`IRegisteredTask::get_NumberOfMissedRuns`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_numberofmissedruns)
/// method.
#[must_use]
fn get_NumberOfMissedRuns(&self) -> HrResult<i32> {
let mut mr = 0i32;
HrRet(unsafe {
(vt::<IRegisteredTaskVT>(self).get_NumberOfMissedRuns)(self.ptr(), &mut mr)
})
.to_hrresult()
.map(|_| mr)
}
fn_com_bstr_get! { get_Path: IRegisteredTaskVT;
/// [`IRegisteredTask::get_Path`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_path)
/// method.
}
/// [`IRegisteredTask::get_State`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_state)
/// method.
#[must_use]
fn get_State(&self) -> HrResult<co::TASK_STATE> {
let mut state = co::TASK_STATE::default();
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).get_State)(self.ptr(), state.as_mut()) })
.to_hrresult()
.map(|_| state)
}
fn_com_bstr_get! { get_Xml: IRegisteredTaskVT;
/// [`IRegisteredTask::get_Xml`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-get_xml)
/// method.
}
/// [`IRegisteredTask::put_Enabled`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-put_enabled)
/// method.
fn put_Enabled(&self, enabled: bool) -> HrResult<()> {
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).put_Enabled)(self.ptr(), enabled as _) })
.to_hrresult()
}
/// [`IRegisteredTask::Stop`](https://learn.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iregisteredtask-stop)
/// method.
fn Stop(&self) -> HrResult<()> {
HrRet(unsafe { (vt::<IRegisteredTaskVT>(self).Stop)(self.ptr(), 0) }).to_hrresult()
}
}