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
  • Get Supported File System

    question
    4
    0 Votes
    4 Posts
    0 Views
    J
    The four main file systems supported by Windows are NTFS, exFAT, UDF, and FAT32. Additional file systems can be installed using IFS (Installable File System) drivers. The API you are looking for is the SetupAPI | Microsoft Docs[^]. It provides functions to enumerate installed drivers of specific types. But I have not used it for file systems so far and can't tell you therefore the GUID(s) to be used (the enumeration is basically identical for all device types).
  • 0 Votes
    3 Posts
    0 Views
    _
    You can find here a sample of how to use CRichEditCtrl with multiple level of undo/redo operations: How to Use RichEditControl 4.1 in CRichEditView[^].
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • How know if a window is above another

    question
    6
    0 Votes
    6 Posts
    2 Views
    L
    Windows API has the function GetTopWindow GetTopWindow function (Windows)[^] From the TopWindow you want walk down thru the chain via GetNextWindow GetNextWindow function (Windows)[^] So in your case you want to ask the topWindow of the window that contains both FileZilla window and a Notepad Window. You can then walk along the chain using GetNextWindow and see which is above which just by asking the window title. Something like this will work char buf[256]; HWND Wnd = GetTopWindow( /*handle of window containing both*/ ); GetWindowText(Wnd, &buf[0], sizeof(buf)); while (Wnd != 0 && !stricmp(&buf[0], "FileZilla") && !stricmp(&buf[0], "NotePad")) { Wnd = GetNextWindow(Wnd, GW_HWNDNEXT); // Next window GetWindowText(Wnd, &buf[0], sizeof(buf)); // Get it's title } if (Wnd == 0) { /* Error neither window found */ } else { /* Wnd is the topmost of 2 windows title and the string title is in buf */ } It is equivalent to EnumChildWindows function (Windows)[^] However for the simplicity you have it isn't worth setting up the enumeration function. In vino veritas
  • Frame or even Thread exception handler with _try _except/_catch()

    json
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    4 Posts
    0 Views
    J
    I would expect a meaningful error message if one the parameters is wrong. That generic message might indicate that it is networking problem. Because you are using localhost (127.0.0.1) it is probably not due to blocking by a firewall. You should check the port number and ensure that it is the port on which your server is listening. Depending on the operating system, you might also us a command line utility to show listening ports (as root/adminstrator: Linux: lsof -nPi, Windows: netstat -ban).
  • C pre increment and post increment

    question
    8
    0 Votes
    8 Posts
    1 Views
    A
    thank you .. :)
  • current user

    question
    7
    0 Votes
    7 Posts
    0 Views
    J
    I see - that makes it clear.
  • MFC libary makefile

    csharp c++ visual-studio question
    7
    0 Votes
    7 Posts
    0 Views
    J
    Thank you all for answering. I did the VS2008 makefile way. There were a lot of new afx...cpp files to add. It did compile (and yes, it worked fine at a first glance) and I tried to go further into the replacement of some feature pack subclassed windows. Finally I've stopped as there were too many changes necessary, which might cause side effects. Just wanted to get the beautiful MDI tear off feature of newer VS. :sigh:
  • How to make global 2D array using vectors

    c++ graphics data-structures tutorial
    6
    0 Votes
    6 Posts
    0 Views
    CPalliniC
    You are welcome.
  • unsigned and signed in C

    question
    6
    0 Votes
    6 Posts
    0 Views
    D
    Rick York wrote: It may not be what you want but it is as expected. :thumbsup: "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
  • 0 Votes
    7 Posts
    5 Views
    S
    Hi, Then i use STANDARD_RIGHTS_REQUIRED | PRINTER_ACCESS_USE | PRINTER_ACCESS_ADMINISTER everything perfect for network printers. http://selcukgural.com
  • local pointer need to initialize or not?

    question
    5
    0 Votes
    5 Posts
    1 Views
    J
    samzcs wrote: It works. It runs, which is a bit different. If the compiler changes in the future or the flow does then it might stop. Or it might cause problems in other places.
  • Writing a Sorting Algorithm -- NEED HELP!

    algorithms help question
    5
    0 Votes
    5 Posts
    0 Views
    D
    I'm seeing the word you/your seven times in that post. Somehow I do not feel that translates to us. if you need help with something you did, feel free to post the code, tell what it does or doesn't do, what it should do, and what you've tried. Ask specific questions, rather than broad questions. "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
  • Storage Allocation

    question
    7
    0 Votes
    7 Posts
    0 Views
    J
    ForNow wrote: New works well when you now Exactly howvmuch storage you want I.e a object or class That is not true. For an object in C++ you must ALWAYS allocate at least as much space is needed for the object. You can allocate more but it will be wasted. One can force C++ to use space that is less but that would be nothing but bad programming. ForNow wrote: In my case I am capturing user input and not quite sure thus HeapReAlloc All that means is that you are dynamically allocating the space. Which is something that C++ allows directly. You do not need to use a system API method to do that. As I previously pointed out HeapReAlloc has a specific purpose. And what you just described here is an inappropriate use of that. And one that could lead to resource (memory) starvation if you are not careful how you use it.
  • CEdit::LineLength returning zero

    database help
    15
    0 Votes
    15 Posts
    0 Views
    F
    This class may provide all the functionality of a DDV macro
  • How to pass size of an array from command line

    data-structures tutorial
    6
    0 Votes
    6 Posts
    0 Views
    CPalliniC
    Consider also using a vector[^], instead of a C-like array.
  • System tray

    2
    0 Votes
    2 Posts
    1 Views
    J
    Please don't cross post (post the same question at multiple places). I saw your later post in QA To minimize the app in system tray with menu[^] first and answered there.
  • Calling DLL method from multi-thread

    c++ help
    3
    0 Votes
    3 Posts
    0 Views
    V
    What is a type of your project? What is a type of a DLL?
  • Why -nan values appear

    c++
    6
    0 Votes
    6 Posts
    0 Views
    P
    ahem... Division by zero in general produces a (signed) Inf, not a NaN. Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012