Skip to content

C / C++ / MFC

C, Visual C++ and MFC discussions

This category can be followed from the open social web via the handle c-c-mfc@forum.codeproject.com

111.5k Topics 465.7k Posts
  • Visual C++ homework question

    c++ question tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • c++

    c++ help
    2
    0 Votes
    2 Posts
    1 Views
    D
    ...and you had question about this? What part of this don't you understand, or are having a problem with. Just posting your homework assignment is not asking a question. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • 0 Votes
    7 Posts
    11 Views
    Mircea NeacsuM
    Quote: Just guessing. Well, you didn't guess right :) Pretty much all you said is valid for the old C qsort function. std::sort is an entirely different beast. I suggest you carefully read the description at std::sort - cppreference.com[^] Quote: The sort routine ignores the type and whether the object containing the type is private or public. I'm not sure I understand what you mean by "the object containing the type". In C++ objects don't contain types. Besides the sort routine is not ignoring the object type at all. According to C++ reference: "The type of dereferenced RandomIt must meet the requirements of MoveAssignable and MoveConstructible". That requires at least a copy constructor for the object (either user defined or generated by the compiler). Quote: The comparison function has no cognizance of privacy, it is only passed pointers/objects and returns a bool. Of course not, the comparison function needs to access the members of the object in order to compare them. Either it is a member function or a friend function or the members in question are public. The example on the C++ reference page mentioned above shows all the different methods you can use to invoke the std::sort algorithm. Mircea
  • GetComputerObjectNameW Win API is failing

    help c++ json
    8
    0 Votes
    8 Posts
    0 Views
    R
    Hi Victor, There was configuration issue with my windows laptop, so I was facing issue. Thanks for your feedback.
  • Win32 Structures

    question c++ json
    7
    0 Votes
    7 Posts
    3 Views
    1
    Non-virtual functions don't change a class instance size. You can use this technique, as in existing Microsoft classes like CPoint, CRect, adding instance non-virtual functions and static functions, if necessary.
  • Zoom image on mouse position

    graphics help question
    3
    0 Votes
    3 Posts
    0 Views
    G
    Thank you Richard, tried with GDI+ only with some changes, now, i am able to get the required output. Regards, Gopinath.
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • C(17) Complete Tutorial References

    tutorial question announcement learning
    15
    0 Votes
    15 Posts
    0 Views
    C
    ic... maybe i was thought it got an error while posting...
  • 0 Votes
    8 Posts
    0 Views
    L
    Sorry, that is something I have never seen before. To be honest I think you are in danger of making things far more difficult than you need. The original spec I suggested where you can generate (or not) the macro that includes a runtime check, is the simplest way of doing it.
  • MFC: CMFCPropertysheet CMFCPropertypage

    c++
    2
    0 Votes
    2 Posts
    0 Views
    V
    Just save the active page index in registry before closing. Then read it from registry before activating and set the active page.
  • The free useful tool does not work on Windows 10.

    com tools help question
    5
    0 Votes
    5 Posts
    0 Views
    M
    Thank you for the alternative method. I will try the BAT file. Can anyone find the reason why the free tool failed to work on Windows 10? Thanks!
  • 0 Votes
    3 Posts
    0 Views
    V
    Member 14882671 wrote: I use SetParams in the ToolTip callback function and set new color/text . However, I can't get new color when the tooltip displayed. After I debug and found that it can't enter CMFCToolTipCtrl onPaint. If I use invalidate, then the whole ActiveX Control will flash rapidly. I inherited CMFCToolTipCtrl and found that WM_PAINT cannot be received There are virtual methods you could use to customize CMFCToolTipCtrl: [CMFCToolTipCtrl Class | Microsoft Docs](https://docs.microsoft.com/en-us/cpp/mfc/reference/cmfctooltipctrl-class?view=msvc-160#onfillbackground) and some other OnDraw... methods.
  • MFC Dialog Based App Scaling Problem

    c++ help question
    18
    0 Votes
    18 Posts
    0 Views
    L
    Hi, You should be able to fix this without modifying/recompiling the application. You would need to use the manifest tool to embed an application manifest. You would need to set the dpiAware/dpiAwareness mode. Application Manifests - Win32 apps | Microsoft Docs[^] Best Wishes, -David Delaune
  • cheapest cbd hemp flower online

    com
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • s r flip flop

    2
    0 Votes
    2 Posts
    0 Views
    D
    No, that's not how this site works. We'll help you with YOUR code, but the site is not a "code to order" site. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • Unexpected output in array

    data-structures
    5
    0 Votes
    5 Posts
    0 Views
    CPalliniC
    :-D Thank you. "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • Recognize smart card reader type using winscard visual C++ 6.0

    c++ help question
    3
    0 Votes
    3 Posts
    0 Views
    Richard DeemingR
    I seriously doubt Eka is still looking for an answer 11½ years later. :doh: "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • code analysis

    5
    0 Votes
    5 Posts
    0 Views
    M
    Hi Greg, Thank you for your immediate response. I understood the point clearly. Regarda, Niharika
  • callbacks in c

    tutorial learning
    3
    0 Votes
    3 Posts
    1 Views
    K
    You might already be familiar with callbacks and not realize it. If you've ever used qsort() or bsearch(), or another library function that takes a function pointer as an argument to help it do its work, you have already used callbacks! For example the signature for qsort is void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); and might be used like this struct foo { char key[10]; int id; /* more members */ }; /* comparison function to sort struct foo by key */ int cmpfoo_bykey(const void *vp1, const void *vp2) { const struct foo *foo1 = vp1; const struct foo *foo2 = vp2; return strcmp(foo1->key, foo2->key); } /* comparison function to sort struct foo by id */ int cmpfoo_byid(const void *vp1, const void *vp2) { const struct foo *foo1 = vp1; const struct foo *foo2 = vp2; return foo1->id - foo2->id; } int main() { struct foo my_data[100]; /* load data into my_data : not show here*/ /* sort my_data by key field */ qsort(my_data, 100, sizeof(struct foo), cmpfoo_bykey); /* use my_data in key-ordered way ... */ /* sort my_data by id field */ qsort(my_data, 100, sizeof(struct foo), cmpfoo_byid); /* use my_data in id-ordered way ... */ return 0; } In the above example qsort() knows how to sort an array of items in a generic way, but not how to compare items. It gets around this limitation by using a callback function, that the programmer provides, that does know how to compare items in the array. So, whenever qsort() needs to know how two items in the array compare to each other, it calls back to the code provided by the programmer to determine how the two items compare to each other. Keep Calm and Carry On