potisanのプログラミングメモ

趣味のプログラマーがプログラミング関係で気になったことや調べたことをいつでも忘れられるようにメモするブログです。はてなブログ無料版なので記事の上の方はたぶん広告です。記事中にも広告挿入されるみたいです。

2021-09-05から1日間の記事一覧

Python3 ディレクトリ内のファイル名をJSONへ出力する

ディレクトリ内のファイル名をJSONへ出力するサンプルコードです。pathlib、jsonを使用しています。 すべてのファイルを列挙する import json from pathlib import Path # ファイル名を取得するディレクトリのパス dir_path = Path(r"C:\Windows") # 作成す…

C# 9 システムフォルダに存在するOS DLLを取得する

C# 9 システムフォルダに存在するOS DLLを取得するサンプルコードです。バージョン情報の製品名が「Microsoft® Windows® Operating System」のDLLをOS DLLとみなしています。 using System; using System.Diagnostics; using System.IO; using System.Linq; …

C++20&Win API(Vista~) 各電源スキームのサブグループのGUID・名前・概要を列挙する

#include <format> #include <iostream> #include <string> #include <vector> #include <optional> #define STRICT #include <Windows.h> #include <powrprof.h> #pragma comment(lib, "powrprof.lib") namespace PowerUtil { std::vector<GUID> GetPowerSchemeGUIDs() { std::vector<GUID> guids; for (ULONG i = 0; ; ++…</guid></guid></powrprof.h></windows.h></optional></vector></string></iostream></format>

C++20&Win API(Vista~) 電源スキームのGUID・名前・概要を列挙する

#include <iostream> #include <string> #include <vector> #include <optional> #define STRICT #include <Windows.h> #include <powrprof.h> #pragma comment(lib, "powrprof.lib") namespace PowerUtil { std::vector<GUID> GetPowerSchemeGUIDs() { std::vector<GUID> guids; for (ULONG i = 0; ; ++i) { GUID guid; DW…</guid></guid></powrprof.h></windows.h></optional></vector></string></iostream>

C++20&Win API(Vista~) 画面の明るさを取得・設定する

Windows Vista以降で画面の明るさを取得・設定するサンプルコードです。 画面の明るさの範囲と設定値を取得する。 画面の明るさを設定する。 現在の画面プロファイルの概要・名前を取得する。 画面の明るさの範囲と設定値を取得する。 #include <iostream> #include <string> #</string></iostream>…