Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

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.

Can't initialize static SolidBrushes

Featured Replies

I seem to be unable to initialize a static SolidBrush in C++.This is what I attempt:In a class .h I declare a static SolidBrush like this: static SolidBrush brush_Mfd_Blk; // Cannot initialize herethen in the class .cpp file I define & attempt to initialize it like this: SolidBrush Cdu::brush_Mfd_Blk(Color(255, 0, 0, 0));and then attempt to use it in a classes draw() method like this: m_pGraphics->FillRectangle(&brush_Mfd_Blk, RectF(0, 0, m_bmp_w, m_bmp_h));and while everything compiles fine... I can see in the debugger that the Brush never gets initialilzed!Do you know what I am doing wrong? It seems that the Color constructor is not getting called.

Turns out the solution was just hard to see.Basically, GDI+ wasn't initialized before the static objects attempted to run their constructors, and this was because that initialization was in the constructor of the same class.Solution was to just to refactor that init stuff out and do it before anything else.

>Basically, GDI+ wasn't initialized before the static objectsattempted to run their constructors, and this was becausethat initialization was in the constructor of the same class.:) I hate errors like that... they tend to drive me nuts. In fact, I think I need a beer just thinking about it.Matt

Create an account or sign in to comment

Account

Navigation

Search

Search

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.