Hi all.
I?m trying to add some lines to the output window by a custom addin and i don?t know how to do that.
I only can put text with WM_SETTEXT, but how to append text?
Thanks.
Posted on 2003-11-25 04:44:25 by MaRi
Hi,

Firstly, You have to select where you want to append text. Then, replace selection with your text e.g.


AppendText Proc

Local chrg:CHARRANGE

MOV chrg.cpMin,????
MOV chrg.cpMax,????

Invoke SendMessage,hOut,EM_EXSETSEL,0,ADDR chrg
Invoke SendMessage,hOut,EM_REPLACESEL,FALSE,Offset YourText

RET
AppendText EndP

I hope this helps

Regards,

akyprian
Posted on 2003-11-25 05:00:07 by akyprian
what i have to do with
MOV chrg.cpMin,????
MOV chrg.cpMax,????

i have tested without this lines, but sometimes, the text dont appears int the window.

AppendText Proc Texto:DWORD
Local chrg:CHARRANGE
Invoke SendMessage,hOut,EM_EXSETSEL,0,ADDR chrg
Invoke SendMessage,hOut,EM_REPLACESEL,FALSE, Texto
ret
AppendText EndP

...
invoke AppendText, CTEXT("Launching...")
invoke AppendText,offset szCode

Im doing OK?
Posted on 2003-11-25 10:33:28 by MaRi
Hi,

chrg.cpMin and chrg.cpMax tell you the range of the already existing text in the output window that will be selected. e.g. if you set both to 0 then you actually select no text and the caret is that the origin. If you set cpMin, say 5, and cpMax, say 23, then you select text starting from the fifth character up to the twenty third.

After this, using EM_REPLACESEL, you will replace the selectied text (as explained above) with your own string.

Regards,

akyprian
Posted on 2003-11-25 11:47:00 by akyprian
Ok, and...how to get the length of all the current text?
(to append my text with all before text)
Posted on 2003-11-25 13:35:19 by MaRi
Hi,

In WAAddIn.inc you can find all messages you can send to the CodeHi control. In your case, you need to send WM_GETTEXTLENGTH to get the length of the existing text. After this you set your selection with EM_EXSETSEL and finally use EM_REPLACESEL.

I hope this helps,

akyprian
Posted on 2003-11-26 01:05:20 by akyprian
Ok.Doit.
another question:
I want to controle the lines i put in output window :
changing the backcolor whe dblclick,going to a especific line in the code when dobleclicked...
And i need to draw (and clear ) an error symbol (X) in the lineNumbers window.
Dificult?
Posted on 2003-11-26 03:11:37 by MaRi
Hi,

In the OutWindowProc of your Add-In catch the WM_LBUTTONDBLCLK message i.e


;Get Selection
Invoke SendMessage,hOut,EM_EXGETSEL,0,ADDR chrg
;chrg.cpMin is the position of the first character of the selection.
;chrg.cpMax is the position of the last character of the selection.


;Get line number of the selection
Invoke SendMessage,hOut,EM_EXLINEFROMCHAR,0,chrg.cpMin
MOV LineSelected,EAX


;De-hilite previously hilited line
Invoke SendMessage,hOut,CHM_SETHILITELINE,LineHilited,0

;And hilite the line user clicked
Invoke SendMessage,hOut,CHM_SETHILITELINE,LineSelected,1 (or 2 depending on the color you want)


;Draw error symbol
Invoke SendMessage,hOut,CHM_SETBOOKMARK,Line,7

;or Erase Error symbol
Invoke SendMessage,hOut,CHM_SETBOOKMARK,Line,0



;To go to a specific line use:
Invoke SendMessage,hEditor,EM_LINEINDEX,LineNo,0
MOV chrg.cpMin,EAX
MOV chrg.cpMax,EAX
Invoke SendMessage,hEditor,EM_SETSEL,chrg.cpMin,chrg.cpMax
Invoke SendMessage,hEditor,EM_SCROLLCARET,0,0


I hope this helps

akyprian
Posted on 2003-11-26 03:33:04 by akyprian
and... how I can get a error line number from a String and store it in the output window line( for get this when a user dblclicked in this line)
Posted on 2003-11-26 09:33:55 by MaRi
Hi,

1)The following gives you the text of one line (I am not sure if this is what you need)

.DATA?
LineText DB 16384 DUP(?)

.CODE

GetLineText Proc Uses ESI

MOV ESI, Offset LineText
MOV WORD PTR ,16383;SizeOf LineTxt-1

Invoke SendMessage,hEditor,EM_GETLINE,LineNumber,ESI
;Returns in EAX Number Of characters copied

MOV BYTE PTR ,0

;Now LineText contains all the text of this line

RET
GetLineText EndP

2)If you mean that you have a string and you need to get some numbers out of it then you have to parse your string. Can you give me an example of your string so that I can help you with parsing?

Regards,

akyprian
Posted on 2003-11-26 11:57:08 by akyprian
hi, ....yes:
C:\ASM\NASM\Tests\nasmaddin.asm:7: error: invalid combination of opcode and operands
where 7 is the line number of the error

thanks for your quick answers,akyprian, and of course, thnks for WinAsm.
Posted on 2003-11-26 13:05:51 by MaRi
Hi,

There are very many different ways to parse a string. A very quick ( not optimized AND NOT TESTED) one would be:

;Remember from my previous post that ESI is our line string pointer. Also EAX is the length of the line string:

PUSH EDI
MOV EDI,ESI
ADD ESI,EAX
XOR EAX,EAX
DEC ESI
.While ESI>EDI
.If DWORD PTR ==": ro"
SUB ESI,4
.If DWORD PTR =="rre "
SUB ESI,5
.If BYTE PTR ==":"
MOV BYTE PTR ,0
DEC ESI
;ESI points to the last digit of your number

@@:
DEC ESI
.If ESI<EDI
.Break
.EndIf

.If BYTE PTR ==":"
INC ESI
MOV EAX,ESI
;EAX points to the first digit of your number
.Break
.Else
JMP @B
.EndIf

.Else
ADD ESI,5
.EndIf
.Else
ADD ESI,4
.EndIf
.EndIf
.DEC ESI
.EndW
POP EDI

.If EAX ;Means that the string ": error:" has been found
;Use "PrintStringByAddr EAX" to Verify that you get "7"
;Now you have to use a routine to convert string "7" to a number. Search the board and you will find many such routines.
.EndIf



I tried to give you an idea of what you are supposed to do. I hope it helps.

Regards,

akyprian
Posted on 2003-11-26 15:09:21 by akyprian
hi,
I have a Beta Version of my first addin: a Nasm Addin.
what you think about?

note: Copy Nasm.ini in Winasm directory and chahge in this file the Nasmw path.
Posted on 2003-11-27 09:20:20 by MaRi
Hi,

I haven't really tested it yet but I recommend you upload your Add-In in a NEW thread explaining what your Add-In is supposed to do. Also some guide on how to use the Add-In would be of much help.

Regards,

akyprian
Posted on 2003-11-27 09:57:28 by akyprian
Fine.
When I finish the guide, i post it in a new thread.
Posted on 2003-11-27 11:52:53 by MaRi