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
  • 60 terrible tips for a C++ developer

    c++ learning com
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • 0 Votes
    13 Posts
    3 Views
    C
    Thinking along the same lines. What's driving the need to do this is the 3rd party emulation system. Customer wants this system to fit into their new, super secure cloud system with network licenses, etc. Lots of requirements/desires that collide with each other. The good side of things is that the Windows side of the code is minimal - it just provides a framework for the parts that actually do all the work. Refactoring is exactly what is going on. 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.
  • Boolean gates. Part 2

    question
    11
    0 Votes
    11 Posts
    21 Views
    C
    Interesting
  • working with C++ includes and examining header files used in LLVM

    c++
    5
    0 Votes
    5 Posts
    4 Views
    L
    jschell wrote: why would the OP ask the question in the first place? The question makes specific reference to LLVM, so I assume that is what he is concerned about. I stand ready to be corrected.
  • 0 Votes
    31 Posts
    92 Views
    A
    pk
  • Arduino Switch Case.

    question hardware tutorial
    9
    0 Votes
    9 Posts
    15 Views
    G
    It was a need to think carefully, code blindness issue. I knew if I posted it the lounge I would get cruified by all and sundry needed somewhere to write think and take notice of the abortion I has created. :omg:
  • Boolean gates

    tutorial question
    6
    0 Votes
    6 Posts
    4 Views
    C
    Thanks Use “APM” in the Lounge search box to find my APM related AI post
  • The thread 0x6B8 has exited with code 2 (0x2).

    question c++ debugging
    3
    0 Votes
    3 Posts
    10 Views
    Q
    That's the answer I was looking for hours ago! Thank you kind Sir! After looking into the ressource.h-File I can confirm that it's because of the ID of the Control which lead to the end of the thread. For example: I was kinda terrified of the unknown thread-exit code 32780. Cannot look up what's this about because usually the exit codes are not as far specified. After launching my exit procedere mindlessly with my overloaded OnCancel with ID 32780 the weird exit messages kept coming. But I never thought that far. Hopefully someone will spare some time with this information. best regards
  • mscjsres-dll not found error

    help com
    4
    0 Votes
    4 Posts
    6 Views
    V
    Sorry! I didn't expect this OP to be spam... :doh: And yes, please remove my reply! :)
  • google

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • RegQueryValueExW vs RegQueryValueExA

    visual-studio help
    4
    0 Votes
    4 Posts
    7 Views
    D
    What's so strange? The call is telling you the number of bytes needed to hold the value string that would be returned. For an ASCII string, you need 10 bytes. For the Unicode version, you need 20 bytes. Read the documentation on RegQueryValueExA (ow W): Quote: A pointer to a variable that specifies the size of the buffer pointed to by the lpData parameter, in bytes. When the function returns, this variable contains the size of the data copied to lpData. The lpcbData parameter can be NULL only if lpData is NULL. If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes any terminating null character or characters unless the data was stored without them. For more information, see Remarks. ---> If the buffer specified by lpData parameter is not large enough to hold the data, the function returns ERROR_MORE_DATA and stores the required buffer size in the variable pointed to by lpcbData. In this case, the contents of the lpData buffer are undefined. <--- If lpData is NULL, and lpcbData is non-NULL, the function returns ERROR_SUCCESS and stores the size of the data, in bytes, in the variable pointed to by lpcbData. This enables an application to determine the best way to allocate a buffer for the value's data. If hKey specifies HKEY_PERFORMANCE_DATA and the lpData buffer is not large enough to contain all of the returned data, RegQueryValueEx returns ERROR_MORE_DATA and the value returned through the lpcbData parameter is undefined. This is because the size of the performance data can change from one call to the next. In this case, you must increase the buffer size and call RegQueryValueEx again passing the updated buffer size in the lpcbData parameter. Repeat this until the function succeeds. You need to maintain a separate variable to keep track of the buffer size, because the value returned by lpcbData is unpredictable. If the lpValueName registry value does not exist, RegQueryValueEx returns ERROR_FILE_NOT_FOUND and the value returned through the lpcbData parameter is undefined. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code
  • mutex problem

    help question announcement
    3
    0 Votes
    3 Posts
    8 Views
    J
    Noting from the design or even architecture perspective anytime code is going to be 'waiting' on something else (thread, process, Rest, message, etc) then one should at least consider what would happen if it never happens. So for example that is why one should consider timeouts. Doesn't mean you should implement that but one needs to at least put some thought into the impact on the application/enterprise if nothing every happens.
  • 0 Votes
    4 Posts
    6 Views
    CPalliniC
    Quote: Is there a way to add all the elements of a vector to an integer sequentially? Yes, there are, at least, three different ways: #include #include #include using namespace std; void dump (vector v) { for (auto x :v ) cout << x << " "; cout << "\n"; } int main() { { // method 1: access items by indices vector v{1,2,3}; int c = 4; for (size\_t n = 0; n v{1,2,3}; int c = 4; for (auto & x : v) { x += c; } cout << "method 2: "; dump(v); } { // method 3: use 'transform' of the algorithm library vector v{1,2,3}; int c = 4; transform(v.begin(), v.end(), v.begin(), \[=\](int x){ return x+c; }); cout << "method 3: "; dump(v); } } Quote: As a side note, is there a way to add a repeating number to an integer to infinity? Yes, but this way the addition will overflow. Try: #include using namespace std; int main() { int i = 1; int last_i; int c = 4; for (;;) { last_i = i; i += c; if ( i < last_i) break; } cout << "unfortunately, (" << last_i << "+" << c << ") makes " << i; } "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • Owner Draw List Box &amp; GetText()

    question lounge
    2
    0 Votes
    2 Posts
    3 Views
    T
    You probably already discovered what the issue is back in 2005. However, googling for the same issue in 2023 brought me here. For anyone else having the problem, you need to also set the LBS_HASSTRINGS state for the ownerdrawn listbox.
  • Image compression

    question database graphics json tutorial
    3
    0 Votes
    3 Posts
    2 Views
    C
    Thanks Griff
  • 0 Votes
    1 Posts
    2 Views
    No one has replied
  • Com Automation latest library for working with ms excel.

    c++ com testing tools
    3
    0 Votes
    3 Posts
    8 Views
    V
    1. In VS menu Project -> Add New Item ... -> 2. In "Add New Item" dialog select MFC in the treeview left, and then choose the "MFC Class From Typelib" and press the Add button 3. In the "Add Class From Typelib" dialog choose the source of interface (registry or file), type libraries and then all the needed interfaces. 4. then press OK
  • CPU Usage

    question
    11
    0 Votes
    11 Posts
    21 Views
    D
    I don't know for sure, but I suspect thread scheduling on different cores running at different speeds. On a 13900, you have 8 performance cores, which support HT, and 16 efficiency cores, which don't support HT. So I have 24 cores that can run at vastly different speeds, supporting 32 threads. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • A two-dimensional std::vector for use by all

    graphics
    5
    0 Votes
    5 Posts
    8 Views
    J
    But failing to address the first comment "Usually pointless except in the mind of the poster."
  • 0 Votes
    42 Posts
    192 Views
    P
    The issue is not that people don't care. It is that they consider the entirely unsupported opinion of their reference group to carry infinitely more weight than the actual verified facts.