「message」を含む日記 RSS

はてなキーワード: messageとは

2020-01-22

JR新宿駅で起きた、いつもの悲しい出来事

昨日帰宅新宿駅で起こったこと。

私は山手線に乗って、疲れきった体を椅子に預けて携帯を眺めていた。

新宿駅にたどり着いた電車から大勢の人が降り、その後マレー系のお母さんがベビーカー子供を乗せて乗車した。

なぜマレー系かわかるかって?あの顔つきと肌色ヒジャブをまとっていたからに決まっている。2年間、シンガポールのころごまんと見ていた人の姿だ。忘れることもあるまい。

とにかく、彼女子供と一緒に電車に乗り、旦那さんと思われる人が外からスーツケースを手渡し、中に入れ始める。

スーツケースが一つ入ったところで、ドアが閉まる。

母は大慌てでとっさに腕をドアに差し出したが、間一髪で逃し、ドアは冷たく閉じられてしまった。

ホームで見かねた誰かの所業だろう。非常停止ボタンが押された。

非常停止のチャイム叫びのように聞こえる。

嫌な音がホームを通り越し、電車の中の私の耳にも入ってくる。

母はとても困った顔をしていたので、電車の中にいた私は拙い英語で、とにかく通じればいいなというレベル彼女へ声をかけた。

「Send the message to him that you can ride next train what should come in 3 mins so far.」

(3分後に次の電車が来るから旦那さんにそこに乗るようにメッセージしてね。)

当然山手線がそんなに頻繁に来るとは彼女は知る由もない。

相変わらず当惑した表情を隠せない彼女に、もう一言言った。

You'd better to ask staffs to help you in next time。They can help you.」

(次からは駅のスタッフ声かけなよ。助けてくれるからさ。)

彼女の表情が和らぎ始めた。英語からなくても、私の意図は少しは伝わったのかなと思った矢先だった。

鳴り響く警告音の中、制服を着た駅スタッフが駆け込んでいた。

私も彼女も初めて出くわす場面だが、手慣れているだろう。ドアを外からこじ開けようと力む姿が見えた。

スーツケースを入れてもらうのかな。

とにかくうるさいブザー音を消してくれとばかり、心の中で思っていた私が次に観た光景は、そんなことどうでもいいと思わせるようなものだった。

スタッフは、ドアをこじ開けては電車に乗り込み、ありったけのしかめっ面で、母とベビーカーを引きずり下ろした。当然スーツケースは眼中にない。

それもそうかも。何せ車いすのスペースに突っ込んだわけだし、その荷物が隣に立っていた人のものかもしれない。母の携行品はベビーカーしかないと思われても仕方はない。

それでも、荷物はただそこに置かれてあっただけ。

私はすぐさま起き上がり、荷物をドア付近押し出した。

荷物は無事に外に母と一緒に追い出され、ドアは閉まり、駅スタッフは「一つの仕事をやっつけたぞこの野郎」と言わんばかりに、安全確認終了を知らせるランプを高く振りかざす。

車掌無味乾燥アナウンスが響き、電車は動きだした。

これは、一日利用者世界一を記録している駅で起こった、外国人観光客が起こした小さなトラブルだった。

まりにもひどすぎる対応言葉が出てこなかった。

言葉の代わりに、私は思考を巡らせる。

私が彼女旦那だったら、間違いなくブチ切れしていた。

仮にも世界一の駅スタッフが、観光客マニュアル通りに、いつも通りに追い出すのか。

こんなひどい仕打ちを私はほかの国で経験したことがない。

彼女がその時感じたであろう感情がどうだったか想像すらつかない。

旅行って、旅っていつもそうだ。

どこかしらで必ずトラブルは起こる。

他人生活に入りこみ、他人経験追体験する。

喧嘩だってするかもしれないし、財布だって落とすかもしれない。

スリに会うかもしれないし、ぼったくりに会うかもしれない。

はたまた決まったはずの宿が決まってないかもしれない。

今まで述べたトラブルと比べたら、電車一本逃して一行とはぐれるなんて、些細なものに過ぎないだろう。

その記憶が後で振り返ったとき楽しいハプニングとして残るか、散々な目に会ったという苦い思い出として残るかは、その場そこにいた人達がどう接したかにかかっている。

彼女(とその家族)は須らく、その類の数知れないトラブルのうちの一つを、須らく経験してしまった。

少なくともこの国の誇る鉄道の、いちばん誇らしい駅のスタッフは、間違いなく彼女後者の印象を植え付けたのであろう。

なんてことを思う間にふと考えた。

こんなんで、オリンピックって本当に大丈夫か?

仮にもオリンピック公式輸送スポンサー企業スタッフがこんな対応でいいのか?

しかしたら、彼女が私のアドバイス通りに、あらかじめ対応ができたら、駅スタッフだって乗車案内できたはずだ。

彼女は頼るすべを知らなかっただけ。

できるはずのことができないのは、観光客に対するおもてなしが全くできていないという証拠であろう。

いくら上っ面だけ広告宣伝に金を落としたところで、こういう実務的対応一つままできず、塩対応してしまっては元も子もないだろう。

役所気質が抜けていないと改めて感じてがっかり

苦い思いをしてしまった彼女とその家族の姿が今も目に焼き付いている。

もうちょっとうまいことできないのかね。

定時性も大事だけど、そこまでしてやるもの

ただただ残念でならない気持ちを抱いたまま、私は電車の中で揺らいでいた。

2019-12-04

Dialog

message

OK

なんでNOボタンがないんだ?

承諾しないボタンはないのか?

