BitTorrent クライアントが 50 行の C++ コード で書ける、 libtorrentをWindows上で動かしてみる。
- libtorrent の簡単な使い方を見る
| #include <windows.h> | |
| #include <xinput.h> | |
| #include <stdio.h> | |
| // Compatibility for old XInput.h | |
| #ifndef XUSER_MAX_COUNT | |
| #define XUSER_MAX_COUNT 4 | |
| #endif | |
| #pragma comment(lib, "xinput.lib") |
BitTorrent クライアントが 50 行の C++ コード で書ける、 libtorrentをWindows上で動かしてみる。
| // Mutexを用いて、同一アプリケーションの複数起動を判別する | |
| /* | |
| 使い方: | |
| INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT) { | |
| CheckExistingInstance exin("Your App's Unique Identifier String"); | |
| if(exin.isExist()) { | |
| return 0; // 既に存在したので、何もせずに終了 | |
| } | |
| ... | |
| }; |
| #include <windows.h> | |
| #include <tchar.h> | |
| void setStringToClipboard(const TCHAR* str) { | |
| if(OpenClipboard(0)) { | |
| EmptyClipboard(); | |
| size_t l = _tcslen(str); | |
| if(l) { | |
| HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (l+1) * sizeof(*str)); | |
| if(h) { |
| # 作業用ディレクトリ $t を定義 (C:\Users\<ユーザ名>\mytemp) | |
| $t="$env:USERPROFILE\mytemp" | |
| mkdir $t | |
| pushd $t | |
| # 新しいツール類のバイナリを入れるディレクトリ $n を定義 (C:\Users\<ユーザ名>\bin) | |
| $n="$env:USERPROFILE\bin" | |
| # $n を作り、一時的に PATH へ追加 | |
| mkdir -force $n |
| /* | |
| http://www.ouah.org/ogay/sha2/ | |
| から SHA-256 部分だけを抜き出してテキトーに書き換えたもの。BSDライセンス | |
| */ | |
| /* | |
| * FIPS 180-2 SHA-224/256/384/512 implementation | |
| * Last update: 02/02/2007 | |
| * Issue date: 04/30/2005 | |
| * | |
| * Copyright (C) 2005, 2007 Olivier Gay <olivier.gay@a3.epfl.ch> |
xyzzy0.2.2.235のsrc/disp.ccに不完全なアンチエイリアス描画機能をつける。
手元の用途では、等幅のメイリオで十分だと分かったので、 やりかけのまま。
disp.cc を適宜書き換え、src/Makefileのコンパイル指定(CXX)に -DUSE_XYZZY_TEXT_ANTI_ALIAS を追加してから、コンパイルを行う。
iPhone4s 140g, 115x59x10, 3.5in, 960x640
iPodTouch 4G 101g, 111x59x7, 3.5in, 960x640
htc evo 4G 170g, 122x66x13, 4.3in, 800x480
docomo NEXT series GALAXY S II LTE SC-03D
代替コンソールではなく、cmd.exeへのフック。