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
  • Mpi blocking communication

    database graphics
    2
    0 Votes
    2 Posts
    21 Views
    J
    Use code tags when you post code. The context of your questions is not clear. There is theory and there is practice (implementation). To which do your questions refer? Are you asking if your code is right? And only that? Are you asking if your theory is right? And only that? If the second then the code doesn't help. If the first then you should provide some specifics about which part of the code you think has a problem. If you are mixing the two then I would suggest that you rethink what it is that you actually need to ask. I suspect also that at least for the theory you need to run on hardware that tests this. Not clear to me how your code insures that the hardware is even being used. That however might both be because you didn't use code tags and because I didn't look that closely at the code.
  • Paige-Tarjan algorithm in C

    algorithms data-structures collaboration tutorial
    4
    0 Votes
    4 Posts
    36 Views
    J
    GitHub - fandreuz/BisPy: BisPy - Python bisimulation library[^]
  • Extracting the Points from a CRgn Object - C / C++ / MFC ...

    c++
    2
    0 Votes
    2 Posts
    22 Views
    V
    have a look at [CRgn Class | Microsoft Learn](https://learn.microsoft.com/en-us/cpp/mfc/reference/crgn-class?view=msvc-170#getregiondata) and [RGNDATA (wingdi.h) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-rgndata)
  • How to create a hover popup window beside the mouse cursor

    c++ tutorial question
    2
    0 Votes
    2 Posts
    23 Views
    L
    It depends on what is in the spot that the mouse is hovering over. Take a look at sme of the following links: mfc tooltip - Google Search[^].
  • 0 Votes
    15 Posts
    64 Views
    L
    Salvatore Terress wrote: obviously Qt question No, nothing to do with Qt. But then that is (the main) part of your problem, you seem to be confused between what is Qt, the language library or the Linux shell.
  • Repost This is a request for C/C++ code...

    c++ help tutorial question announcement
    4
    0 Votes
    4 Posts
    32 Views
    L
    Thanks, as I suspected "stdin" and file "pipe" are what I failed to put into THE equation. Unfortunately all these " well meaning " but superficial, distracting from subject , AKA not answering questions , commentaries about security did not help... SOLVED 10-4
  • Visual Studio Resource Editor

    question csharp visual-studio announcement learning
    5
    0 Votes
    5 Posts
    50 Views
    Mircea NeacsuM
    You still can edit it but it invalidates the signature - makes sense. Never tried it before, thanks for uncovering another detail. Mircea
  • how to get "native window" ?

    c++ tutorial question
    18
    0 Votes
    18 Posts
    106 Views
    L
    Salvatore Terress wrote: what am I missing ? It makes no difference how you run that command string, it will never work. If that command succeeds then the generated shell that runs the sudo command will be elevated to (possibly root) status. It will then terminate and return to your application which runs at non-elevated level. If you want root access in your application then you have two very simple choices: 1. Do what k5054 advised and set up your account to run at higher level. 2. Call sudo in your shell before launching your application.
  • get_string memory leak?

    question com performance learning
    14
    0 Votes
    14 Posts
    95 Views
    C
    Harvard esp. so :) Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
  • purpose of parameter value of -1 ?

    question
    8
    0 Votes
    8 Posts
    38 Views
    CPalliniC
    Amen! :-D "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • Concurrent linked list

    data-structures help tutorial question
    2
    0 Votes
    2 Posts
    19 Views
    J
    cod3Ninj4 wrote: I can't figure out how to handle the case Good thing because there is no way to handle that case. You can only do it with one of the following. 1. One and only one lock. 2. Two dummy nodes, one at each end. cod3Ninj4 wrote: Is there a more efficient way to handle this situation? Probably but that answer depends on how it is used and not on how it is implemented.
  • Using /bin/sh "partially " works

    linux help
    4
    0 Votes
    4 Posts
    27 Views
    J
    Most if not all of what I said the last time you posted about sudo still applies. Re: Please - explain the C++ code / function - C / C++ / MFC Discussion Boards[^] Before following up with this or anything in the future at a minimum you need to understand what the command does, including the exact output when you run it yourself from the command line. You also need to understand everything the QT QProcess class does. QProcess Class | Qt Core 6.6.1[^] You must specifically understand how to code to all of the following - exitCode() - readAllStandardError() - readAllStandardOutput() - There must be a way to control stdin dynamically but I could not see it. But you can use setStandardInputFile() for basic understanding. I suggest you start with the command 'ls' and do NOT start with 'sudo' so you can understand how to use the above methods. You should test the following - A directory that does not exist - A directory that does exist. Keep in mind that although you are working with the QT library coding to run a process in ANY programming language is going to require that you understand the dynamics of how that works. It might help to read up on what the following means. - Exit value - stdio: stderr, stdout, stdin.
  • 0 Votes
    14 Posts
    89 Views
    J
    Salvatore Terress wrote: It was not my choice to use lambda - I took the code from another forum contributor Pretty sure that is a choice. As suggested in the other post you can rewrite it. Not sure I have ever used a code sample where I did not modify it.
  • strlen innards

    html question
    3
    0 Votes
    3 Posts
    32 Views
    J
    Presumably already clear what the 4/8 block is used in the first place. Googling with following provides some answers. explain strlen himagic lomagic Following line is the key if (((longword - lomagic) & ~longword & himagic) != 0) I tried eye balling that and using examples in my head but still not clear. I believe it is relying on arithmetic overflow. If I wanted to understand that I would write up some test code with examples characters (4 blocks) with zero at the end (position 4, 3, 2, 1). Then have it print the results of each clause in the above if using binary representation (1 and 0) to see how the bits look for each different example and for each part of the clause. Perhaps as a learning experience also copy that code into your own space and then write a test jig to time results via that and using the more straightforward (just by char) code. You should start with a large number of runs like probably at least 100,000.
  • Missing "type specifier " ?

    database debugging linq functional question
    10
    0 Votes
    10 Posts
    52 Views
    L
    I am using this code example to get more familiar with "connect". I am at 3rd attempt to write easy to understand way to process menu / submenu code. I had it working at one time, for one menu. Now I am adding more menu and now my submenus are "multiple selection" instead of single submenu. This code example seems to have that "fixed" , but now it is using lambda...
  • PreTranslateMessage method is missing

    c++ visual-studio question
    2
    0 Votes
    2 Posts
    17 Views
    V
    Open ClassWizard and and add virtual method PreTranslateMessage. Then select the message WM_CHAR to handle it in OnChar
  • Printing to exact coordinates on paper or lottery tickets

    help tutorial question
    3
    0 Votes
    3 Posts
    20 Views
    I
    That is a good idea, will look into it.
  • how to bypass loop ?

    database json tutorial question
    4
    0 Votes
    4 Posts
    33 Views
    J
    In C++ Macros - As noted you can remove the code entirely - You can also use a macro that resolves to a different value For code - Add a flag. - Add a class that manages flags Larger apps would use the second. Your code then tests the flag. There are various ways the flags can be set: command line, config file, database. There are various ways to manage the class itself. Could be static or use a builder pattern. Example of flag usage if (myFlagClass.IsSet("TestFlag131")) .... For systems (not just an app) can use special values in an API. The code of the target service looks for those special values and returns a fixed, or even variable, result. This is somewhat useful in verifying end to end enterprise functionality.
  • help me to replace / clean my hack C++ code PLEASE

    c++ help
    2
    0 Votes
    2 Posts
    20 Views
    L
    Salvatore Terress wrote: To make sure for people who "do not get it" - if you are not wiling to help, please do not respond.. Kindly stop giving orders. As you have been repeatedly told, just post the question. If the answer is not to your exacting requirements, then you have two choices: 1. Politely ask for clarification. 2. Ignore it.
  • 0 Votes
    3 Posts
    33 Views
    C
    Thanks for advice, I’ll give it a try