(empty log message)
@@ -30,15 +30,20 @@ | ||
30 | 30 | { |
31 | 31 | this.sendBtn = new System.Windows.Forms.Button(); |
32 | 32 | this.twitterCheckbox = new System.Windows.Forms.CheckBox(); |
33 | + this.textBox1 = new System.Windows.Forms.TextBox(); | |
34 | + this.label1 = new System.Windows.Forms.Label(); | |
35 | + this.label2 = new System.Windows.Forms.Label(); | |
36 | + this.textBox2 = new System.Windows.Forms.TextBox(); | |
37 | + this.helpBtn = new System.Windows.Forms.Button(); | |
33 | 38 | this.SuspendLayout(); |
34 | 39 | // |
35 | 40 | // sendBtn |
36 | 41 | // |
37 | 42 | this.sendBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
38 | - this.sendBtn.Location = new System.Drawing.Point(260, 227); | |
43 | + this.sendBtn.Location = new System.Drawing.Point(251, 89); | |
39 | 44 | this.sendBtn.Name = "sendBtn"; |
40 | 45 | this.sendBtn.Size = new System.Drawing.Size(75, 23); |
41 | - this.sendBtn.TabIndex = 1; | |
46 | + this.sendBtn.TabIndex = 6; | |
42 | 47 | this.sendBtn.Text = "送信"; |
43 | 48 | this.sendBtn.UseVisualStyleBackColor = true; |
44 | 49 | // |
@@ -46,20 +51,71 @@ | ||
46 | 51 | // |
47 | 52 | this.twitterCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
48 | 53 | this.twitterCheckbox.AutoSize = true; |
49 | - this.twitterCheckbox.Location = new System.Drawing.Point(161, 231); | |
54 | + this.twitterCheckbox.Location = new System.Drawing.Point(152, 93); | |
50 | 55 | this.twitterCheckbox.Name = "twitterCheckbox"; |
51 | 56 | this.twitterCheckbox.Size = new System.Drawing.Size(93, 16); |
52 | - this.twitterCheckbox.TabIndex = 2; | |
57 | + this.twitterCheckbox.TabIndex = 5; | |
53 | 58 | this.twitterCheckbox.Text = "Twitterに投稿"; |
54 | 59 | this.twitterCheckbox.UseVisualStyleBackColor = true; |
55 | 60 | this.twitterCheckbox.CheckedChanged += new System.EventHandler(this.twitterCheckbox_CheckedChanged); |
56 | 61 | // |
62 | + // textBox1 | |
63 | + // | |
64 | + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |
65 | + | System.Windows.Forms.AnchorStyles.Right))); | |
66 | + this.textBox1.Location = new System.Drawing.Point(53, 12); | |
67 | + this.textBox1.Name = "textBox1"; | |
68 | + this.textBox1.Size = new System.Drawing.Size(273, 19); | |
69 | + this.textBox1.TabIndex = 1; | |
70 | + // | |
71 | + // label1 | |
72 | + // | |
73 | + this.label1.AutoSize = true; | |
74 | + this.label1.Location = new System.Drawing.Point(12, 15); | |
75 | + this.label1.Name = "label1"; | |
76 | + this.label1.Size = new System.Drawing.Size(35, 12); | |
77 | + this.label1.TabIndex = 0; | |
78 | + this.label1.Text = "曲名 :"; | |
79 | + // | |
80 | + // label2 | |
81 | + // | |
82 | + this.label2.AutoSize = true; | |
83 | + this.label2.Location = new System.Drawing.Point(12, 53); | |
84 | + this.label2.Name = "label2"; | |
85 | + this.label2.Size = new System.Drawing.Size(75, 12); | |
86 | + this.label2.TabIndex = 2; | |
87 | + this.label2.Text = "アーティスト名 :"; | |
88 | + // | |
89 | + // textBox2 | |
90 | + // | |
91 | + this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |
92 | + | System.Windows.Forms.AnchorStyles.Right))); | |
93 | + this.textBox2.Location = new System.Drawing.Point(93, 50); | |
94 | + this.textBox2.Name = "textBox2"; | |
95 | + this.textBox2.Size = new System.Drawing.Size(233, 19); | |
96 | + this.textBox2.TabIndex = 3; | |
97 | + // | |
98 | + // helpBtn | |
99 | + // | |
100 | + this.helpBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); | |
101 | + this.helpBtn.Location = new System.Drawing.Point(12, 89); | |
102 | + this.helpBtn.Name = "helpBtn"; | |
103 | + this.helpBtn.Size = new System.Drawing.Size(75, 23); | |
104 | + this.helpBtn.TabIndex = 4; | |
105 | + this.helpBtn.Text = "ヘルプ"; | |
106 | + this.helpBtn.UseVisualStyleBackColor = true; | |
107 | + // | |
57 | 108 | // ListeningMessender |
58 | 109 | // |
59 | 110 | this.AcceptButton = this.sendBtn; |
60 | 111 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
61 | 112 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
62 | - this.ClientSize = new System.Drawing.Size(347, 262); | |
113 | + this.ClientSize = new System.Drawing.Size(338, 124); | |
114 | + this.Controls.Add(this.helpBtn); | |
115 | + this.Controls.Add(this.textBox2); | |
116 | + this.Controls.Add(this.label2); | |
117 | + this.Controls.Add(this.label1); | |
118 | + this.Controls.Add(this.textBox1); | |
63 | 119 | this.Controls.Add(this.twitterCheckbox); |
64 | 120 | this.Controls.Add(this.sendBtn); |
65 | 121 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; |
@@ -77,5 +133,10 @@ | ||
77 | 133 | |
78 | 134 | private System.Windows.Forms.Button sendBtn; |
79 | 135 | private System.Windows.Forms.CheckBox twitterCheckbox; |
136 | + private System.Windows.Forms.TextBox textBox1; | |
137 | + private System.Windows.Forms.Label label1; | |
138 | + private System.Windows.Forms.Label label2; | |
139 | + private System.Windows.Forms.TextBox textBox2; | |
140 | + private System.Windows.Forms.Button helpBtn; | |
80 | 141 | } |
81 | 142 | } |
\ No newline at end of file |
@@ -0,0 +1,48 @@ | ||
1 | +//http://www.k4.dion.ne.jp/~anis7742/codevault/00040.html をコピペしました。 | |
2 | +using System; | |
3 | +using System.Runtime.InteropServices; | |
4 | + | |
5 | +namespace Azyobuzi.りすにんぐついったー | |
6 | +{ | |
7 | + class SendToIM | |
8 | + { | |
9 | + private const int WM_COPYDATA = 0x004A; | |
10 | + private const int MAGIC_MUMBER = 1351; | |
11 | + | |
12 | + [StructLayout(LayoutKind.Sequential)] | |
13 | + private struct COPYDATASTRUCT | |
14 | + { | |
15 | + public int dwData; | |
16 | + public int cbData; | |
17 | + public IntPtr lpData; | |
18 | + } | |
19 | + | |
20 | + [DllImport("user32.dll")] | |
21 | + private extern static IntPtr FindWindow(string lpClassName, string lpWindowName); | |
22 | + | |
23 | + [DllImport("user32.dll")] | |
24 | + private extern static int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref COPYDATASTRUCT lParam); | |
25 | + | |
26 | + public static void sendToIM(string applicationName, string title, string artist, int play1Stop0) | |
27 | + { | |
28 | + IntPtr im = FindWindow("MsnMsgrUIManager", null); | |
29 | + | |
30 | + if (im == IntPtr.Zero) return; | |
31 | + | |
32 | + string sendData = applicationName + @"\0Music\0" + play1Stop0.ToString() + @"\0{0} - {1}\0" + title + @"\0" + artist + @"\0\0"; | |
33 | + | |
34 | + COPYDATASTRUCT cds; | |
35 | + cds.dwData = MAGIC_MUMBER; | |
36 | + cds.cbData = (sendData.Length + 1) * 2; | |
37 | + cds.lpData = Marshal.StringToHGlobalUni(sendData); | |
38 | + try | |
39 | + { | |
40 | + SendMessage(im, WM_COPYDATA, IntPtr.Zero, ref cds); | |
41 | + } | |
42 | + finally | |
43 | + { | |
44 | + Marshal.FreeHGlobal(cds.lpData); | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | +} | |
\ No newline at end of file |