I decided to start a new thread as most of the problems in the other thread were resolved. I have uploaded v1.2.0.2020 to the website. The changes are detailed there.

    [*]Loads edits and saves toolbar bitmaps up to 64 images
    [*]Saves in 16 or 256 color as well as 24 bit and 32 bit full RGB
    [*]Supports from 16x16 to 48x48 toolbars.
    [*]A good assortment of drawing tools
    [*]Re-arrange your toobar bitmap simply by dragging buttons
    [*]Customizable tools window allows you to remove or move tools
    [*]Tested on NT4,98/98SE/2K/XP

    The latest version is always available here
Posted on 2003-10-02 22:20:29 by donkey
Hi Donkey,

I think I know what is the source of the "drag-and-draw" bug. When you click outside the edit grid and move the mouspointer to it, you do not receive the WM_LBUTTONDOWN message, but only WM_MOUSEMOVE. On WM_LBUTTONDOWN you set up some important information (the starting point, the pen etc), so if you do not receive this message the info is not set. I suggest you toggle a flag that you got the WM_LBUTTONDOWN (or WM_RBUTTONDOWN) and then in the WM_MOUSEMOVE check this flag. If the flag is not set, you simply treat the movement as if none of the buttons (LMB or RMB) was down. Since you SetCapture and set the clipping region in the WM_L(R)BUTTONDOWN, you will always get the WM_L(R)BUTTONUP, on which you would reset the "mousedown" flag.

(I came to this just after I woke up this morning :) )
Posted on 2003-10-03 03:04:54 by Morris
Hi Morris,

Yes, the bug is fixed in my working version (build 2031) and will be posted very soon. It actually was much easier than that, it only requires a MoveToEx in the WM_MOUSEMOVE, that way it begins drawing at the point of entry. There were a few problems with the quick fix so I didn't include it in 2020. I am hoping to complete icons before I post the next update so it might be a few days, I am still working on a save routine for them. IPicture cannot seem to save an icon at a greater depth than 16 colors and it has problems with the masks of generated icons. I am working out a scheme to build the ico file manually from a bitmap. BTW the addition of 32 bit is the first baby step towards alpha blend bitmaps, I have alot of work to do on it but it may be possible to have an Alpha-brush tool.

I am looking for an example of gamma curve adjustments to an image (not a DC), Windows specs for XP call for a 0.75 gamma correction for hot image lists, you wouldn't happen to know a url that has info on this would you?
Posted on 2003-10-03 03:18:17 by donkey
Originally posted by donkey
I am looking for an example of gamma curve adjustments to an image (not a DC), Windows specs for XP call for a 0.75 gamma correction for hot image lists, you wouldn't happen to know a url that has info on this would you?

Sorry, no. I'm not into image manipulation at all.
Posted on 2003-10-03 09:17:20 by Morris
Hi all,

Version has been uploaded to the website, it includes a rudimentary plug in interface that will allow you to write custom image manipulation routines. For now I have an example that will adjust the LUMA (brightness) of an image. There is a small text file that explains the supported messages and the source code for Brightness.tbx (tbx=TBpaint eXtension).
Posted on 2003-10-06 12:38:10 by donkey
Hi Donkey,

I just ran TBPaint on WinNT4 and there is no Plugins menu! I checked the same executable on Win2K and there is the Plugins menu. Also, on Win98 it works okay. Strange...
Posted on 2003-10-08 08:32:13 by Morris
Hi Morris,

Does FindFirstFile work on NT4, I had just assumed that it worked on all platforms but I read in the compatibility summary that maybe it doesn't:
Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.

It does not expressly specify NT4. if not what can I do to find files in a folder ? The menu is added only if there is a file found by the FindFirstFile function otherwise there is no InsertMenuItem. All other calls in the procedure expressly mention NT4.
Posted on 2003-10-08 08:37:52 by donkey
Hi Donkey,

I was just about to edit my previous post to "" as I just downloaded it from your website (before you managed to update the html to display "2029" ;) ) and the same happens - no Plugins menu.

As for the FindFirstFile, PSDK says:

Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Posted on 2003-10-08 08:42:46 by Morris
Very bizarre,

This is the top of the sniplet that searches for plus ins and creates the menu, I have read through the docs and all of the functions are available.The only thing I can think of is that the MIIM_SUBMENU flag is not available in NT4, I will find a way to replace it but this is the only way I have ever added menus to the menu bar so I have to search for other API's.
invoke GetCurrentDirectory,MAX_PATH,ADDR OldPath

