Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
O

ovidiucucu

@ovidiucucu
About
Posts
96
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • CStatic on CMDIChildWnd
    O ovidiucucu

    First of all, in your piece of code you have instantiated a CStatic object but have not created a static control (see CStatic::Create). And BTW: where/why do you want to put a static control in the MDI child frame window?

    Ovidiu Cucu Microsoft MVP - Visual C++ Cofounder CODEXPERT.RO

    C / C++ / MFC

  • thread pool
    O ovidiucucu

    There's almost NO need to have more threads than you have processors. Just almost.

    Ovidiu Cucu Microsoft MVP - Visual C++ Cofounder CODEXPERT.RO

    C / C++ / MFC question

  • Memory allocation related query
    O ovidiucucu

    Me too! ;)

    Ovidiu Cucu Microsoft MVP - Visual C++ Cofounder CODEXPERT.RO

    C / C++ / MFC csharp database visual-studio game-dev performance

  • Memory allocation related query
    O ovidiucucu

    Salut Florin, :) As stated in MSDN "The /LARGEADDRESSAWARE option tells the linker that the application can handle addresses larger than 2 gigabytes" but AFAIK you cannot pass beyond how much memory a process can handle, i.e. 4GB for Win32(see my first answer).

    Ovidiu Cucu Microsoft MVP - Visual C++
    Cofounder CODEXPERT.RO

    C / C++ / MFC csharp database visual-studio game-dev performance

  • Moving a window
    O ovidiucucu

    Just a little aside note. "Moving your window by dragging it by clicking on anywhere on the dialog" is OK in one particular case: it has no menu, no system menu, no maximize/minimize/close button, no scrollbars and is not resizeable. Returning always HTCAPTION from WM_NCHITTEST message handler leads in the impossibility of using menus,... and all enumerated above. A little bit better approach is to apply the trick only for the client area. Here is an example:

    UINT CMyDialog::OnNcHitTest(CPoint point) 
    {
       UINT nRet = CDialog::OnNcHitTest(point);
       if(HTCLIENT == nRet)
       {
          nRet = HTCAPTION;
       }
       return nRet;
    }
    

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC tutorial

  • Win32 / MFC mixing TRUE / BST_CHECK for SetCheck function
    O ovidiucucu

    You mean, BST_CHECKED and BST_UNCHECKED. Although, for the sake of good programming style and code readability, it's good to use those constants when calling CButton::SetCheck (may be also the third value BST_INDETERMINATE for three-state button), that is not a reason to worry in your particular case. BST_CHECKED and BST_UNCHECKED constants have the same values like TRUE and FALSE respectively: #define BST_UNCHECKED 0x0000 #define BST_CHECKED 0x0001 #define FALSE 0 #define TRUE 1

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC c++ help question

  • Memory allocation related query
    O ovidiucucu

    You can increase it to 200GB or more... the virtual memory size for a Win32 process is 4GB.

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC csharp database visual-studio game-dev performance

  • thread pool
    O ovidiucucu

    As stated in MSDN the maximum maximorum number of threads you can create is 2028. That is the limit for the default stack size of 1 MByte. However if you increase the stack size (see dwStackSize, second parameter in CreateThread documentation), the number of threads that can be created decreases accordingly. -- modified at 3:31 Friday 23rd November, 2007 ... and don't forget to count the threads already existent ... ;)

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC question

  • Memory allocation related query
    O ovidiucucu

    The remaining memory is reserved for the system and cannot be accessed from your program.

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC csharp database visual-studio game-dev performance

  • Resource Localization (Polish Character)
    O ovidiucucu

    See my answers in this thread[^].

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC visual-studio csharp question learning

  • DialogBox
    O ovidiucucu

    With no resource template, you can create a dialog based on a DLGTEMPLATE structure by calling either CreateDialogIndirect (modeless dialog) or DialogBoxIndirect (modal dialog).

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC tutorial learning

  • Need help: fatal error C1853: 'Debug/kui.pch' is not a precompiled header file created with this compiler
    O ovidiucucu

    Just take a look in MSDN[^]

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC help debugging

  • How to tell GUI to update controls from another thread?
    O ovidiucucu

    Did it work? Please post more detailed code.

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC tutorial question announcement

  • can i alter an extension .jpg or bmp file to extension .ico
    O ovidiucucu

    Yes, you can, but you may not. ;)

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC question

  • How do I write red text to a CDialogBar?
    O ovidiucucu

    You have chosen the harder way, but that's it... your choice. However, here are some "first look" remarks:* I put SetFont in WM_INITDIALOG message handler only as an example; you can put it also in any oter place, then call Invalidate() as well.

    • No need to write your own CMyToolbar::Invalidate function, as long as you can directly call Invalidate for the desired control.

      GetDlgItem(IDC_PATINFO)->Invalidate();
      
    • As long as you have not handled WM_PAINT in the static control, but you draw text in it from another place, for sure you'll have troubles after another window will overlap; just test it and see if I'm right.

      Ovidiu

    C / C++ / MFC question graphics tutorial

  • MFC to C#
    O ovidiucucu

    If someone agrees to pay enough money and is enough patient, then no problem, go ahead! Else, my sincere advice is to let it as it is.

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC csharp c++ database oracle sysadmin

  • How do I write red text to a CDialogBar?
    O ovidiucucu

    First of all, few aside notes:

    • A dialog bar is not quite similar to a dialog box, although both can be based on a dialog template. That because CDialogBar is not derived from CDialog but from CControlBar.
    • OnDraw is a virtual member function of CView which is called from within WM_PAINT message handler (OnPaint). Neither CDialog, nor CDialogBar have OnDraw method.
    • If you need a text in a dialog box or a dialog bar is easier to put it in a static or edit control rather than drawing it in WM_PAINT message handler.

    Given these said, I would like to suggest to derive from CDialogBar, make some "cosmetics", i.e. adding WM_INITDIALOG message handler (CDialogBar has not OnInitDialog virtual function like CDialog), change the edit's font in that handler, and finally set the edit's text color in WM_CTLCOLOR message handler. Here is a sample code:

    // MyDialogBar.h
    class CMyDialogBar : public CDialogBar
    {
    // Construction
    public:
       CMyDialogBar();
       
    // ...
    // Implementation
    protected:
       
       // Generated message map functions
       //{{AFX_MSG(CMyDialogBar)
       afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
       //}}AFX_MSG
       afx_msg LRESULT OnInitDialog (WPARAM wParam, LPARAM lParam); // <-- added by hand
       DECLARE_MESSAGE_MAP()
    };
    
    
    // MyDialogBar.cpp
    // ...
    MyDialogBar::CMyDialogBar()
    {
    // ...
    }
    void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
    {
       CDialogBar::DoDataExchange(pDX);
       //{{AFX_DATA_MAP(CMyDialogBar)
       // NOTE: the ClassWizard will add DDX and DDV calls here
       //}}AFX_DATA_MAP
    }
    BEGIN_MESSAGE_MAP(CMyDialogBar, CDialogBar)
       //{{AFX_MSG_MAP(CMyDialogBar)
       ON_WM_CTLCOLOR()
       //}}AFX_MSG_MAP
       ON_MESSAGE(WM_INITDIALOG, OnInitDialog) // <-- added by hand
    END_MESSAGE_MAP()
    
    LRESULT CMyDialogBar::OnInitDialog (WPARAM wParam, LPARAM lParam)
    {
       if (!HandleInitDialog(wParam, lParam) || !UpdateData(FALSE))
       {
          TRACE0("Warning: UpdateData failed during dialog init.\n");
          return (LRESULT)0;
       }
       CFont font;
       font.CreatePointFont(140, _T("Times New Roman"));
       CWnd* pEdit = GetDlgItem(IDC_EDIT_PATIENT);
       _ASSERTE(NULL != pEdit); // something stinks in here!
       pEdit->SetFont(&font); // set the "larger" font
       font.Detach();
    
       return (LRESULT)1;
    }
    HBRUSH CMyDialogBar::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
       HBRUSH hbr = CDialogBar::OnCtlColor(pDC, pWnd, nCtlColor);
       if(pWnd->m_hWnd == GetDlgItem(IDC_EDIT_PATIENT)->GetSafeHwn
    
    C / C++ / MFC question graphics tutorial

  • Generating GUID
    O ovidiucucu
    void CMyCoolDialog::OnButtonGenerateGUID() 
    {
       GUID guid;
       ::CoCreateGuid(&guid);
       // ...
    }
    

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC question c++

  • traverse a directory and list all file names?
    O ovidiucucu

    You can take a look at THIS FAQ[^]

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC question

  • please help
    O ovidiucucu

    How much you pay for that?

    Ovidiu Cucu Microsoft MVP - Visual C++

    C / C++ / MFC c++ com help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups