Hi :)
Yesterday I was trying to code some quick addins for WinAsm on my free time. I failed miserably :grin: but I learned a bit on the CodeHi control. I'm posting the sources here in case someone can get help me fix them, or if anyone is interested in playing with them to code new addins.

1. RtfExport.dll

The idea was to send a EM_STREAMOUT message to CodeHi, and save the output RTF stream into a file. Simple enough, right? Well, all I got were corrupted streams. After some hair pulling, I lay my eyes upon the addins include file, where I find out that only SF_TEXT was supported. Ouch. :(

2. Capture.dll

I wasn't giving up on the idea of a new addin for this week :) so I gave that source another try. This time, I would send a WM_PAINT message with a compatible DC in wParam, so CodeHi would paint the whole file as a bitmap that I could save.

But all I got were black rectangles. :sweat:

Now, I think the problem is that CodeHi simply doesn't support that feature. Probably richedit doesn't either, I didn't check. But if we're optimistic, maybe I made a mistake somewhere else in the code. My bet would be the SaveBitmap function, it was taken from some parts of the TBPaint sourcecode that Donkey posted. Since I had to make some adaptations to make it work for me, maybe it isn't working as expected. :confused:

Most likely this two addins are never going to work. Nevertheless, I'm taking on another one (an HTML export addin), but don't expect it any soon (it's a lot harder to do). For now I can successfully parse WinAsm.Ini and MASM.vas to get all the parameters for syntax colouring. All I have left is getting the colors for each character from the CodeHi control (so I don't have to implement syntax colouring myself), and of course writing the HTML codes.

If anyone has tried something like this before, I'd be glad to hear about it :)

Posted on 2004-03-08 16:24:42 by QvasiModo
Hi Qvasimodo,

Nice ideas, although failed! I 'll study them and see if anything can be done! (YES only SF_TEXT is suppported)

HTML export addin is a Very good idea and I 'd love to use it.


Posted on 2004-03-09 03:51:13 by akyprian
Thanks, I'm glad to hear you like them! :)

This is all I have so far of the HTML Export addin. I stopped at this point because I don't know how to get the colors of the text... (CodeHi is very similar to Richedit, but I haven't worked with them past the first Iczelion tutorial).

I tried the following: selecting each character in the control, and sending EM_GETCHARFORMAT to get the color. However it is always returning zero, and the message is not listed in WAAddIns.Ini so I guess it's not supported by CodeHi.

What should I do? :(
Posted on 2004-03-09 11:00:43 by QvasiModo

CodeHi is very similar to Richedit but don't expect full compatibility. There are RichEdit messages not supported by CodeHi and vice versa. No, EM_GETCHARFORMAT is not supported. I would suggest you have a good look at the DrawLine procedure of the RAEdit control. This would give you a very good starting point. We can discuss anything that might tease you.


Posted on 2004-03-10 05:30:22 by akyprian
Thanks for the tip. I'll check out the RAEdit source, if I have any questions I'll post them here. :)
Posted on 2004-03-10 11:17:51 by QvasiModo