Closeでいいだろ?

たったこれだけのことでもGUIを作るうえでのノウハウから

無料じゃない

たとえばWindows

結婚してください

OK

ってダイアログが起動時に毎回出たら?

Wiondowsの開発者の一人が恋人にやった

どうおもう?

 

いわれなきゃ、わからないことなのかな・・・

そんなわけないよね。

まりわざとやってる

 

おれなんかみんなにきらわれてよ

こうやっておいだされちゃう

もう行く場所がない。

2019-11-13

anond:20191113062655

FacebookMessage だっけ? 

あれソフト起動してないと連絡が来ても気づかないんだよね。

スマホ毎日触ってるけど、ソフト起動してないとかあるんちゃう

2019-09-26

「グレタは二酸化炭素裸眼で見ることができる」についての補足

が元記事に書いてあるので引用する。

https://www.afrinik.com/my-daughter-can-see-co2-with-the-naked-eye/

The publisher of the book in Sweden said: “I was shocked by the commotion in Germany, Belgium and now also in Italy”. “I can assure you that it is a metaphor; if you read the entire passage, end it with the tale of “The New Emperor’s Clothes” by Christian Anderson. So it is certainly not literal.” In a text message, the mother also says that it is only about imagery.

スウェーデンのその本の出版社は「私はドイツベルギー、そして今イタリアで起こっている騒動にショックを受けています」と言った。「私はそれが比喩であると断言できます。この一節全体を読むと、最後クリスチャンアンデルセンの『裸の王様』の物語で締めくくられています。それは文字通りの話でありません。」母親テキストメッセージで、それはイメージに関することだけだとも言っている。

本人のFacebookも。

https://www.facebook.com/gretathunbergsweden/posts/of-course-the-ongoing-hate-campaigns-never-rests-there-is-at-least-one-new-consp/823189474715541/

The latest - and perhaps most entertaining - spin is that ”I can see CO2 with my own eyes”.

This is of course a metaphor from a book taken out of it's context, taken from a German newspaper.

No one has said that I can literally see CO2… that is beyond stupid.

最も新しく、そしておそらく最も面白いフェイクニュースは「自分の目でCO2を見ることができる」ということです。

これはドイツ新聞引用したもので、もちろん文脈から切り取られた比喩です。

私が文字通りCO2を見ることができるとは誰も言っていません…それはあまり馬鹿げています

2019-09-24

グレタ・トゥーンベリ氏 スピーチ全訳 How dare you!

グレタ・トゥーンベリ氏のU.N. Climate Action Summit 2019におけるスピーチ話題になってるわね。

