Search Results

Search found 4 results on 1 pages for 'dave17'.

Page 1/1 | 1 

  • Why callback functions needs to be static when declared in class

    - by Dave17
    I was trying to declare a callback function in class and then somewhere i read the function needs to be static but It didn't explain why? #include <iostream> using std::cout; using std::endl; class Test { public: Test() {} void my_func(void (*f)()) { cout << "In My Function" << endl; f(); //Invoke callback function } static void callback_func() {cout << "In Callback function" << endl;} }; int main() { Test Obj; Obj.my_func(t.callback_func); }

    Read the article

  • Does a modeless dialog processes WM_DESTROY Message?

    - by Dave17
    I'm trying to create a modeless dialog as the main window of a program but it doesn't seem to respond WM_DESTROY or WM_NCDESTROY Message. HWND hwnd=CreateDialogParamA(hInst,MAKEINTRESOURCE(IDD_DIALOG1),0,DialogProc,LPARAM(this)); if (!hwnd) { MessageBox(0, "Failed to create wnd", 0, 0); return NULL; } ShowWindow(hwnd,nCmd); UpdateWindow(hwnd); while (GetMessage (&msg, NULL, 0, 0) > 0) { if (!IsWindow(hwnd) || !IsDialogMessage(hwnd,&msg)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } } Modeless Style format from Resource file STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU

    Read the article

  • Insert an element to std::set using constructor

    - by Dave17
    is it possible to insert a new element to std::set like in case of std::list for example: //insert one element named "string" to sublist of mylist std::list< std::list<string> > mylist; mylist.push_back(std::list<string>(1, "string")); Now, mylist has one element of type std::string in its sub-list of type std::list. How can you do the same in if std::set is the sub-set of std::list my list i.e std::list<std::set <string>> mylist; if you can't then why not?

    Read the article

  • Get last/newly added element in std::set

    - by Dave17
    can you get the last or newly added element in std::set? for example say if the loop runs to collect the elements to fill in the std::set. if on the first run the set was, [0] "A" [1] "B" [2] "D" and, on second run, the set becomes [0] "A" [1] "B" [2] "C" [3] "D" How would you check if 'C' is the new element that was added?

    Read the article

1