-
July 20th, 2009, 07:45 AM
#1
Making a toolbar
Hello to all.
I would like to make a toolbar with one button. I wrote some code, and all seems to work corectly.
I only have 3 little questions:
1. Why my cursor is in "wait state" (hourglass) when is placed over my toolbar?
2. I created an image list for managing bitmaps. Could I manage one bitmap for the "default" state of the button, and another bitmap for the "disabled" status of the same button?
3. My sysmenu don't exist: why?
This is my code:
// main window class
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_PROVA_STAMPA));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_PROVA_STAMPA);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
// Creating main window
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
// Creating toolbar
hTool = CreateWindowEx(0, TOOLBARCLASSNAME, TEXT("TOOL"), WS_CHILD | CCS_ADJUSTABLE,
0, 0, 160, 140, hWnd, NULL, hInstance, WndProc);
Thank you soo much for any reply!
-
July 20th, 2009, 10:04 AM
#2
Re: Making a toolbar
MyRegisterClass is a MFC here its a non-MFC. But i know its not you intention. hehe its forgave. But about pointer and your sysmenu you are doing something wrong in your code. it put it here we can see it and finding out the problem. you said too you created an image list and you asked if you can manage it.! isn' it? yes i think you could manage it. but i dont know how.
-
July 25th, 2009, 09:48 PM
#3
Re: Making a toolbar
Originally Posted by kenlorth
MyRegisterClass is a MFC
???
You should start at least once the Win32 wizard...
-
July 27th, 2009, 03:13 AM
#4
Re: Making a toolbar
Ok, Ok
I solved about all of my troubles. Most of them was because I was migrating from a dialog based appl, to a window based appl. Now that I changed most of my "WM_COMMAND" messages and both the "main message cycle".
Now my SYSMENU works great and the cursor also.
I only would like to disable my toolbar button and to change my image from "active" to "disabled".
Does anyone know how to implement this change?
Thanks a lot for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|