Solved

How to prevent flicker, in tool/status bars ?

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio Exe Issue, 12 36
Run Program using VBScript 3 77
Winform not working on 64 bit machine 31 104
Why I am having this error installing Visual Basic Enterprise 11 65
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

713 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