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
  • male muscles performance back without any negative

    com performance
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • male muscles performance back without any negative

    com performance
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Can resource statement CTEXT be used with CStatic

    learning
    3
    0 Votes
    3 Posts
    0 Views
    F
    Thanks with the SS_NOTIFY I can process the ::onCtlColor use the CWnd::GetDlgitem (for proper control) and SetbkColor SetTextColor and SetWindowText of the controls before the Dialog which is the parent to the control is displayed. Thanks
  • Windows 8.1 Event log problem

    c++ help
    3
    0 Votes
    3 Posts
    0 Views
    Z
    Hi David, it is not a permission issue. Code is working both windows vista and windows 7. Also current code had been worked since one years on windows 8.1. This is not sense. We have checked latest windows updates, but we have nothing. :(.
  • SDI Project Question

    tutorial question com help
    3
    0 Votes
    3 Posts
    0 Views
    A
    Hi, thank you very much, it works :D, my first listview :D Now i can extend my App an learn more :D Best regards Arrin.
  • 0 Votes
    5 Posts
    1 Views
    CPalliniC
    Unfortunately, no (I am confused too). By the way, I've balanced the downvote.
  • [C] possible OOP approach

    csharp hardware tutorial question
    4
    0 Votes
    4 Posts
    1 Views
    C
    Hi Lukeer ! Returning a struct is indeed valid C. It's even given as example in section 6.8.6.4 of the C11 standard, which deals with the return statement. The return is done with a dumb bit by bit copy. This works very well for struct composed of fundamental types. But as soon as you have pointers in the struct, you need to be extremely careful about who owns an object and shall invoke (manually) the destructor: there is a high risk of nasty memory deallocation errors here ! The more efficient approach would be to return pointers as you suggested. But then, you'll have a high risk of memory leakage, in case the caller is not interested in the returned value (in other functions than the constructor). The safer way would be to design the API to encourage the caller to provide a pointer to the struture to be used, that he is responsible of (whether it's mallocated or local): class_animal a,*pa; newClassAnimal(&a); // reuse the existing structure pa = newClassAnimal (NULL); // or allocate a new one. // here the caller is aware that he has to manage the object I used very long time ago these kind of structures. The function pointers prove to be very efficient way to implement polymorphism in a non object language like C. However the management of the object has its drawback: no automatic destruction, and hence high risk of leakage for more complex execution flows, and especially if you use setjmp/longjmp.
  • need help with linked structs at C language

    com help
    13
    0 Votes
    13 Posts
    1 Views
    A
    esecuse me kind sir but thats not really true after each and every answer i get i dont just copy it, i also try to udnerstand where i went wrong and try to udnerstand it , I am learning from my mistakes after all i only started with the programming in this year
  • Need help with assembly x86 using C language

    algorithms help learning
    8
    0 Votes
    8 Posts
    0 Views
    A
    well thank you...
  • Doubt

    help question
    13
    0 Votes
    13 Posts
    0 Views
    L
    That is an example, your job is to fill in the fine detail. You will learn much more by trying it yourself than if someone else writes it for you. As an exercise you can try different values of num also.
  • 0 Votes
    2 Posts
    5 Views
    B
    Just posting what I've resorted to for anyone else reading this in the future... I decided to handle WM_GESTURE messages and provide the calls to ScrollWindow there since the scroll position and scroll handle position can be correctly processed. The caveat to all this is that it requires targeting Windows 7 and in my case, since I'm still using Visual Studio 2008 Professional, my IDE needed to bind to the Windows SDK v7.1 for the updated headers needed. Newer IDE's will already bind to a version of the Windows SDK that includes the necessary symbols for targeting Windows 7. Another caveat is that newer versions of MFC supposedly provide support for gesture via virtual member functions, but no classwizard support (as of VS 2012 Pro), blah...blah...blah, so adapt your approach as your environment dictates.
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Event objects VS Global variables

    visual-studio
    7
    0 Votes
    7 Posts
    1 Views
    F
    Don't post questions on many places. You already posted it here[^].
  • CString.Format anomaly

    question
    10
    0 Votes
    10 Posts
    0 Views
    F
    Thanks
  • New to C++ and Programming, Absolutely new

    c++ regex question
    5
    0 Votes
    5 Posts
    0 Views
    T
    please post the result or nobody can help you.
  • Failure to remove folders after using CFileDialog DoModal

    10
    0 Votes
    10 Posts
    1 Views
    D
    Still learning how to code wrote: I picked up a function RecursiveDelete on the internet, as I needed to erase all files and folders on an SD card... Why not just use SHFileOperation() with the FO_DELETE operation? "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
  • Multithread c Windows

    help sysadmin
    6
    0 Votes
    6 Posts
    0 Views
    M
    Thanks for your advices!!!! I will correct code source.
  • Existing VR Frame Renderers

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Load CSV file to a database in Windows 64bit

    database help
    2
    0 Votes
    2 Posts
    0 Views
    J
    You can install the Microsoft Access Database Engine 2010 Redistributable[^]. I'm not sure if the Text Writer is included but I think so. There are 32 and 64 bit versions of the redistributable. The version to be installed depends on the application that will use the database drivers (install the 32 bit version for a 32 bit application even when it is running on a 64 bit Windows). Special care must be taken when Office is installed (see the CP tip Microsoft Access Database Engine 2010 Redistributable[^]).
  • 0 Votes
    4 Posts
    0 Views
    S
    fwrite only stores the memory contents of the class test - it doesn't care about the class definition except for it's size in memory. CString stores the text in dynamic memory, only handle (pointer) to that memory is directly stored inside the CString object, therefore writing oTest just stores that pointer, but not the contents. If you use char[50] instead, that is a fixed-size array that is stored fully in your class test, and therewore fwrite will write it to file correctly. The correct way to implement streaming for your test class in C++ is by overloading the streaming operators. See http://www.tutorialspoint.com/cplusplus/input_output_operators_overloading.htm[^] GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)