invoke GetAppPath,ADDR szExePath
invoke SetCurrentDirectory,ADDR szExePath

invoke FindFirstFile,OFFSET TbxFind,ADDR wfd
mov hFind,eax
; Add a PlugIn menu
mov mii.fType,MFT_STRING
mov mii.fState,MFS_ENABLED
invoke CreatePopupMenu
mov hTbxMenu,eax
mov mii.hSubMenu,eax
mov mii.dwTypeData,OFFSET TbxMenuText
mov mii.cch,0
invoke InsertMenuItem,hMenu,2,TRUE,ADDR mii

I am going over GetAppPath from the MASM32 library, maybe that's where the problem is...
Posted on 2003-10-08 08:54:45 by donkey
Hi Morris,

The problem should be fixed, with NT4 you cannot specify MIIM_STRING, you must use MIIM_TYPE instead and fill the FTYPE parameter with MFT_STRING. However if you specify both MIIM_STRING and MIIM_TYPE it will fail in all Windows versions I tested on, the trick is only use MIIM_TYPE and dump the newer stuff. Can you test it on NT4 and post if it is OK. The file is uploaded to the site (v1.2.0.2030)
Posted on 2003-10-08 09:45:19 by donkey
Hi Donkey,

I'll test it tomorrow at work (I do not have WinNT4 at home).

After I copy and paste a selection, the SELRECT retains the original selection coordinates - I think it should follow the floating selection coordinates
Posted on 2003-10-08 11:15:53 by Morris
Hi Morris,

Yes, the TBP_GETSELRECT returns the coordinates of the focus rectangle at the time of selection. I am trying to work out a method of allwoing you control over the three planes of the image in the editor but it is a bit complicated as the function of each plane is tool dependant (ie grid/paste/line/etc...). I am rewriting part of the draw routine to allow the layer selection message you requested, might take a while...

EDIT: I think the solution might be to add a plane that is only for plugins and allow you to draw directly to it, a flag could be used to tell the editor to turn it on or off.
Posted on 2003-10-08 12:16:43 by donkey

Can you test it on NT4 and post if it is OK. The file is uploaded to the site (v1.2.0.2030)

Well, I do not know if it works (I haven't brought 2030 from home and there's already a 2031 on your website), but the 2031 does not work on WinNT4. It displays the plugins menu as expected, but when I select any plugin from this menu, the program hangs (or better - it does not accept ANY user input). Tested it on Win2K and there's no such problem.
Quick look in OllyDbg proved, that TBPaint does not reach the PLUGIN.TbxInvoke call (so it is not the plugin that causes the stall), it does not even reach the procedure that does this call (you have this proc at the top of your source, I guess, because it is the first proc in the executable module, at RVA 0x00401000)
Posted on 2003-10-09 03:34:26 by Morris
2031 just had the messages added that you hd requested, there were no other changes from 2030.

It works fine on XP and 98SE as well. I will try to find a machine that is running NT4 but they are pretty rare. I will also read over every api that is called within the tbx module. Maybe I can find something there, there is some gdi stuff called just before the message window is created in order to set up for the needs of the plug ins. Just as a question because I can't find a reference, does NT4 support HWND_MESSAGE windows ?
Posted on 2003-10-09 03:48:43 by donkey
Hi Donkey,

PSDK says:
CreateWindowEx Function
Handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows.

Windows 2000/XP: To create a message-only window, supply HWND_MESSAGE or a handle to an existing message-only window.

Hmmmm, according to this it should not work on Win98 but it does. Strange...
Posted on 2003-10-09 04:04:56 by Morris
Hi Morris,

Can you try this if you have the time. I have removed the HWND_MESSAGE from the CreateWindowEx function. I also pointed the Window Name to a NULL termninated string instead of just using NULL.
Posted on 2003-10-09 04:23:44 by donkey
Hi Donkey,

You forgot to increase the build number... :) Anyway, this time it works okay :)
Posted on 2003-10-09 04:29:02 by Morris
Thanks Morris,

Yeah, I turn off the auto increment when I am compiling tests or we would already be at version :) it is back on now. Weird about the HWND_MESSAGE thing...
Posted on 2003-10-09 04:32:56 by donkey
Hi Donkey!

I got to say this is a very nice program! Keep up the good work!
Just one question: Are you going to add support for saving to *.ico?

Posted on 2003-10-09 09:06:18 by Tommy
Hi Tommy,

Thanks. Yes, I will eventually add it, I am woringing on a routine to save a bitmap as an icon with transparency.
Posted on 2003-10-09 09:20:27 by donkey