显示行号 [英] displays the line numbers

查看:71
本文介绍了显示行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Hello

我想在 中显示文字notpad窗口,我使用SendMessage函数,它工作但现在我想显示每行显示的行号我尝试sendmessage但它没有任何想法吗?

Hello
I would like to display a text in a  notpad window, I used the SendMessage function and it worked but now I would like to display the line number in front of each line displayed I tried with sendmessage but it did not work any ideas please?


显示文字:

to display the text:


  int nCharsR = SendMessage(hWnd2,WM_SETTEXT,10000,(LPARAM)输出); //它的工作 

 int nCharsR = SendMessage(hWnd2, WM_SETTEXT, 10000, (LPARAM)output); // it's work 


来显示ligne数:

to diplay the ligne number:


/ * ... * /

/*...*/


int ligneOUt = 1

int ligneOUt = 1


  if(c ==" \\ \\ n")

{

ligneOUt = ligneOUt + 1;

  int nCharL = SendMessage(hWnd2,WM_SETTEXT,10,(LPARAM) )ligneOUt);  //总是不起作用ncharL
有零 


推荐答案

你好,

据我所知,变量"output"是文本。如果你想要行号,你也应该发送一个文本,但你发送一个整数。你必须将ligneOUt转换为一个字符串:

as far as I understand, the variable "output" is the text. If you want line numbers, you should send a text too, but you send an integer. You must convert the ligneOUt to a string:

char sztmp[100];
sprintf(sztmp, "%i", ligneOUt);
..SendMessage(..(LPARAM)sztmp);

我不知道Notepad如何处理WM_SETTEXT消息。它是否连接了多条消息中的文本?还是只显示一条消息?每条消息的文本?输出是一个文本,但你想发送多个ligneOUt到记事本。如果记事本只能处理
一个文本,那么你必须发送一个大号文本,行号由"\ n"分隔。

I don't know how Notepad handles the WM_SETTEXT message. Does it concatenate text in multiple messages? Or does it only show one text per message? output is one text, but you want to send multiple ligneOUt to Notepad. If Notepad can only handle one text, then you must send a big text with line numbers separated by "\n".

问候,Guido


这篇关于显示行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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