Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to prevent flicker, in tool/status bars ?

Posted on 2000-03-10
3
379 Views
Last Modified: 2013-12-03
I added few lines to VC++ 6.0
default Hello Wold program under win 32
option to add tool and status bars.
I created them, and size them
#include <commctrl.h>
#include <afxres.h>
#pragma comment(lib, "comctl32")

#define MAX_LOADSTRING 100

// Global Variables:
HWND hWndStatus, hWndTool;
TBBUTTON tbButtons[] =
{
      {STD_FILENEW, ID_FILE_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0},
      {STD_FILEOPEN, ID_FILE_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0}
};

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
      InitCommonControls();
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }
      hWndStatus = CreateStatusWindow(WS_CHILD | WS_BORDER  |WS_VISIBLE, TEXT(""),
         hWnd, ID_STATUSBAR);
   SetWindowText(hWndStatus, TEXT("STATUS"));
   hWndTool = CreateToolbarEx(hWnd, WS_CHILD | WS_BORDER  | WS_VISIBLE,
         ID_TOOLBAR, 2, (HINSTANCE) HINST_COMMCTRL, IDB_STD_SMALL_COLOR, (LPCTBBUTTON) &tbButtons,
         2, 0, 0, 16, 16, sizeof(TBBUTTON));
   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

AND SIZING IS AS:


            case WM_SIZE:
                  SendMessage(hWndTool, WM_SIZE, 0, 0);
                  SendMessage(hWndStatus, WM_SIZE, 0, 0);
                  break;

but I can not prevent alot of flickering,
what is the better way ?
0
Comment
Question by:hasmet
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 200 total points
ID: 2604940
okay to improve what you have there add WS_CLIPCHILDREN to the options when you create your main window

  hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

and use

PostMessage(hWndTool, WM_SIZE, 0, 0);
PostMessage(hWndStatus, WM_SIZE, 0, 0);

it also looks like your hello world is being drawn where you toolbar is so you will have to adjust for that so you can see it

HTH

Shaun Wilde
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2604947
I feel greedy taking 200 points like that so if you want to reject and resubmit with 50 points - I will not hate you or anything
0
 
LVL 1

Author Comment

by:hasmet
ID: 2606179
200, is fine and I will give it to you,
but still there is more flicker in the tool bitmaps, and status text, than
other applications such as visual studio,
any more ideas  please ????
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question