ブコメかに言いたいこともあるけれど、それよりNHKの全訳(https://www3.nhk.or.jp/news/html/20190924/k10012095931000.html)がなんかしっくりこないので、自分で訳してみたわ。

ごめん嘘。バズると思って訳し始めたらNHKの方がずっと早かったの(よくもそんなことができますね!)。せっかくだから書き上げたわ。でもしっくりこないのは本当よ。

私のメッセージ(※1)はこうです。”私たちあなた方を見ています

My message is that we'll be watching you.

これは何もかも間違っています。私はここにいるべきではありません。私は海の向こうの学校に帰るべきです。しかし、あなた方はみんな、私たち若者希望を求めてやってきます。よくもそんなことができますね!

This is all wrong. I shouldn't be up here. I should be back in school on the other side of the ocean. Yet you all come to us young people for hope. How dare you!

あなた方は私の夢を、私の子時代を、その空虚言葉によって奪い去りました。それでも私は幸運な方です。人々は傷ついています。人々は死んでいます生態系完膚なきまでに崩壊しつつあります。我々は大量絶滅の始まりにいるのです。なのにあなた方が話すことと言えばお金のことや永遠に続く経済成長というおとぎ話ばかり。よくもそんなことが言えますね!

You have stolen my dreams and my childhood with your empty words. And yet I'm one of the lucky ones. People are suffering. People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairy tales of eternal economic growth. How dare you!

過去30年以上、科学事実はずっと明確なままでした。よくも目をそらし続けられたものですね。よくもここに来て、”私は十分にやった”などと言えたものですね。必要政策解決策もいまだに見えてこないというのに。

For more than 30 years, the science has been crystal clear. How dare you continue to look away and come here saying that you're doing enough, when the politics and solutions needed are still nowhere in sight.

あなた方は言います私たち言葉を聞いていると。緊急性は理解していると。しかし、どれだけ私が悲しみ、怒っていたとしても、私はその言葉を信じたくはありません。なぜならば、もしもあなた方が本当に状況を理解しており、それにもかかわらず行動を起こしていないとすれば、あなた方は邪悪な人々ということになってしまうからです。だからこそ、私はそう信じることを拒絶します。

You say you hear us and that you understand the urgency. But no matter how sad and angry I am, I do not want to believe that. Because if you really understood the situation and still kept on failing to act, then you would be evil. And that I refuse to believe.

一般的な考えとして、世界の(二酸化炭素)排出量を10年間で半分にするというものがあります。これによって気温上昇を1.5℃に抑えられる確率わずか50%に過ぎず、人類の手に負えない不可逆的な連鎖反応が始まるリスクは依然としてあります

The popular idea of cutting our emissions in half in 10 years only gives us a 50% chance of staying below 1.5 degrees [Celsius], and the risk of setting off irreversible chain reactions beyond human control.

50%という数字あなた方にとっては許容できるものかもしれません。しかし、この数字は転換点(※2)の存在や、多くのフィードバックループ大気汚染に隠れたさらなる温暖化公平性気候正義(※3)の観点を含んでいません。それらはまた私たち世代が、あなた方の出した数千億トンの二酸化炭素を、ほとんど実現すらしていない技術で以て大気から取り除くことをあてにしているのです。

Fifty percent may be acceptable to you. But those numbers do not include tipping points, most feedback loops, additional warming hidden by toxic air pollution or the aspects of equity and climate justice. They also rely on my generation sucking hundreds of billions of tons of your CO2 out of the air with technologies that barely exist.

50%のリスク私たちにとって到底受け入れられるものではないのです。私たちはその結果と共に生きていかなければならないのですから

So a 50% risk is simply not acceptable to us — we who have to live with the consequences.

[気候変動に関する政府間パネル]による最も分のよい試算では、67%の確率で気温上昇を1.5℃以下にするために、世界全体で許される二酸化炭素排出量は2018年1月1日以降で420ギガトンまでです。今日(2019年9月24日)、既にその数字は350ギガトンを割っています

To have a 67% chance of staying below a 1.5 degrees global temperature rise – the best odds given by the [Intergovernmental Panel on Climate Change] – the world had 420 gigatons of CO2 left to emit back on Jan. 1st, 2018. Today that figure is already down to less than 350 gigatons.

よくも”今まで通りのやり方”や何かしらの技術解決できるなどと嘯けますね。今の排出レベルでは、残りの350ギガトン猶予も8年半以内で使い切ることになります

How dare you pretend that this can be solved with just 'business as usual' and some technical solutions? With today's emissions levels, that remaining CO2 budget will be entirely gone within less than 8 1/2 years.

今日ここにいたるまで、これらのデータに沿った解決法も計画もまったくありません。なぜなら、これらの数字は非常に不愉快であり、あなた方はそのことをありのままに伝えられるほど成熟していないからです。

There will not be any solutions or plans presented in line with these figures here today, because these numbers are too uncomfortable. And you are still not mature enough to tell it like it is.

あなた方は私たち裏切り続けています。そして若者たちはあなた方の裏切りに気付き始めています未来世代の目はすべて、あなた方に注がれています。そして、もしあなた方が私たちを裏切ることを選ぶのなら、私は言います。”私たちあなた方を許さないでしょう”

You are failing us. But the young people are starting to understand your betrayal. The eyes of all future generations are upon you. And if you choose to fail us, I say: We will never forgive you.

私たちあなた方を逃がしません。今この場所、今この時から私たちは線を引きます世界は目覚めつつあります。そして、あなた方の好むと好まざるとにかかわらず、変化もまた訪れるのです。

We will not let you get away with this. Right here, right now is where we draw the line. The world is waking up. And change is coming, whether you like it or not.

ありがとうございました。

Thank you.

※1 これは「世界指導者たちへ向けてのメッセージはありますか?」という司会から質問を受けて始まるスピーチなので、話の相手方大人たち全般ではないことに注意が必要よ。

※2 Tipping pointNHKの方にも注釈があるけれど、気候変動が急転するポイントのことよ。具体的には正のフィードバックループが止められなくなったりする気温だったりするわね。例えば、気温が上がれば水蒸気が増える、水蒸気が増えれば温室効果がアップ、そしてさらに……、といった具合。演説中で触れられていた1.5℃の温度上昇もtipping pointの一つよ。

※3 Climate justice:「先進国が出した二酸化炭素のせいで温暖化してるのに、途上国しわ寄せが来すぎるのはおかしいだろう。」的な話。先進国(や富裕層)は途上国(や貧困層)に対して温暖化被害の点で責任があるし、対策はそれを踏まえて両者に公平な形で進められるべきであるという考え方よ。多少人権周りの話も絡んでくるので詳細はもっと複雑ね。こっちにも注釈付けた方が良かったんでないのNHKさん。

おまけ

NHK訳の感想

私の訳よりすっきりしてるわよね。私のはちょっとくどいわ。でも邪悪云々の下りは私の方が良く訳せてると思うの。どう?

2019-09-19

"REVOLUTION WILL NOT BE TELEVISED" by Gil Scott-Heron, 1970


You will not be able to stay home, brother

You will not be able to plug in, turn on and cop out

You will not be able to lose yourself on skag and skip out for beer during commercials

Because the revolution will not be televised.

The revolution will not be televised.

The revolution will not be brought to you by Xerox in 4 parts without commercial interruptions

The revolution will not show you pictures of Nixon blowing a bugle and leading a charge by John Mitchell, General Abrams and Mendel Rivers to eat hog maws confiscated from a Harlem sanctuary

The revolution will not be televised.

The revolution will not be brought to you by the Schaefer Award Theatre and will not star Natalie Woods and Steve McQueen or Bullwinkle and Julia

The revolution will not give your mouth sex appeal

The revolution will not get rid of the nubs

The revolution will not make you look five pounds thinner

Because the revolution will not be televised, brother.

There will be no pictures of you and Willie Mae pushing that shopping cart down the block on the dead run

Or trying to slide that color TV into a stolen ambulance

NBC will not be able predict the winner at 8:32 on reports from 29 districts

The revolution will not be televised.

There will be no pictures of pigs shooting down brothers in the instant replay

There will be no pictures of Whitney Young being run out of Harlem on a rail with brand new process

There will be no slow motion or still life of Roy Wilkens strolling through Watts in a Red, Black and Green liberation jumpsuit that he had been saving for just the proper occasion.

The revolution will not be televised.

Green Acres, The Beverly Hillbillies and Hooterville Junction will no longer be so goddamned relevant

And women will not care if Dick finally screwed Jane on Search for Tomorrow

Because Black people will be in the street looking for a brighter day

The revolution will not be televised.

There will be no highlights on the eleven o'clock news

And no pictures of hairy armed women liberationists and Jackie Onassis blowing her nose

The theme song will not be written by Jim Webb or Francis Scott Keys, nor sung by Glen Campbell, Tom Jones, Johnny Cash or Englebert Humperdink

The revolution will not be televised.

The revolution will not be right back after a message about a white tornado, white lightning, or white people

You will not have to worry about a dove in your bedroom, a tiger in your tank, or the giant in your toilet bowl

The revolution will not go better with Coke

The revolution will not fight the germs that may cause bad breath

The revolution will put you in the driver's seat.

The revolution will not be televised

Will not be televised

Will not be televised

Will not be televised

The revolution will be no re-run, brothers

The revolution will be live.

2019-09-04

これをやるだけで上位1%になれるRプログラミングTIPS

Rはプログラミング苦手な人にも覚えやす

が、そのためか、プログラミングの得意な人からしたら「ええ・・・」となるような行動を初学者が取りがちに思える

そこで、とりあえずこれだけ守ってほしいというアドバイスを書きました。

エラーが起きたとき

あれこれするより先にエラーメッセージを読め。ぶっちゃけエラーメッセージを読むだけで上位10%だ

あと、エラーメッセージとWarning messageは違うものからな。行間を読む前に行を読め

エラーメッセージの内容がわからなかったらエラーメッセージをコピペしてググれ

日本語サイト微妙だったとき英語でググれ

Stack Overflowにだいたい同じエラーで困ってる人が既に投稿してる

エラーは生じてないが思い通りの挙動になっていないとき

定義した変数の中身を逐一確認して予定してる内容になってるか確認しろ

試行錯誤しすぎてわけがからなくなったら変数を全部削除して一番上から実行し直せ

変数の全削除は rm(list=ls()) でできる

実行し直してるときに、一行ずつ予定通りの挙動になってるか確認しろ

変数の型を逐一str()関数確認しろ

予定通りの型になっているか特に、因子型と数値型、因子型と文字型の混同で生じるミス多い

原因と思しき箇所の関数の使い方が正しいか確認しろ

ヘルプを見て使い方が合ってるのか確認

関数名 R 」でググれ

いきなりやりたいことを全部書くんじゃなくてデータを縮小 (例えば、一部の日にちのデータ) したり、処理を簡略化して小さいプログラムを作って徐々に拡張しろ

作図が思い通りにできないとき

関数名でググれ

日本語ダメなら英語でググれ

画像検索を使え (google検索の「画像」タブ)

自分が描きたい図に近い画像からそのウェブサイトに飛んでいけ

知らなきゃ検索できないから、よく使う用語は覚えておけ

例えば・・・

group (変数グループ化、例えば「条件毎に折れ線を引く」)

facet (「●●ごとに図を描く」)

alpha (透過度)

tick (目盛り線)

axis (軸)

background (背景)

legend (凡例)

例えば「●●条件毎に線を引きたいけど、geom_line()でどうしたらいいのか?」と思ったら「geom_line group」で検索したら、だいたいやりたいことをやってる画像が出てくるので、それを参考したらいい

検索がうまく引っかからない

日本語ダメだったら英語検索しろ (再掲)

“how to” と入れるとだいたいヒットする

例えば「how to change colors gradient ggplot2」でググると色をグラデーション様に変える方法が出てくる

人に質問するときのコツ

「○○でうまくいきますか?」「〇〇だとダメですか?」と質問してくる人、本当に多いけど、その質問は、以下の2つの理由で良くない

そもそもプログラムなんて同じ目的を達成するのに何通りも答えがあるので、「○○でうまくいきますか?」という質問には「それは書き方次第だなぁ」としか言いようがない

・試せばわかるのだから、人に聞くより実行してみたらいい。エラーの数だけお前は強くなる。エラーを受け取るのを恐れるな

答えやす質問は以下のような形だ

「○○を実行したら、こういうエラーが生じるんですけど、エラーの内容が理解できません」

「○○という形のデータを作りたいんですけど、この処理だとこの形にならないのはどこが原因ですか?」

「○○という処理を行ってくれる関数が探しても見つからないんですけど、ありますか?」

2019-07-10

Privacy Policy

This APP is provided by us at no cost and is intended for use as is.

This page is used to inform app visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our App.

If you choose to use our App, then you agree to the collection and use of information in relation to this policy.

Information Collection and Use

When using the APP, it only collects anonymous usage information to operate, improve and personalize the products. The APP does not collect any Personally Identifiable Information (PII) about you, nor does it match collected anonymous usage data with any 3rd party PII information.

Log Data

We want to inform you that whenever you use our App, in a case of an error in the app we collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our App, the time and date of your use of the App, and other statistics. If you use our app to read or post information on our app, we don't collect any information about your identity. If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message. In addition to other information described in this policy, we may collect and share precise location information including the presence of connected devices via bluetooth, through methods such as partner mobile “SDKs”. This information may be used by itself, aggregated, or combined with mobile identifiers (such as IDFAs and Android IDs), and shared with other parties, for purposes related to advertising, attribution (e.g., measuring ad performance), analytics and research. You can remove your consent to having your location data collected by changing the settings on your device (but certain services may lose functionality as a result). You can also control options through your device’s opt-out settings which will: (i) tell advertisers to not use your in-app information from that device to gather information about your interests to target interest-based ads and (ii) inform some partners to halt further data collection and sharing from that device.

Service Providers

We may employ third-party companies and individuals due to the following reasons:

To facilitate our App;

To provide the App on our behalf;

To perform App-related services; or

To assist us in analyzing how our App is used.

We want to inform users of this App that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

Links to Other Apps or Websites

This App may contain links to other Apps or Websites. If you click on a third-party link, you will be directed to that app or website. Note that these external apps or sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these apps or websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party apps or websites or services.

Changes to This Privacy Policy

We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us

This app has no affiliation with Craigslist. Craigslist is a registered trademark of Craigslist, Inc. Please visit Craigslist's privacy policy to better understand their data collection practices and controls that they make available to you.

2019-05-31

"REVOLUTION WILL NOT BE TELEVISED" by Gil Scott-Heron, 1970

You will not be able to stay home, brother

You will not be able to plug in, turn on and cop out

You will not be able to lose yourself on skag and skip out for beer during commercials

Because the revolution will not be televised.

The revolution will not be televised.

The revolution will not be brought to you by Xerox in 4 parts without commercial interruptions

The revolution will not show you pictures of Nixon blowing a bugle and leading a charge by John Mitchell, General Abrams and Mendel Rivers to eat hog maws confiscated from a Harlem sanctuary

The revolution will not be televised.

The revolution will not be brought to you by the Schaefer Award Theatre and will not star Natalie Woods and Steve McQueen or Bullwinkle and Julia

The revolution will not give your mouth sex appeal

The revolution will not get rid of the nubs

The revolution will not make you look five pounds thinner

Because the revolution will not be televised, brother.

There will be no pictures of you and Willie Mae pushing that shopping cart down the block on the dead run

Or trying to slide that color TV into a stolen ambulance

NBC will not be able predict the winner at 8:32 on reports from 29 districts

The revolution will not be televised.

There will be no pictures of pigs shooting down brothers in the instant replay

There will be no pictures of Whitney Young being run out of Harlem on a rail with brand new process

There will be no slow motion or still life of Roy Wilkens strolling through Watts in a Red, Black and Green liberation jumpsuit that he had been saving for just the proper occasion.

The revolution will not be televised.

Green Acres, The Beverly Hillbillies and Hooterville Junction will no longer be so goddamned relevant

And women will not care if Dick finally screwed Jane on Search for Tomorrow

Because Black people will be in the street looking for a brighter day

The revolution will not be televised.

There will be no highlights on the eleven o'clock news

And no pictures of hairy armed women liberationists and Jackie Onassis blowing her nose

The theme song will not be written by Jim Webb or Francis Scott Keys, nor sung by Glen Campbell, Tom Jones, Johnny Cash or Englebert Humperdink

The revolution will not be televised.

The revolution will not be right back after a message about a white tornado, white lightning, or white people

You will not have to worry about a dove in your bedroom, a tiger in your tank, or the giant in your toilet bowl

The revolution will not go better with Coke

The revolution will not fight the germs that may cause bad breath

The revolution will put you in the driver's seat.

The revolution will not be televised

Will not be televised

Will not be televised

Will not be televised

The revolution will be no re-run, brothers

The revolution will be live.

2019-04-18

Privacy Policy

ABW Coin built the MathX for Math Learner app as a Free app. This APP is provided by ABW Coin at no cost and is intended for use as is.

This page is used to inform app visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our App.

If you choose to use our App, then you agree to the collection and use of information in relation to this policy.

Information Collection and Use

When using the APP, it only collects anonymous usage information to operate, improve and personalize the products. The APP does not collect any Personally Identifiable Information (PII) about you, nor does it match collected anonymous usage data with any 3rd party PII information.

Log Data

We want to inform you that whenever you use our App, in a case of an error in the app we collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our App, the time and date of your use of the App, and other statistics. If you use our app to read or post information on our app, we don't collect any information about your identity. If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message. In addition to other information described in this policy, we may collect and share precise location information including the presence of connected devices via bluetooth, through methods such as partner mobile “SDKs”. This information may be used by itself, aggregated, or combined with mobile identifiers (such as IDFAs and Android IDs), and shared with other parties, for purposes related to advertising, attribution (e.g., measuring ad performance), analytics and research. You can remove your consent to having your location data collected by changing the settings on your device (but certain services may lose functionality as a result). You can also control options through your device’s opt-out settings which will: (i) tell advertisers to not use your in-app information from that device to gather information about your interests to target interest-based ads and (ii) inform some partners to halt further data collection and sharing from that device.

Service Providers

We may employ third-party companies and individuals due to the following reasons:

To facilitate our App;

To provide the App on our behalf;

To perform App-related services; or

To assist us in analyzing how our App is used.

We want to inform users of this App that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

Links to Other Apps or Websites

This App may contain links to other Apps or Websites. If you click on a third-party link, you will be directed to that app or website. Note that these external apps or sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these apps or websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party apps or websites or services.

Changes to This Privacy Policy

We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us

2019-03-09

GearBestでPCを買った顛末

あらすじ:

GearBestで品物を買った場合高く買った順に発送されるので運良く(悪く?)安く買ういつまでたっても発送されない事態に陥ります

現状3ヶ月経っていますが品物は届いていません。

GearBestは1日以内での質問返答を標榜していまして、以下はそんな私のGearBestの面白い文通の記録です。

----

息子の誕生日にそろそろPCでも買い与えようかと、安いPCを物色しているとGearBestで良さげなPCがあったので

ポチりました。息子の誕生日の2週ほど前です。

所が誕生日を過ぎ推定デリバリータイムになってもぜんぜん送付されませんので問い合わせをしました。

Subject:it's not shiped yet

Message:when I saw the website, it will ship at least 1/7. but it's not ship out yet.

when is it ship out?

返答:

Dear ***,

Thank you for placing your order on GearBest. Please check your order information below.

Remaining items(Not available currently):

Chuwi Lapbook Air CWI529 Notebook 28-Feb-19 Wait or Exchange

Tips for Suggested Options:

※. If you choose to Exchange, please send us the item link with the color and size or product model.

Due to the holidays season coming, it might slow down the outgoing process and the delivery of your order.We kindly ask for your patience regarding this.

2018年に注文したのに、2/28出荷で文句があるなら返金しろだって

そんなに急いでないので待つことにしました。

----

2/28過ぎても出荷されないので再度問い合わせしました。

Subject:注文が出荷されていない

Message:T*****で2019 2/28に出荷されると回答を得たのにまだ出荷されていない。

この注文は2018年に出荷される予定だった。

早く出荷してほしい。

Dear ***,

Thank you for contacting Gearbest.com. We are sorry for the inconvenience we may caused.

Below is your order information.

Remaining items(Not available currently):

Sku*quantity Product Name Estimated Dispatch Time Suggested Options*

* 1

Chuwi Lapbook Air CWI529 Notebook 7-15 business days Wait or Exchange

ええ・・・、2/28に出荷されるっつたのにまたの延期、もう信じられません。

でもまだ信じて受け入れます

-----

一週間後にメッセージを残します。

At 03/08/2019 08:39:14 CST Hey, Please tell me *true* dispatch time.

YOU CAN DISPATCH WITHIN 1 WEEK RIGHT?

返事がきました。

XXX様

ご連絡いただきありがとうございます。ご迷惑をおかけして申し訳ございません。

お客様の注文を今処理していますしかし、下記の商品現在在庫切れとなりましたのでご注意ください。

****1,Chuwi Lapbook Air CWI529 Notebook

この場合、2つの提案があります

案1:商品が利用可能になるまで少しお待ちください。

我々は20-30日間後に入荷予定です。出荷すると、納品の詳細をメールします。これはおおよその日付であり、率直に保証することはできません。

案2:選択した別の商品を交換します。

弊社は多くの素晴らしい製品を選び、お客様が交換品を見つけることができると確信しています選択したい製品リンクをお送りください。注文が更新されます

元の商品との価格差がある場合は、店舗クレジットとしてウォレットで払い戻しするか、差額をカバーする請求書をお送りします。

できるだけ早く商品を受け取るために、本日出荷される商品選択することをお勧めします。

この商品需要が高く、非常に競争力のある価格で、お客様がそれを楽しむことができると確信しているので、それを保つことをお勧めします。

注文を維持するために、出荷後に我々はお客様に次の注文のために使用することができる600ポイント報酬を与えますポイントについてさらに知りたい場合は、以下を参照してください。

http://www.gearbest.com/about/about-points.html

20日~30日遅延!?

あなた達は、今同じ製品を売っています

https://www.gearbest.com/laptops/pp_827413.html?wid=1433363

そのshippingは「Ship between: Mar 18 - Mar 20, Estimated Shipping Time: 5-9 business days

となっています

なぜ先に買った私より今のセールが先に出荷されますか?

その理由を教えて下さい。

私は2018年に注文しています

追記

xxx様

Gearbestにお問い合わせいただきありがとうございます

弊社のサイト掲載されている在庫在庫状況は、参照用です。

最も正確でタイムリーな情報提供するよう努めていますが、カート商品を追加した時点から注文を受け取った時点までに在庫状況が変わることがあります

少しお待ちいただけることを願っております

待たずに変更したくない場合は、払い戻しをすることができます

迷惑をかけて、诚に申し訳ございません。

参照用だそうです。

回答になっていません。

なぜ先に買った私より今のセールが先に出荷されますか?

その理由を教えて下さい。

と聞いています

と書いたけど、これ以上やり取りしても粘着になるだけだと思ったから返金した。

GearBestの高く売れた順に出荷ってのは、短期的には利潤を生むが

これを食らった消費者は安くともシップされないリスクのあるGearBestで購買する意欲は無くなるだろう。

この戦略は長期的に見れば悪手である

2019-01-31

Privacy Policy

FY Creation LLC. built the CLX for Craigslist app as a Free app. This APP is provided by FY Creation LLC at no cost and is intended for use as is.

This page is used to inform app visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our App.

If you choose to use our App, then you agree to the collection and use of information in relation to this policy.

Information Collection and Use

When using the APP, it only collects anonymous usage information to operate, improve and personalize the products. The APP does not collect any Personally Identifiable Information (PII) about you, nor does it match collected anonymous usage data with any 3rd party PII information.

Log Data

We want to inform you that whenever you use our App, in a case of an error in the app we collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our App, the time and date of your use of the App, and other statistics. If you use our app to read or post information on our app, we don't collect any information about your identity. If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message. In addition to other information described in this policy, we may collect and share precise location information including the presence of connected devices via bluetooth, through methods such as partner mobile “SDKs”. This information may be used by itself, aggregated, or combined with mobile identifiers (such as IDFAs and Android IDs), and shared with other parties, for purposes related to advertising, attribution (e.g., measuring ad performance), analytics and research. You can remove your consent to having your location data collected by changing the settings on your device (but certain services may lose functionality as a result). You can also control options through your device’s opt-out settings which will: (i) tell advertisers to not use your in-app information from that device to gather information about your interests to target interest-based ads and (ii) inform some partners to halt further data collection and sharing from that device.

Service Providers

We may employ third-party companies and individuals due to the following reasons:

To facilitate our App;

To provide the App on our behalf;

To perform App-related services; or

To assist us in analyzing how our App is used.

We want to inform users of this App that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

Links to Other Apps or Websites

This App may contain links to other Apps or Websites. If you click on a third-party link, you will be directed to that app or website. Note that these external apps or sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these apps or websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party apps or websites or services.

Changes to This Privacy Policy

We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us

This app has no affiliation with Craigslist. Craigslist is a registered trademark of Craigslist, Inc. Please visit Craigslist's privacy policy to better understand their data collection practices and controls that they make available to you.

2019-01-03

anond:20190103184241

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//

	int blocks[100][100];

	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		x = 0;
		y = 0;
		boxType = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		for(int x = 0 ; x < 100 ; x++)
		{
			for (int y = 0; y < 100; y++)
			{
				blocks[y][x] = 0;
			}
		}

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int x;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48*9,48 * 100 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	int boxType;

	BOOL WriteBoxOLDBox()
	{
		int width = 24;

		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 48));
		for (int y = 0; y < 30; y++)
		{
			for (int x = 0; x < 8; x++)
			{
				if (blocks[y][x] == 0)
				{
					continue;
				}

				RECT Rect = { 0,0,48,48 };
				BOOL ret;

				Rect.left = width * x + 1;
				Rect.right = width * (x + 1) - 1;
				Rect.top = width * y + 1;
				Rect.bottom = width * (y + 1) - 1;

				ret = FillRect(hdc, &Rect, hBrush);


			}
		}

		DeleteObject(hBrush);

		return FALSE;
	}


	BOOL WriteBox()
	{
		WriteBoxOLDBox();

		switch (boxType)
		{
		case 0:
			return WriteBoxI();
		case 1:
			return WriteBoxL();
		case 2:
			return WriteBoxZ();

		}

		return TRUE;
	}

	BOOL WriteBoxZ()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left += width;
		Rect.right += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);


		DeleteObject(hBrush);

		return TRUE;
	}


	BOOL WriteBoxL()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 246 , 48));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) -1 ;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) -1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top    += width; 
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left   += width;
		Rect.right  += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL WriteBoxI()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB( 246 , 48 , 48));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		//Rect.left   += width;
		//Rect.right  += width;
		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL SaveBoxI()
	{
		blocks[y  ][x] = 1;
		blocks[y+1][x] = 1;
		blocks[y+2][x] = 1;
		blocks[y+3][x] = 1;
		return TRUE;
	}


	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		if (x > 8) {
			x = 0;
		}
		if (x <0) {
			x = 8;
		}
		if (y > 20) {
			switch (boxType)
			{
			case 0:
				SaveBoxI();
				break;
			case 1:
				break;
			case 2:
				break;
			}

			y = 0;
			boxType++;
			if (boxType > 2)
			{
				boxType = 0;
			}
		}

		this->WriteBox();

		return TRUE;
	}



	BOOL OnKey(WPARAM wParam)
	{
		if (wParam == VK_LEFT)
		{
			x++;
		}
		if (wParam == VK_RIGHT)
		{
			x--;
		}
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
		break;
	case WM_KEYDOWN:
		{
			MyWindow *target = MyWindow::find(hWnd);
			target->OnKey(wParam);
		}
	break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20190103170543

テトリス

落ちてくるブロックの描き方

わかりやす関数化してみた

まずはブロックの種類は3種類

 

WriteBoxLとWriteBoxIとWriteBoxZ

の違いをよく見比べて

自力で違いがわかれば

プログラマーにはなれるとおもう

とはいえ、コレを自力でわかるならもっと儲かる仕事あるとはおもうけどな

 

	BOOL WriteBox()
	{
		switch (boxType)
		{
		case 0:
			return WriteBoxI();
		case 1:
			return WriteBoxL();
		case 2:
			return WriteBoxZ();

		}
	}
// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		x = 0;
		y = 0;
		boxType = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int x;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48*9,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	int boxType;

	BOOL WriteBox()
	{
		switch (boxType)
		{
		case 0:
			return WriteBoxI();
		case 1:
			return WriteBoxL();
		case 2:
			return WriteBoxZ();

		}
	}

	BOOL WriteBoxZ()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left += width;
		Rect.right += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);


		DeleteObject(hBrush);

		return TRUE;
	}


	BOOL WriteBoxL()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) -1 ;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) -1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top    += width; 
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left   += width;
		Rect.right  += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL WriteBoxI()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		//Rect.left   += width;
		//Rect.right  += width;
		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}


	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		if (x > 8) {
			x = 0;
		}
		if (x <0) {
			x = 8;
		}
		if (y > 8) {
			y = 0;
			boxType++;
			if (boxType > 2)
			{
				boxType = 0;
			}
		}

		this->WriteBox();

		return TRUE;
	}



	BOOL OnKey()
	{
		x++;
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
		break;
	case WM_KEYDOWN:
		{
			MyWindow *target = MyWindow::find(hWnd);
			target->OnKey();
		}
	break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20190101175055

テトリス風?プログラムに向けて

第何回だろうな

キー入力を追加した

まだ、何を押してもブロックが右に移動するだけ(右端にいくと左にワープ

タイマー自動落下

 

でもまぁ ここまでサンプルがあるとほぼテトリスは見えてきた

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		x = 0;
		y = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int x;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48*9,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));
		RECT Rect = { 0,0,48,48 };
		Rect.left = 48 * x;
		Rect.right = 48 * (x+1);
		Rect.top = 48 * y;
		Rect.bottom = 48 * (y+1);
		if (x > 8) {
			x = 0;
		}
		if (x <0) {
			x = 8;
		}
		if (y > 8) {
			y = 0;
		}
		BOOL ret = FillRect(ps.hdc, &Rect, hBrush);
		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL OnKey()
	{
		x++;
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
		break;
	case WM_KEYDOWN:
		{
			MyWindow *target = MyWindow::find(hWnd);
			target->OnKey();
		}
	break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

2019-01-01

anond:20190101174626

こんな感じ

GetMessageの上にタイマーも扱える

MsgWaitForMultipleObjectsExを追加

GetMessageだとタイマーを処理できないのでPeekMessageに変更

>なぜかは ちょっと考えると面白い

Getとき必要なかった 終了処理を追加

msg.message == WM_QUIT

この部分 QUITメッセージが来たら終了する

obj == WAIT_TIMEOUT

タイマーを追加

y++で高さを変更してから

作画を呼ぶ

こんだけ

<が<

>が&GT

&が&

にかわっちゃってるので各自で置換してね

	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}

