Redefining or changing macro value

You can undefine it and define again: #include <iostream> #define AAA 13 int main() { #undef AAA #define AAA 7 std::cout << AAA; } outputs: 7 Please note that statements that start with # are preprocessor directives that are taken care of before the code is even compiled. In this case, this constant AAA will … Read more

Is there a Designer for MFC in Visual Studio like for windows forms in .NET?

This expands on Alex Farber’s answer, which is basically correct but somewhat incomplete. When you’re first creating your application, you get to select an application type: As you can see, the default selection for the Application type is “Multiple Documents”, but just below that is “Dialog Based”. Selecting that will produce an application whose main … Read more

How to format date and time string in C++

The C library includes strftime specifically for formatting dates/times. The format you’re asking for seems to correspond to something like this: char buffer[256]; strftime(buffer, sizeof(buffer), “%a %b %d %H:%M:%S %Y”, &your_tm); I believe std::put_time uses a similar format string, though it does relieve you of having to explicitly deal with a buffer. If you want … Read more

How do I force windows NOT to redraw anything in my dialog when the user is resizing my dialog?

You can’t prevent painting during resizing, but you can (with care) prevent repainting which is where flicker comes from. first, the bitblt. There a two ways to stop the bitblt thing. If you own the class of the top level window, then just register it with the CS_HREDRAW | CS_VREDRAW styles. This will cause a … Read more

How to detect a CListCtrl selection change?

Also try: BEGIN_MESSAGE_MAP(cDlgRun, CDialog) ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2) END_MESSAGE_MAP() /* … */ void cDlgRun::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; if ((pNMListView->uChanged & LVIF_STATE) && (pNMListView->uNewState & LVIS_SELECTED)) { // do stuff… } }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)