打开记事本(日志文件)时如何在文本末尾设置光标位置? [英] How to set cursor position at end of text while open notepad (log file)?

查看:52
本文介绍了打开记事本(日志文件)时如何在文本末尾设置光标位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我在记事本中添加/附加异常日志,现在日志太大,以使其用户友好我决定在日志文件的文本末尾设置光标位置,以便当用户单击查看日志"按钮时从应用程序他/她可以显示最近的日志.所以为了避免滚动,我想最后设置光标.

In my application, i add/append exception log in notepad and now logs are too big so to make it user friendly i decide to set cursor position at end of text of log file so when user click on "View Log" button from application s/he can show most recent log. So to avoid scrolling i want to set cursor at last.

目前我只是使用:Process.Start("notepad.exe",Path) 打开日志文件.

Currently i am simply using : Process.Start("notepad.exe",Path) to open log file.

推荐答案

  1. 一旦记事本启动,找到它的窗口.您可以使用 user32.dll.FindWindow.
  2. 使用 SendMessage 发送 WM_VSCROLL 带有 SB_BOTTOM 参数到此窗口.
  1. Once Notepad is started, find its window. You can use user32.dll.FindWindow.
  2. Use SendMessage to send WM_VSCROLL with SB_BOTTOM parameter to this window.

这篇关于打开记事本(日志文件)时如何在文本末尾设置光标位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