anond:20190101172100

タイマーを使ったアニメーションを付けた

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		y = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));
		RECT Rect = { 0,0,48,48 };
		Rect.top = 48 * y;
		Rect.bottom = 48 * (y+1);
		if (y > 8) {
			y = 0;
		}
		BOOL ret = FillRect(ps.hdc, &Rect, hBrush);
		DeleteObject(hBrush);

		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20190101162210

やすいように フルソー

青い■を表示するだけ

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);


		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;

	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));

		// メイン メッセージ ループ:
		while (GetMessage(&msg, nullptr, 0, 0))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}


		return TRUE;

	}

	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));
		RECT Rect = { 0,0,48,48 };
		BOOL ret = FillRect(ps.hdc, &Rect, hBrush);
		DeleteObject(hBrush);

		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20181231104029

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);


		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;

	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));

		// メイン メッセージ ループ:
		while (GetMessage(&msg, nullptr, 0, 0))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}


		return TRUE;

	}

	BOOL OnPaint()
	{
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint();


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}


Windowsシステムは基本 グローバル関数なので

グローバル関数<>クラス化されたメソッド

ブリッジ関数を書いた

2018-12-31

anond:20181228211250

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);


class MyWindow
{
public:

	HWND hWnd;

	MyWindow()
		:hWnd(NULL)
	{

	}


	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);


		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;

	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));

		// メイン メッセージ ループ:
		while (GetMessage(&msg, nullptr, 0, 0))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}


		return TRUE;

	}



};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);
            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

