在c ++ Scintilla框中编辑文本

时间:2017-01-12 18:54:08

标签: c# c++ scintilla

string selected = folderBrowserDialog1.SelectedPath;
string add = selected + "/";
string path = add + listBox1.SelectedItem.ToString();
string text = System.IO.File.ReadAllText(@path);
StringBuilder sb1 = new StringBuilder();
sb1.Append(text);
IntPtr handle = process.MainWindowHandle;
IntPtr zero = new System.IntPtr(0);
var test = FindWindowEx(handle, zero, "RICHEDIT50W", null);
var but = FindWindowEx(handle, zero, "button", null);

StringBuilder nothing = new StringBuilder();
nothing.Append("");
SendMessage(test, WM_SETTEXT, 0, sb1);//sets text
System.Threading.Thread.Sleep(100);
SendMessage(but, BM_CLICK, 0, null);
System.Threading.Thread.Sleep(100);
SendMessage(test, WM_SETTEXT, 0, nothing);

所以我试图从C#表单设置Scintilla文本框(C ++)的文本。在程序更新之前,它使用了正常的RICHEDIT文本框。

0 个答案:

没有答案