はてなキーワード: messageとは
グレタ・トゥーンベリ氏の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 point:NHKの方にも注釈があるけれど、気候変動が急転するポイントのことよ。具体的には正のフィードバックループが止められなくなったりする気温だったりするわね。例えば、気温が上がれば水蒸気が増える、水蒸気が増えれば温室効果がアップ、そしてさらに……、といった具合。演説中で触れられていた1.5℃の温度上昇もtipping pointの一つよ。
※3 Climate justice:「先進国が出した二酸化炭素のせいで温暖化してるのに、途上国にしわ寄せが来すぎるのはおかしいだろう。」的な話。先進国(や富裕層)は途上国(や貧困層)に対して温暖化被害の点で責任があるし、対策はそれを踏まえて両者に公平な形で進められるべきであるという考え方よ。多少人権周りの話も絡んでくるので詳細はもっと複雑ね。こっちにも注釈付けた方が良かったんでないのNHKさん。
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.
が、そのためか、プログラミングの得意な人からしたら「ええ・・・」となるような行動を初学者が取りがちに思える
そこで、とりあえずこれだけ守ってほしいというアドバイスを書きました。
あれこれするより先にエラーメッセージを読め。ぶっちゃけ、エラーメッセージを読むだけで上位10%だ
あと、エラーメッセージとWarning messageは違うものだからな。行間を読む前に行を読め
エラーメッセージの内容がわからなかったらエラーメッセージをコピペしてググれ
Stack Overflowにだいたい同じエラーで困ってる人が既に投稿してる
定義した変数の中身を逐一確認して予定してる内容になってるか確認しろ
試行錯誤しすぎてわけがわからなくなったら変数を全部削除して一番上から実行し直せ
実行し直してるときに、一行ずつ予定通りの挙動になってるか確認しろ
予定通りの型になっているか?特に、因子型と数値型、因子型と文字型の混同で生じるミス多い
「関数名 R 」でググれ
いきなりやりたいことを全部書くんじゃなくてデータを縮小 (例えば、一部の日にちのデータ) したり、処理を簡略化して小さいプログラムを作って徐々に拡張しろ
関数名でググれ
例えば・・・
group (変数のグループ化、例えば「条件毎に折れ線を引く」)
facet (「●●ごとに図を描く」)
alpha (透過度)
tick (目盛り線)
axis (軸)
background (背景)
例えば「●●条件毎に線を引きたいけど、geom_line()でどうしたらいいのか?」と思ったら「geom_line group」で検索したら、だいたいやりたいことをやってる画像が出てくるので、それを参考したらいい
“how to” と入れるとだいたいヒットする
例えば「how to change colors gradient ggplot2」でググると色をグラデーション様に変える方法が出てくる
「○○でうまくいきますか?」「〇〇だとダメですか?」と質問してくる人、本当に多いけど、その質問は、以下の2つの理由で良くない
・そもそも、プログラムなんて同じ目的を達成するのに何通りも答えがあるので、「○○でうまくいきますか?」という質問には「それは書き方次第だなぁ」としか言いようがない
・試せばわかるのだから、人に聞くより実行してみたらいい。エラーの数だけお前は強くなる。エラーを受け取るのを恐れるな
「○○を実行したら、こういうエラーが生じるんですけど、エラーの内容が理解できません」
「○○という形のデータを作りたいんですけど、この処理だとこの形にならないのはどこが原因ですか?」
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.
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 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.
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.
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.
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 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
あらすじ:
GearBestで品物を買った場合高く買った順に発送されるので運良く(悪く?)安く買うといつまでたっても発送されない事態に陥ります。
GearBestは1日以内での質問返答を標榜していまして、以下はそんな私のGearBestの面白い文通の記録です。
----
息子の誕生日にそろそろPCでも買い与えようかと、安いPCを物色しているとGearBestで良さげなPCがあったので
所が誕生日を過ぎ推定デリバリータイムになってもぜんぜん送付されませんので問い合わせをしました。
Message:when I saw the website, it will ship at least 1/7. but it's not ship out yet.
返答:
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
※. 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出荷で文句があるなら返金しろよだって。
そんなに急いでないので待つことにしました。
----
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.
返事がきました。
XXX様
ご連絡いただきありがとうございます。ご迷惑をおかけして申し訳ございません。
お客様の注文を今処理しています。しかし、下記の商品は現在、在庫切れとなりましたのでご注意ください。
****1,Chuwi Lapbook Air CWI529 Notebook
我々は20-30日間後に入荷予定です。出荷すると、納品の詳細をメールします。これはおおよその日付であり、率直に保証することはできません。
弊社は多くの素晴らしい製品を選び、お客様が交換品を見つけることができると確信しています。選択したい製品のリンクをお送りください。注文が更新されます。
元の商品との価格差がある場合は、店舗のクレジットとしてウォレットで払い戻しするか、差額をカバーする請求書をお送りします。
できるだけ早く商品を受け取るために、本日出荷される商品を選択することをお勧めします。
この商品は需要が高く、非常に競争力のある価格で、お客様がそれを楽しむことができると確信しているので、それを保つことをお勧めします。
注文を維持するために、出荷後に我々はお客様に次の注文のために使用することができる600ポイントを報酬を与えます。 ポイントについてさらに知りたい場合は、以下を参照してください。
https://www.gearbest.com/laptops/pp_827413.html?wid=1433363
そのshippingは「Ship between: Mar 18 - Mar 20, Estimated Shipping Time: 5-9 business days」
となっています。
その理由を教えて下さい。
xxx様
Gearbestにお問い合わせいただきありがとうございます。
最も正確でタイムリーな情報を提供するよう努めていますが、カートに商品を追加した時点から注文を受け取った時点までに在庫状況が変わることがあります。
少しお待ちいただけることを願っております。
参照用だそうです。
回答になっていません。
その理由を教えて下さい。
と聞いています。
と書いたけど、これ以上やり取りしても粘着になるだけだと思ったから返金した。
GearBestの高く売れた順に出荷ってのは、短期的には利潤を生むが
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.
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 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.
// 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(&amp;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(&amp;msg, NULL, 0, 0, PM_REMOVE)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); this->OnPaint(ps); EndPaint(hWnd, &amp;ps); ::UpdateWindow(hWnd); RECT Rect2 = { 0,0,48*9,48 * 100 }; InvalidateRect(hWnd, &amp;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, &amp;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, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.left += width; Rect.right += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;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, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.left += width; Rect.right += width; ret = FillRect(hdc, &amp;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, &amp;Rect, hBrush); //Rect.left += width; //Rect.right += width; Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;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 &amp;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, &amp;ps); MyWindow *target = MyWindow::find(hWnd); target->OnPaint(ps); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
テトリス風
落ちてくるブロックの描き方
まずはブロックの種類は3種類
の違いをよく見比べて
自力で違いがわかれば
プログラマーにはなれるとおもう
とはいえ、コレを自力でわかるならもっと儲かる仕事あるとはおもうけどな
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(&amp;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(&amp;msg, NULL, 0, 0, PM_REMOVE)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); this->OnPaint(ps); EndPaint(hWnd, &amp;ps); ::UpdateWindow(hWnd); RECT Rect2 = { 0,0,48*9,48 * 8 }; InvalidateRect(hWnd, &amp;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, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.left += width; Rect.right += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;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, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.left += width; Rect.right += width; ret = FillRect(hdc, &amp;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, &amp;Rect, hBrush); //Rect.left += width; //Rect.right += width; Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); Rect.top += width; Rect.bottom += width; ret = FillRect(hdc, &amp;Rect, hBrush); DeleteObject(hBrush); return TRUE; } BOOL OnPaint(PAINTSTRUCT &amp;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, &amp;ps); MyWindow *target = MyWindow::find(hWnd); target->OnPaint(ps); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
第何回だろうな
まだ、何を押してもブロックが右に移動するだけ(右端にいくと左にワープ)
// 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(&amp;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(&amp;msg, NULL, 0, 0, PM_REMOVE)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); this->OnPaint(ps); EndPaint(hWnd, &amp;ps); ::UpdateWindow(hWnd); RECT Rect2 = { 0,0,48*9,48 * 8 }; InvalidateRect(hWnd, &amp;Rect2, TRUE); } else if (obj == WAIT_FAILED) { rc = GetLastError(); } else { } } return TRUE; } BOOL OnPaint(PAINTSTRUCT &amp;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, &amp;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, &amp;ps); MyWindow *target = MyWindow::find(hWnd); target->OnPaint(ps); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
こんな感じ
MsgWaitForMultipleObjectsExを追加
GetMessageだとタイマーを処理できないのでPeekMessageに変更
msg.message == WM_QUIT
この部分 QUITメッセージが来たら終了する
obj == WAIT_TIMEOUT
タイマーを追加
y++で高さを変更してから
作画を呼ぶ
こんだけ
<が&LT;
>が&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(&amp;msg, NULL, 0, 0, PM_REMOVE)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); this->OnPaint(ps); EndPaint(hWnd, &amp;ps); ::UpdateWindow(hWnd); RECT Rect2 = { 0,0,48,48 * 8 }; InvalidateRect(hWnd, &amp;Rect2, TRUE); } else if (obj == WAIT_FAILED) { rc = GetLastError(); } else { } }
// 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(&amp;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(&amp;msg, NULL, 0, 0, PM_REMOVE)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); this->OnPaint(ps); EndPaint(hWnd, &amp;ps); ::UpdateWindow(hWnd); RECT Rect2 = { 0,0,48,48 * 8 }; InvalidateRect(hWnd, &amp;Rect2, TRUE); } else if (obj == WAIT_FAILED) { rc = GetLastError(); } else { } } return TRUE; } BOOL OnPaint(PAINTSTRUCT &amp;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, &amp;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, &amp;ps); MyWindow *target = MyWindow::find(hWnd); target->OnPaint(ps); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
青い■を表示するだけ
// 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(&amp;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(&amp;msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;msg); } } return TRUE; } BOOL OnPaint(PAINTSTRUCT &amp;ps) { HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246)); RECT Rect = { 0,0,48,48 }; BOOL ret = FillRect(ps.hdc, &amp;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, &amp;ps); MyWindow *target = MyWindow::find(hWnd); target->OnPaint(ps); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
// 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(&amp;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(&amp;msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); MyWindow *target = MyWindow::find(hWnd); target->OnPaint(); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
// 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(&amp;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(&amp;msg, nullptr, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) { TranslateMessage(&amp;msg); DispatchMessage(&amp;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, &amp;ps); // TODO: HDC を使用する描画コードをここに追加してください... EndPaint(hWnd, &amp;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; }
こんなかんじ。クラス化した
数日前に 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 })
ページ内で動かすコード
最終的な解決がなされたのに蒸し返すことの契約的な是非はともかく、心情面で日本がどんだけ謝っても韓国納得しないじゃんって話については、2015年の戦後70年首相談話の時にパックンが書いたコラムが興味深い。
以下に一部引用する。
謝るべきかどうかではなく、何故お詫びを求められ続けるかということだけについて話そう。
まず挙げられるのは「各国の政府は、内政が厳しいときに反日感情を煽り、国民の怒りの矛先を外に向けさせる作戦を取る」という説明。これは間違いない。その作戦自体は間違っていると思うけどね。やりすぎてだんだん効果が薄れているみたいだし。
でもそれだけではないだろう。もう1つの理由として、日本の「反省が伝わっていない可能性」も考えよう。もちろん、これまでに日本政府が謝ってきたのは事実。少なくとも村山首相、中曽根首相、細川首相、小泉首相、安倍首相が謝罪している。
しかし、各時代の首相が謝っている傍らで、他の政治家たちによる謝罪とは反対の意に捉えられる発言が目立つ。有名な例だと、中曽根内閣時代、藤尾正行文部大臣の韓国併合についての「韓国側にも責任がある」発言。竹下内閣時代、奥野誠亮国土庁長官の日中戦争についての「侵略の意図は無かった」発言。最近だと、「慰安婦制度は必要だった」という橋本徹大阪府知事(当時)のコメントがある。
行動も紛らわしく見える。5名の首相がおわびをしている一方で、靖国神社へ参拝している戦後の首相は14名。国会議員では数百人に上る。靖国神社は、世界のメディアでWar Shrine(戦争神社)と紹介されている。参拝される人の意図とは関係なく、世界が受ける印象は「お詫び」とは反するものになってしまう。
今回も謝罪の意をこめた総理談話を発表した翌日に、67名の国会議員が参拝をした。安倍総理は参拝しなかったが玉串料を収めた。こういうことは英語でmixed messageという。その行動により、残念ながら「お詫び」が印象に残らない結果となる。
その後、おおむね「謝罪した」とみられているドイツとの比較などが行われている。
つまり、日本政府や首脳は、公式声明では確かに何度も謝罪している。だが、公式声明以外の振舞いや、首脳以外の政治家の言動に「本当はたいして悪いと思ってません」というホンネが感じられるため、本気で謝っていると思ってもらえないということである。
なので、どうすれば心から謝罪したと納得されるかというと、政治家(たぶん国民も)の大半の意見を「日本が悪かったです」ということで統一し、かつ大々的な声明だけでなくその他の場面でも日本が悪かったという態度を崩さず、あと政治家や元政治家は靖国参拝や奉納を止めるといったところだろう。
まあ確かに会社とか友人関係でも、いったんちゃんと頭は下げたものの、その後自分の席に戻って肩をすくめたりする姿が見られたら、本当は反省しておらずしぶしぶ形だけ謝ったのだ、という風に思われるだろうことはわかる。
靖国は、誰がどの墓や神社に参拝しようが自由なのだがその自由なところから透けて見える気持ちが反省のしてなさであるというのはなんか難しい所だ。
結局のところ、大日本帝国とそれにまつわる物事をナチス第三帝国と同じくらいの扱いにしたら満足してもらえるはずってわけだろうが……。
・ログイン時間と書き込み数で上がり、アクテイビティ毎にランクが決まる(Activity = min(time * 14, posts))
書き込み0:Brand new
0 Activity: Newbie
30 Activity: Jr. Member
60 Activity: Member
120 Activity: Full Member
240 Activity: Sr. Member
480 Activity: Hero Member
・2週間毎に最高14ずつ上がるらしい(でもなんか微妙に違うのかも。僕は14は飛ばして28までは一気に上がりました)
・僕は10月5日登録⇒10月26日Jr.Member昇進になりました。3週間でした)
(詳細⇒ https://bitcointalk.org/index.php?topic=178608.0 誰か訳してください)
.
.
・ランクがNewbieだと書き込みが6分に1回など制限があったり、PMを送っても届かなかったり、フリーエアドロップに参加できなかったりする
・しかし、私利のランク上げのために日本語スレにスパムみたいに適当に投稿するのは単純によくないことだと思う
・結局一番いいのは、単純に、真面目にスレに貢献し、参加することだと思う
(たまに書き込み削除の通知メールが来るが、それはたまによくあることなので、気を落とさなくていい)
(注意点として、以下に示すような投稿をするとBAN対象になると声明がありましたので、「スレ主がそういう投稿を求めている時」以外にこういう投稿をしないようにしたほうがいいです)
「joined」
「looking forward to getting X」
「signed up for X」
「applied」
(日本語スレでも自分のツイッターの宣伝したり露骨なアフィしたりすると消されます)
(詳細: https://bitcointalk.org/index.php?topic=2284373.0 )
.
.
.
https://bitcointalk.org/index.php?board=159.0
「ビットコインガーデン:ギブアウェイ板」(ビットコイントークより規制が緩いため色々と留意)
https://bitcoingarden.org/forum/index.php?board=2.0
.
2次情報(用途は1次情報の取りこぼし用、時間無い人用、などとして)
「airdropalert」(一部アフィだが優秀なので書かざるを得ない)
「ビットコイントーク:日本語板」(もはやエアドロップ情報スレになってるため。アフィ目的のスパムが多すぎて最近は見るのが心苦しい)
https://bitcointalk.org/index.php?topic=877.new#new
(リファラつけた紹介アフィは規約違反なので基本消されます。最悪BANされます)
.
・配布時期は気長にみたほうがいい(応募してすぐ配布されるわけではないものも多い。配布時期は各説明を読むしかない)
・scam対策のため、ウォレットダウンロード系は「安心なのだけやる」または「仮想環境作ってそこでやる」または「scamされてもいいマイニング専用PCでやる」
・scam対策のため、メールアドレスとパスワード登録系は「パスワードは毎回別のを用意する」、「メールアドレスはできればサブのを使う」(要は「メールアドレスとパスワードのペア」が他の登録情報とかぶらなければいい)
・たまにフリーエアドロップで「PMする」「肯定的なツイートして宣伝する」みたいな条件があるが、それは礼儀や分別のあるPMでないと失格になることもあるっぽい(僕はRICHのフリーエアドロップで「Yes I wanna be rich!!」みたいなテンションの文とアドレス書いて送ったら、フリーエアドロップ受けられませんでした。あとSOARCOINの人が「ただRTしてるだけの人にエアドロップ配るか配らないかどうしたらいいかな?」という内容のアンケート取ってたりするので。外人とは言え、分別もった内容で応募しないといけないのかなと思いました)
・また、「send me personal message」「PMする」「PM」とかはパーソナルメッセージ(ツイッターで言うDM)を送るということです。レスの左側にある吹き出しマークを押せばPMを書くフォームに飛べますので、そこで書いて送信する、ということです
.
.
■フリーエアドロップの際によくフォームで入力をせがまれる項目の説明
・「bitcointalk profile」は、自分のプロフィールページの左側カラムにある「Forum Profile Information」に行った時のURLから、語尾の「;sa=forumProfile」を省いたもの
・「bitcointalk ID」は、上記「Forum Profile Information」に行った時のURLの中にある「u=なんたらかんたら」の複数桁の数字のこと
・「Address」は、ものによって違うが、基本的にイーサリアムのウォレットのアドレスか、ウェーブスのウォレットのアドレスか、または専用ウォレットのアドレス(基本的に取引所のアドレスでなく、どれもウォレットのアドレス。例えばイーサリアムならMyEtherWalletなど)
.
.
・スレに書き込むには、ページの右下や右上にある「reply」ってボタンを押せば書き込みフォームが出る
・レスにアンカつけるには、レスの右側にある「quote」ってボタン押せばアンカつき書き込みフォームが出る
・適当な書き込みをしたらたまにけっこう削除される(そして「削除したからな」ってメールが届く)
.
.
・まず仮想マシンをインストール https://pc-karuma.net/windows8-virtualbox-install/
・次に仮想マシンにubuntu(Linuxの一種)インストール https://pc-karuma.net/windows-8-virtualbox-ubuntu-install/
ようやっと20年前の状況にもどったわけだ(少なくとも株価は)
1996年と言えば
・ポケモン、バイオハザード、マリオ64、パラッパ、ペルソナ、クラッシュ、たまごっち
・Shall We ダンス?、インデペンデンスデイ、ザロック、キッズリターン
1位 名もなき詩 Mr.Children 230.3万
2位 DEPARTURES globe 227.2万
3位 LA・LA・LA LOVE SONG 久保田利伸with NAOMI CAMPBELL 161.3万
5位 花-Memento-Mori- Mr.Children 153.9万
7位 愛の言霊~Spiritual Message サザンオールスターズ 138.1万
9位 Don't wanna cry 安室奈美恵 137.2万
10位 Chase the Chance 安室奈美恵 136.2万
なんだか楽しそうだなぁ・・・
なんだか時代が変わっていくのを感じる。