こんなかんじ。クラス化した

2018-12-23

anond:20181223152531

技としてはナイスだけど応用は厳しいよね

	const char *message = "        Hello world\n";

	for (int i = 0; i < 8; i++) {
		printf("%s", message + 8 - i);
	}

サンプルとしては、使いにくい書き方

ハローワールドループだけでも

結構遊べる

あなたは どんな 書き方が好き?

2018-08-24

anond:20180824112752

消せれば、綺麗なデザインのもあるし、面白いと思う。(ヘナとかは消せますよね)

身内の名前を彫るのは、「いつも一緒」みたいな固い意志表示なのかなーと思う。

https://www.elle.com/jp/culture/g244798/cfe-celebrity-tattoo-meanings15-0109/

単なるファッションじゃない! セレブタトゥーに込められたメッセージ

CULTURE SPECIAL

Message座右の銘?)を刻んでいる人が、多いんだなぁ。あるいはお守りみたいな?

2018-06-24

anond:20180624193421

「おまえだってー」って言ってる増田さんへの言及で書かないと全然わけわかんないですよ?

しろお知り合いならlineMessage喧嘩なさればよいのでは。

2018-04-08

読んだページを全部自動ブクマする

数日前に puppeteer で自動PDF にする試みを書いたブログホッテントリに入ってるのを見た

それに影響されて自動ブクマするもの作ってみた

bg.js

const username = ""
const api_key = ""

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
	if(message.bookmark){
		bookmark(message.bookmark)
	}
})

async function bookmark(url){
	fetch("http://b.hatena.ne.jp/atom/post", {
		method: "POST",
		referrer: "no-referrer",
		headers: {
			Accept: "application/x.atom+xml, application/xml, text/xml, */*",
			"X-WSSE": await createCredential(),
		},
		body: `
			<entry xmlns="http://purl.org/atom/ns#">
				<link rel="related" type="text/html" href="${url}" />
			</entry>
		`.replace(/\t/g, ""),
	}).then(e => {console.log(e)})
}

async function createCredential(){
	const non = Math.random().toString(36).substr(2)
	const now = new Date().toISOString()
	const buf = new TextEncoder().encode(non + now + api_key)
	const u8a = new Uint8Array(await crypto.subtle.digest("SHA-1", buf))
	const str = Array.from(u8a, e => String.fromCharCode(e)).join("")
	const b64 = btoa(str)
	return `UsernameToken Username="${username}", PasswordDigest="${b64}", Nonce="${btoa(non)}", Created="${now}"`
}

username と api_key を埋めてバックグラウンドで動かす

page.js

chrome.runtime.sendMessage({
	bookmark: location.href
})

ページ内で動かすコード

URLバックグラウンドに投げる

今は全部投げるコードになってるが、必要に応じていらないドメインを弾いたりする

ログイン ユーザー登録
ようこそ ゲスト さん