how to use resource editor

Started by goom, March 16, 2011, 04:38:22 PM

Previous topic - Next topic

TimoVJL

#15
In comctl32.dll resources
small bitmap 120
bigger bitmap 121
HBITMAP hBitmap = LoadBitmap(GetModuleHandle(TEXT("comctl32")), MAKEINTRESOURCE(120));

Bitmap from resource with 2 buttons
void FillToolbar(HWND hWndDlg, int iCtl)
{
TBBUTTON tbb[] = {
{0, IDM_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
{1, IDM_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON},
};
HWND hToolbar = GetDlgItem(hWndDlg, iCtl);
if (hToolbar) {
// Load the button images.
TBADDBITMAP tbBitmap;
tbBitmap.hInst = GetModuleHandle(NULL);
tbBitmap.nID = IDR_TOOLBAR1;
SendMessage(hToolbar, TB_ADDBITMAP, 2, (WPARAM)&tbBitmap);
//SendMessage(hToolbar, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
// Add buttons.
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hToolbar, TB_ADDBUTTONS, (WPARAM)NELEMS(tbb), (LPARAM)&tbb);
}
}

EDIT:
If need ToolTips insert TBSTYLE_TOOLTIPS|TBSTYLE_LIST to resource
and use this function:
void FillToolbar(HWND hWndDlg, int iCtl)
{
TBBUTTON tbb[] = {
{STD_FILENEW, IDM_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, (INT_PTR)"New"},
{STD_FILEOPEN, IDM_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0}, 0L, (INT_PTR)"Open"},
};
HWND hToolbar = GetDlgItem(hWndDlg, iCtl);
if (hToolbar) {
// Load the button images.
SendMessage(hToolbar, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
// Add buttons.
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hToolbar, TB_ADDBUTTONS, (WPARAM)NELEMS(tbb), (LPARAM)&tbb);
SendMessage(hToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
}
}
May the source be with you

Stefan Pendl

I think you should start at reading through the toolbar section at MSDN.
---
Stefan

Proud member of the UltraDefrag Development Team

jboyes

Thank you once again Timovjl. This time, not only did you answer my question but you did so even without me having to ask it. I am very grateful for the 'tooltip' edit that you made to your original post.

The beauty of your program snippets is that they are concise and they tie in beautifully with the Pelles IDE.

I am a C programmer of old but recently have been using Visual Basic Express. The problem with VB is that the programs are messy to disseminate due to the .NET runtime. With Pelles C, the programs I write can be passed on simply and even run as 'no-install' applications.

Many thanks for your help.

John.

migf1

#18
An old topic, but I think there is no need for a new one.

I don't seem to find how to disable snapping when creating/moving controls let's say inside a dialog parent. They always get snapped to the grid.

I did a quick search on the net, the forum and the help files, but I don't seem to find what I'm looking for.

Is there a command to disable snapping in the Pelles C resource-editor?

TimoVJL

Tools -> Options -> Dialog -> Use grid
May the source be with you

migf1

Thank you!

PS. It would be useful if this could be also addressed with the use of any of the Alt/Ctr/Shift keys. Perhaps in a future version. Thanks again!

CommonTater

Quote from: migf1 on May 06, 2012, 12:57:40 PM
Thank you!

PS. It would be useful if this could be also addressed with the use of any of the Alt/Ctr/Shift keys. Perhaps in a future version. Thanks again!


Tools -> Customize -> Keyboard -> Dialog

However the grid setting is global, if you enable it *all* controls will snap to their nearest gridline.




migf1

#22
Hello folks, loooooong time no see! Hope everyone is doing fine!

An ancient topic but I thought there is no need to start a new one. I just D/Led Pelles C v10.00.6 and playing a bit with the resource editor. I think the Properties dialog used to show brief hints for the selected property, at the bottom of the dialog. It has been removed or is it an option I can't find?

I mean this dialog: http://prntscr.com/tx7dd4 (shouldn't a brief hint about the selected "Group" property show at the bottom of the dialog)?

John Z

I don't recall seeing that in Pelles C.  VB has it.

John Z