Hi,
I used the CSED template for CWindow: Tool Bar, and am interested in expanding it to use an image strip I made (48x48 32). In FireFly, the toolbar icons look sharp and crisp, but I can't get them to look the same. It's definitely a lack of understanding on my part, but I was curious if anyone can point me in the right direction. I've attached my code for toolbars in my new project and am curious if I'm overlooking a function or option.
I've attached a screenshot, the top is from FireFly's generated code and the bottom is from mine.
' ========================================================================================
' Create the toolbar
' ========================================================================================
FUNCTION CreateToolBar (BYVAL pWindow AS IWindow) AS DWORD
' // Add a toolbar
LOCAL hToolBar AS DWORD
hToolBar = pWindow.AddToolBar(pWindow.hwnd, %IDC_TOOLBAR, "", 0, 0, 0, 0, _
%WS_VISIBLE OR %WS_CLIPCHILDREN OR %WS_CLIPSIBLINGS OR %CCS_TOP OR %WS_BORDER OR %TBSTYLE_FLAT OR %TBSTYLE_TRANSPARENT)
local hImage, hImageList as dword
hImageList = ImageList_Create ( 48, 48, %ILC_COLOR32, 1, 0)
hImage = LoadImage(ghInstance, "TBSTRIP", %IMAGE_BITMAP, 0, 0, %LR_DEFAULTSIZE)
ImageList_Add hImageList, hImage, 0
'ImageList_AddMasked hImageList, hImage, RGB(255,0,255)
DeleteObject hImage
SendMessage hToolBar, %TB_SETIMAGELIST, 0, hImageList
LOCAL ttbb AS TBBUTTON ' specifies or receives the attributes of a toolbar button
' LOCAL ttbab AS TBADDBITMAP ' specifies the images to add to a toolbar
' LOCAL ptnmhdr AS NMHDR PTR ' information about a notification message
' LOCAL ptttdi AS NMTTDISPINFO PTR ' tooltip notification message information
LOCAL pttbb AS TBBUTTON PTR ' address of array of toolbar button info
' Allocate memory for the button info array
pttbb = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, 13 * SIZEOF(ttbb))
IF ISTRUE pttbb THEN
' Send the TB_BUTTONSTRUCTSIZE message, for backward compatibility
SendMessage hToolBar, %TB_BUTTONSTRUCTSIZE, SIZEOF(ttbb), 0
' Set the size of the bitmaps
SendMessage hToolBar, %TB_SETBITMAPSIZE, 0, MAKLNG(48, 48)
' Add buttons to the toolbar
@pttbb[0].iBitmap = 0
@pttbb[0].idCommand = %IDM_ADDPERSON
@pttbb[0].fsState = %TBSTATE_ENABLED
@pttbb[0].fsStyle = %BTNS_BUTTON
@pttbb[0].dwData = 0
@pttbb[0].iString = -1
@pttbb[1].iBitmap = 1
@pttbb[1].idCommand = %IDM_EDITPERSON
@pttbb[1].fsState = %TBSTATE_ENABLED
@pttbb[1].fsStyle = %BTNS_BUTTON
@pttbb[1].dwData = 0
@pttbb[1].iString = -1
@pttbb[2].iBitmap = 2
@pttbb[2].idCommand = %IDM_DELETEPERSON
@pttbb[2].fsState = %TBSTATE_ENABLED
@pttbb[2].fsStyle = %BTNS_BUTTON
@pttbb[2].dwData = 0
@pttbb[2].iString = -1
@pttbb[3].iBitmap = 3
@pttbb[3].idCommand = %IDM_SEARCH
@pttbb[3].fsState = %TBSTATE_ENABLED
@pttbb[3].fsStyle = %BTNS_BUTTON
@pttbb[3].dwData = 0
@pttbb[3].iString = -1
@pttbb[4].iBitmap = 4
@pttbb[4].idCommand = %IDM_CHECK
@pttbb[4].fsState = %TBSTATE_ENABLED
@pttbb[4].fsStyle = %BTNS_BUTTON
@pttbb[4].dwData = 0
@pttbb[4].iString = -1
@pttbb[5].iBitmap = 5
@pttbb[5].idCommand = %IDM_REPORT
@pttbb[5].fsState = %TBSTATE_ENABLED
@pttbb[5].fsStyle = %BTNS_BUTTON
@pttbb[5].dwData = 0
@pttbb[5].iString = -1
@pttbb[6].iBitmap = 6
@pttbb[6].idCommand = %IDM_OPTIONS
@pttbb[6].fsState = %TBSTATE_ENABLED
@pttbb[6].fsStyle = %BTNS_BUTTON
@pttbb[6].dwData = 0
@pttbb[6].iString = -1
@pttbb[7].iBitmap = 7
@pttbb[7].idCommand = %IDM_UPDATE
@pttbb[7].fsState = %TBSTATE_ENABLED
@pttbb[7].fsStyle = %BTNS_BUTTON
@pttbb[7].dwData = 0
@pttbb[7].iString = -1
@pttbb[8].iBitmap = 8
@pttbb[8].idCommand = %IDM_HELP
@pttbb[8].fsState = %TBSTATE_ENABLED
@pttbb[8].fsStyle = %BTNS_BUTTON
@pttbb[8].dwData = 0
@pttbb[8].iString = -1
@pttbb[9].iBitmap = 9
@pttbb[9].idCommand = %IDM_ABOUT
@pttbb[9].fsState = %TBSTATE_ENABLED
@pttbb[9].fsStyle = %BTNS_BUTTON
@pttbb[9].dwData = 0
@pttbb[9].iString = -1
SendMessage hToolBar, %TB_ADDBUTTONS, 10, BYVAL pttbb
' Free memory that was allocated for the button info
HeapFree GetProcessHeap(), 0, BYVAL pttbb
' Update the size of the toolbar
SendMessage hToolBar, %TB_AUTOSIZE, 0, 0
END IF
' // Add buttons to the toolbar
' Toolbar_AddButton hToolBar, %STD_CUT, %IDM_CUT
' Toolbar_AddButton hToolBar, %STD_COPY, %IDM_COPY
' Toolbar_AddButton hToolBar, %STD_PASTE, %IDM_PASTE
' Toolbar_AddButton hToolBar, %STD_DELETE, %IDM_DELETE
' ToolBar_AddSeparator hToolBar
' Toolbar_AddButton hToolBar, %STD_UNDO, %IDM_UNDO
' Toolbar_AddButton hToolBar, %STD_REDOW, %IDM_REDOW
' ToolBar_AddSeparator hToolBar
' Toolbar_AddButton hToolBar, %STD_FILENEW, %IDM_FILENEW
' Toolbar_AddButton hToolBar, %STD_FILEOPEN, %IDM_FILEOPEN
' Toolbar_AddButton hToolBar, %STD_FILESAVE, %IDM_FILESAVE
' Toolbar_AddButton hToolBar, %STD_PRINTPRE, %IDM_PRINTPRE
' ToolBar_AddSeparator hToolBar
' Toolbar_AddButton hToolBar, %STD_FIND, %IDM_FIND
' Toolbar_AddButton hToolBar, %STD_REPLACE, %IDM_REPLACE
' ToolBar_AddSeparator hToolBar
' Toolbar_AddButton hToolBar, %STD_PROPERTIES, %IDM_PROPERTIES
' Toolbar_AddButton hToolBar, %STD_PRINT, %IDM_PRINT
' ToolBar_AddSeparator hToolBar
' Toolbar_AddButton hToolBar, %STD_HELP, %IDM_HELP
' // Size the toolbar
' ToolBar_AutoSize hToolBar
END FUNCTION
Any help or pointers would be greatly appreciated.
Thanks!
John
This did the trick:
#RESOURCE MANIFEST, 1, "Manifest.txt"
Manifest.txt
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Program"
type="win32" />
<description></description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>