Solved

How to prevent flicker, in tool/status bars ?

Posted on 2000-03-10
3
359 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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 …
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now