Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[solved] Subclass label(static text) to avoid flickering

Featured Replies

Posted

I subclassed a label(static text) control to avoid text flicking,

and dealed with WM_SETTEXT of label's message,

however, the bitblt function didn't work.

Thank you. Attachment is the c++ source.


//label's subclass wndProc
char szBuf[512]={0};
HDC hdc, hdcMem;
if(message == WM_SETTEXT) {
strcpy(szBuf, (char *)lParam);
lParam = 0;
hdc = GetDC(hLabel);
hdcMem = CreateCompatibleDC(hdc);
SetTextColor(hdcMem, RGB(255,0,0));
TextOut(hdcMem, 0, 0, szBuf, strlen(szBuf));
BitBlt(hdc, 0, 0, 300, 300, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
ReleaseDC(hLabel, hdc);
return 0;
}

flickerLabel.zip

Edited by alaphate

Hmm,

I don't know about the flicker... Maybe you should handle the WM_CTLCOLORSTATIC message.

Look here for an example of how to do that...

Greetings,

Mr. eXoDia

  • Author

Mr. eXoDia,

Thank you for the example, WM_CTLCOLORSTATIC is used to change

Static Text or readonly Edit Box's font color and background.

To avoid text blinking when it is updated very frequently, double buffer HDC

should be used.

The problem is that I couldn't make BitBlt take effect.

  • Author

If I select a bitmap to hdcMem and draw text on it, BitBlt will work.

It's resolved :cowboy:

Edited by alaphate

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.