Re: [問題] 有辦法做到將字串輸入到其他程式嗎?

看板C_Sharp (C#)作者 (怒!恨!殺!吼吼吼~~)時間18年前 (2007/05/26 23:20), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/9 (看更多)
: 2. 用FindWindow與FindWindowEx來取得編輯框的window handle : (該怎麼在C#宣告使用windows api, 請到 http://www.pinvoke.net/ 去查) : IntPtr npWnd = FindWindow("Notepad", null); : IntPtr editWnd = FindWindowEx(npWnd, IntPtr.Zero, "Edit", IntPtr.Zero); : 完整程式如下.. : [DllImport("user32.dll", SetLastError = true)] : static extern IntPtr FindWindow(string lpClassName, string lpWindowName); : [DllImport("user32.dll", SetLastError = true)] : public static extern IntPtr FindWindowEx(IntPtr hwndParent, : IntPtr hwndChildAfter, string lpszClass, string lpszWindow); : [DllImport("User32.dll", CharSet = CharSet.Auto)] : static extern uint SendMessage(IntPtr hWnd, int Msg, : int wParam, int lParam); : private void button1_Click_1(object sender, EventArgs e) : { : IntPtr npWnd = FindWindow("Notepad", null); : IntPtr editWnd = FindWindowEx(npWnd, IntPtr.Zero, "Edit", IntPtr.Zero); : for(int i=0;i<textBox1.Text.Length;i++) : Win32.User32.User32API.SendMessage( : editWnd, 0x0102, (in)textBox1.Text[i], 0); 前面刪光光... 想再請問一下大大.... http://www.pinvoke.net 這個網址好像沒有寫到Win32 API 每個要輸入的是何種參數耶??@@?? 例如FindWindow(string lpClassName, string lpWindowName); 就不知道lpClassName和lpWindowsName這兩個要輸入啥東西@@ ( 雖然看大大的說明,知道lpClassName是Class的名稱 ) 此外....以這個例子而言.... 大大們都是怎樣去找到適合的Win32 API阿@@? 一個一個找嗎^^?.... 謝謝~ -- 左半邊持續殘廢中....右半邊不斷進化中.... 學術名詞稱為"不協調"....( 汗.... ) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.170.0.47
文章代碼(AID): #16M50jVS (C_Sharp)
討論串 (同標題文章)
文章代碼(AID): #16M50jVS (C_Sharp)