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
  • Single View with Multiple Tabs in MFC

    c++ performance question
    19
    0 Votes
    19 Posts
    0 Views
    V
    Did you try to google for something like "CMFCTabCtrl handle tab change"? Try! Then you'll find this one: [visual c++ - CMFCTabCtrl catch tab change event - Stack Overflow](https://stackoverflow.com/questions/17739054/cmfctabctrl-catch-tab-change-event) and some more info!
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • How to add tabs to CView Class?

    c++ tutorial question
    31
    0 Votes
    31 Posts
    0 Views
    _
    Hi. Have you solved this ?
  • How to get object of a view which is created using AddView().

    c++ tutorial
    8
    0 Votes
    8 Posts
    0 Views
    L
    Each call to AddView returns an index of the tab view. So when you want to make a particular view active you just call SetActiveView passing the relevant index value.
  • How to change color of Tab View in MFC

    c++ tutorial question
    6
    0 Votes
    6 Posts
    1 Views
    V
    :thumbsup: :)
  • Error while using static int for incremental record.

    c++ help
    5
    0 Votes
    5 Posts
    0 Views
    CPalliniC
    :thumbsup:
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • two errors

    help question
    2
    0 Votes
    2 Posts
    0 Views
    V
    [Linker Tools Error LNK2001](https://msdn.microsoft.com/en-us/library/f6xx1b1z.aspx) [How to fix?: error LNK2001: unresolved external symbol "extern "C" ........](https://social.msdn.microsoft.com/Forums/vstudio/en-US/4523e57a-c16b-4378-8c42-52f7cf5b98da/how-to-fix-error-lnk2001-unresolved-external-symbol-extern-c-?forum=vclanguage) [error LNK2001 - Google Search](https://www.google.de/search?q=error+LNK2001&oq=error+LNK2001&aqs=chrome..69i57&sourceid=chrome&ie=UTF-8)
  • 0 Votes
    5 Posts
    0 Views
    L
    You can tighten the structure at the cost of a carry an action size count. However it does allow you to use the same actions blocks for multiple states. That may often happen in that you just have things like confirm yes/no actions. I also changed your pointer definitions to const as you are clearly going to have static tables and it will save compiler type casting errors. I assume you are going to do this .. see the C11 initializers at code end which uses the standard _countof to autosize the arrays. on GCC it's ARRAY_SIZE() but I hate the name so always define it _countof same as MSVC because it reflects better what it is IMHO. typedef bool (*returnTrueOrFalseFunctionPtr) (void); typedef void (*actionFunctionPtr) (int); struct myAction_s { const actionFunctionPtr actionToPerformInThisState; const uint32_t actionArgument; }; struct myStruct_s { returnTrueOrFalseFunctionPtr trueOrFalse; const struct myStruct_s* whereToGoIfTrue; const struct myStruct_s* whereToGoIfFalse; const uint8_t maxActionsInThisState; // Count of the actions in this state const struct myAction_s* actionsListInThisState; // The action block pointer }; static void SomeYesFunc (int) { } static void SomeNoFunc(int) { } static void SomePerhapsFunc(int) { } static bool truefalseFunc(void) { return true; } /* ACTION BLOCK DEFINITIONS */ const struct myAction_s yesNoBlock[2] = { &SomeYesFunc, 1 , &SomeNoFunc, 2 }; const struct myAction_s yesNoPerhapsBlock[3] = { &SomeYesFunc, 1 , &SomeNoFunc, 2, &SomePerhapsFunc, 3}; /* ACTION STATE DEFINITIONS */ const struct myStruct_s nullState = { 0, 0, 0, 0, 0}; const struct myStruct_s yesNoState = { &truefalseFunc, &nullState , &nullState, _countof(yesNoBlock), &yesNoBlock[0] }; const struct myStruct_s yesNoPerhapsState = { &truefalseFunc, &nullState , &nullState, _countof(yesNoPerhapsBlock), &yesNoPerhapsBlock[0] }; In vino veritas
  • How to release IDispatch memory.

    question performance help tutorial announcement
    7
    0 Votes
    7 Posts
    0 Views
    J
    Member 10253026 wrote: First we get the attributes from the OCX interface using GetAttributes() and we get variant with Pdispvalue.... Does OCX increase the refernce count of Pdispvalue to one here ? This should be part of the OCX documentation. I guess that the reference count is incremented. Quote: Then we attach this pdispval to the OledispatchdriverObject using AttachDispatch()...Does the reference count go to two ? AttachDispatch() will increment the reference count. So you have to call Release() or set bAutoRelease. But when using AttachDispatch() your OleDispatchDriver object will be the owner of the interface. So you should not use the pDispVal member of the VARIANT afterwards anymore (set it to NULL to avoid using it). Memory is only freed when the reference count becomes zero when calling Release(). I suggest to check the return value when calling Release(). Then you will know when memory is freed. To check the actual reference count without releasing, just call AddRef() and Release().
  • 0 Votes
    9 Posts
    0 Views
    L
    charlieg wrote: Might be a little heavy for what I need, but very interesting items. Two thoughts: 1.) If you actually want to debug an error occuring when ProgramB is launched from ProgramA. There is no other way. 2.) If your question was worded incorrectly and you just simply need to debug ProgramB then just attach a debugger to it. Best Wishes, -David Delaune
  • Implication of assign a value at function entry

    tutorial
    16
    0 Votes
    16 Posts
    0 Views
    L
    X|
  • serializing an std::chrono::duration object with Boost

    json question announcement
    5
    0 Votes
    5 Posts
    0 Views
    A
    If I knew what I was looking for. It's entirely possible that my debugging skills are lacking.
  • 0 Votes
    11 Posts
    0 Views
    T
    thank you :)
  • Double Click on ProgressBar

    question
    5
    0 Votes
    5 Posts
    0 Views
    D
    Fedrer wrote: ...but not working. Care to share (the code)? "One man's wage rise is another man's price increase." - Harold Wilson "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
  • debugging a Boost serialization assertion

    c++ debugging json help tutorial
    3
    0 Votes
    3 Posts
    0 Views
    A
    I found that what displayed when I hovered my cursor over the variable eti just before the assert triggered while debugging contained, among other things, the string "rook". That's the string I had associated with the derived Piece class I would expect the first element of m_whiteArmy to point to an element of using BOOST_CLASS_EXPORT_GUID, so I figured there was something wrong with how I did that association. I tried moving my calls of that macro from the top of the Piece cpp file to the top of the main file, and the assertion has gone away. I wish I knew why this is correct and what I'd done before wasn't, but it least it seems to be working now.
  • Serializing CMapStringToPtr

    help tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    CPalliniC
    Key order is not a property of such a collection (see the documentation[^]) unlike, for instance, the std::map. So yes, you have to work around that.
  • Strange Debugging results

    c++ visual-studio debugging performance
    10
    0 Votes
    10 Posts
    0 Views
    F
    Richard as you noted the assembly didn't match the source It lead me to insert #pragma optimize("",off) and #pragma optimize ('',on) around the function the call to __imp CWnd::FromHandle disappeard and debugptr had the right value Thanks
  • 0 Votes
    5 Posts
    0 Views
    CPalliniC
    Based on your idea.
  • When an process is loaded

    c++ performance question
    4
    0 Votes
    4 Posts
    0 Views
    L
    See PsSetCreateProcessNotifyRoutine function | Microsoft Docs[^].