Delphi6 Personal、Win2000の環境です。
Borland\Delphi6\Source\Rtl\Win\CommCtrl.pasにある以下の関数を使いたいのですが、'rgst:PSystemTime'の具体的な指定方法がわかりません。
function MonthCal_GetMonthRange(hmc: HWND; gmr: DWORD; rgst: PSystemTime): DWORD;
MSDNでの説明では、'Pointer to a two-element array of SYSTEMTIME structures'となっています。
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/c
話が前後しますが、TMonthCalendarの表示月を取得する為にこの関数を使おうとしました。この目的自体はを参考に、同様な感じで達成しています。
http://leed.issp.u-tokyo.ac.jp/~takeuchi/delphi/article/040/040674.html
が、その関連の一連のやり取りに
>>引用開始
var
st: array[0..1] of TSystemTime;
begin
MonthCal_GetMonthRange(MonthCalendar1.Handle, GMR_VISIBLE, st);
とすれば表示中の内容で st[0] に最初の日, st[1] に最後の日が入ります。
>>引用終了
http://leed.issp.u-tokyo.ac.jp/~takeuchi/delphi/article/040/040651.html
というのがあり、これを実行しようとしました。
>>st: array[0..1] of TSystemTime;
この部分がTSytemTimeは違うというとで、PSystemTimeにしたりしましたが、
'Array' と 'PSystemTime' には互換性がありません
というエラーが発生します。その他にも、いろいろ試してみましたがうまくいきませんでした。
個人的にちょっとポインタとかは理解が進んでおらず、キーワードが適切でなかったのかもしれませんが、Web上でもほとんど例が見つからず、私個人の力では解決に至りませんでした。後学の為にぜひとも知っておきたいので、ご存知であればご教授ください。よろしくお願いします。
一部リンクミスがありましたので訂正します。
MSDNでの説明では、'Pointer to a two-element array of SYSTEMTIME structures'となっています。
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/datetime/macros/datetime_getrange.asp?frame=true
すみません。再度、間違ってましたので訂正します。(恥
MSDNでの説明では、'Pointer to a two-element array of SYSTEMTIME structures'となっています。
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/monthcal/messages/mcm_getmonthrange.asp?frame=true
たびたびすみません。気をつけます。
MSDNでの説明では、'Pointer to a two-element array of SYSTEMTIME structures'となっています。
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/monthcal/macros/monthcal_getmonthrange.asp?frame=true
こうすれば、コンパイルできますね。
procedure TForm1.Button3Click(Sender: TObject);
var
st: array[0..1] of TSystemTime;
begin
MonthCal_GetMonthRange(MonthCalendar1.Handle, GMR_VISIBLE, @st);
MessageDlg(IntToStr(st[0].wDay) + '〜' + IntToStr(st[1].wDay), mtInformation, [mbOk], 0);
end;
igyさん、解決でき、すっきりしました。
どうもありがとうございました。
ツイート | ![]() |