偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

C#調(diào)用記事本實(shí)例淺析

開(kāi)發(fā) 后端
C#調(diào)用記事本的功能實(shí)現(xiàn)的具體步驟是什么呢?C#調(diào)用記事本的執(zhí)行需要調(diào)用什么方法呢?那么本文就向你詳細(xì)的實(shí)現(xiàn)過(guò)程。

C#調(diào)用記事本并填寫(xiě)內(nèi)容的功能實(shí)現(xiàn)是如何的呢?在我們編程開(kāi)發(fā)的過(guò)程中,實(shí)現(xiàn)C#調(diào)用記事本要用到什么方法呢?那么這里我們通過(guò)實(shí)例的形式向你介紹具體的過(guò)程:

C#調(diào)用記事本并填寫(xiě)內(nèi)容實(shí)例:

  1. using System.Runtime.InteropServices;   
  2. using System.Diagnostics;  
  3.    
  4. [DllImport("User32.DLL")]  
  5. public static extern int SendMessage(IntPtr hWnd,   
  6.     uint Msg, int wParam, string lParam);  
  7. [DllImport("User32.DLL")]  
  8. public static extern IntPtr FindWindowEx(IntPtr hwndParent,  
  9.     IntPtr hwndChildAfter, string lpszClass, string lpszWindow);  
  10. public const uint WM_SETTEXT = 0x000C;  
  11. private void button1_Click(object sender, EventArgs e)  
  12. {  
  13.     Process vProcess = Process.Start("notepad.exe");  
  14.     while (vProcess.MainWindowHandle ==   
  15. IntPtr.Zero) vProcess.Refresh();  
  16.     IntPtr vHandle = FindWindowEx(vProcess.MainWindowHandle,   
  17.         IntPtr.Zero, "Edit"null);  
  18.     SendMessage(vHandle, WM_SETTEXT, 0, "Zswang 路過(guò)");  

C#調(diào)用記事本并填寫(xiě)內(nèi)容之發(fā)送回車(chē):

  1. [DllImport("User32.DLL")]  
  2. public static extern int SendMessage(IntPtr hWnd,  
  3. uint Msg, int wParam, string lParam);  
  4. [DllImport("User32.DLL")]  
  5. public static extern int SendMessage(IntPtr hWnd,  
  6. uint Msg, int wParam, int lParam);  
  7. [DllImport("User32.DLL")]  
  8. public static extern IntPtr FindWindowEx(IntPtr hwndParent,  
  9. IntPtr hwndChildAfter, string lpszClass, string lpszWindow);  
  10. public const uint WM_SETTEXT = 0x000C;  
  11. public const uint WM_CHAR = 0x0102;  
  12. public const uint EM_SETSEL = 0x00B1;  
  13. private void button1_Click(object sender, EventArgs e)  
  14. {  
  15. Process vProcess = Process.Start("notepad.exe");  
  16. while (vProcess.MainWindowHandle ==   
  17. IntPtr.Zero) vProcess.Refresh();  
  18. IntPtr vHandle = FindWindowEx(vProcess.MainWindowHandle,  
  19. IntPtr.Zero, "Edit"null);  
  20. SendMessage(vHandle, WM_SETTEXT,   
  21. 0, "Zswang 路過(guò)\r\n換行"); // 用"\r\n"換行  
  22. SendMessage(vHandle, EM_SETSEL,   
  23. int.MaxValue, int.MaxValue); // 光標(biāo)移到最后  
  24. SendMessage(vHandle, WM_CHAR, (int)Keys.Enter, 0);  
  25. SendMessage(vHandle, WM_CHAR, (int)'h', 0);  
  26. SendMessage(vHandle, WM_CHAR, (int)'e', 0);  
  27. SendMessage(vHandle, WM_CHAR, (int)'l', 0);  
  28. SendMessage(vHandle, WM_CHAR, (int)'l', 0);  
  29. SendMessage(vHandle, WM_CHAR, (int)'o', 0);  

C#調(diào)用記事本并填寫(xiě)內(nèi)容的基本內(nèi)容就向你介紹到這里,希望對(duì)你了解和學(xué)習(xí)C#調(diào)用記事本并填寫(xiě)內(nèi)容有所幫助。

【編輯推薦】

  1. C#遞歸函數(shù)應(yīng)用實(shí)例解析
  2. DropDownList顯示的C#遞歸實(shí)現(xiàn)淺析
  3. C#treeview遞歸操作數(shù)據(jù)庫(kù)淺析
  4. C#遞歸樹(shù)實(shí)現(xiàn)實(shí)例簡(jiǎn)析
  5. C#打開(kāi)記事本實(shí)現(xiàn)實(shí)例解析
責(zé)任編輯:仲衡 來(lái)源: CSDN博客
相關(guān)推薦

2009-09-03 13:48:46

C#調(diào)用記事本記事本程序

2009-09-03 12:52:50

C#打開(kāi)記事本

2012-05-14 14:56:30

HTML5

2009-08-27 13:30:11

C# interfac

2009-08-04 09:30:33

C#調(diào)用ImageAn

2009-08-17 17:49:20

C# 枚舉

2009-09-09 13:57:28

C# XML解析

2009-08-31 15:11:23

C#調(diào)用水晶報(bào)表

2011-09-15 19:17:11

windows 7記事本

2009-08-27 17:59:56

C#接口定義

2009-08-18 13:49:21

C# 操作Excel

2012-05-29 16:09:29

天天記事云記事本DSM記事本

2009-07-31 17:28:35

C#語(yǔ)言調(diào)用DLL

2009-08-14 09:15:28

C#調(diào)用構(gòu)造函數(shù)

2009-08-12 10:35:50

C#調(diào)用ActiveX

2009-08-18 16:04:12

C# 操作Excel

2009-08-19 09:42:52

C#操作Word書(shū)簽

2009-08-27 17:11:44

C# Fluent I

2009-08-28 17:34:14

讀取word文檔

2009-08-31 18:38:59

C#寫(xiě)文件
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)