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
  • Macro analysis - help wanted

    c++ help question
    7
    0 Votes
    7 Posts
    0 Views
    V
    Using "plain" GCC++. I'll try the /P option and will report the results if necessary.
  • create a dpi-aware application

    question c++ wpf learning
    10
    0 Votes
    10 Posts
    2 Views
    T
    Thanks! This is the info where I was looking for!
  • Passing / modifying char* to/ by function.

    debugging help tutorial question
    10
    0 Votes
    10 Posts
    0 Views
    L
    Personally code in this form I would not allow in our code base as it will lead to bleeding memory when used by others. It is not clear that the function allocates memory, to anyone other than yourself and not being aware the function setups to use the char* pointer return and lose it ... take this basic code CLASS_LCM1602 myCLASS_LCM1602 = .. some initialization; /* now use your function */ std::cout << myCLASS_LCM1602.BuildMessage("Demo my Title", 10) << "\n"; That bleeds memory and the whole setup of the function encourages it because people will be tempted to feed the return char* value into functions. For my 2 cents I would force you to use this interface for what you wanted to do .. Joe below has made the same comment. int CLASS_LCM1602::BuildMessage(const char *title, int value, char* buffer, int bufSize) It is much cleaner in that they pass you a buffer to fill and it's size and you return how many characters you put in the buffer. Both you and they can be safe about handling the string becasue all sizes are known both directions. If they want to allocate a buffer they can but they then know they have responsibility to dispose it. It is also more flexible because you can use it on temporary stack allocated buffers .. something like this is a perfectly valid temp buffer with no allocate required. char tempBuf[256]; As an example the actual Windows framework MFC is copying does exactly that :-) GetWindowTextA function | Microsoft Docs[^] In vino veritas
  • VC++ Word automation issues on Win 10

    c++ testing tools question
    3
    0 Votes
    3 Posts
    0 Views
    N
    Yes. its mystery on Windows 10 only . My code will edit word document with some values and it gives to printer.
  • WiFi Notifications [SOLVED]

    com sysadmin json question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • List HDD files in CListView

    8
    0 Votes
    8 Posts
    0 Views
    _
    Ok, thank you, I guess I am on the right road regarding icons ... remain only context menu :)
  • Initializing struct (in C++)

    help c++ visual-studio data-structures
    2
    0 Votes
    2 Posts
    0 Views
    L
    You have either set the C++ standard flags low or the default on your compiler is not c11++ or greater I have no issue with GCC or VS2017 taking structs like that. try the flag -std=c++11 or I would probably try and see if it is available -std=c++20 BTW if it is actually a C file you need different flag .. I know you were playing with C files before -std=c11 Now that I think about that I am guessing that is the issue you are compiling C files with G++ .. don't :-) Setup your make file to send C files to the c compiler gcc, you can make a rule based on the extension .c vs .cpp .c files => gcc .cpp files => g++ Visual Studio actually does exactly that it uses the filename extension to decide on c vs c++ compiling, which is why it works on it. In vino veritas
  • Driving Ctatic::DrawItem

    c++ csharp tutorial
    2
    0 Votes
    2 Posts
    0 Views
    F
    Didn't have a message map entry from my Derived CStatic also the text of the Static control isn't set in the itemData you have to a GetWindowText to get it with those two fixes everything worked
  • No Errors but wrong values on return?

    visual-studio testing beta-testing help question
    25
    0 Votes
    25 Posts
    25 Views
    U
    I have no idea about this. But I will try it on my wow computer .
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 有什么学习途径

    c++
    2
    0 Votes
    2 Posts
    0 Views
    Richard DeemingR
    Member 14076567 wrote: What are the ways and forums for learning MFC, I am developing MFC software. This is an English-language site. Please post questions in English. Via Google Translate: 这是一个英语网站。 请用英文发布问题。 "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • C Programming Books

    c++ learning tutorial
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • AfxMessage doesn’t block

    debugging help design announcement
    5
    0 Votes
    5 Posts
    0 Views
    F
    This is just to debug a scenario that only happen in release I have to have a way of stopping the thread in release and attaching the debugger if there is a better way please share thanks
  • Keyboard functionality for IExplorerBrowser

    question c++ com json
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Found Api's Causing Heap Corruption

    json
    8
    0 Votes
    8 Posts
    0 Views
    CPalliniC
    Thank you, Richard. :)
  • 0 Votes
    6 Posts
    2 Views
    L
    I can only assume that your instr variable does not contain the number of 45 character fields that you think. However only the debugger could confirm that.
  • String Search In C++

    help tutorial c++ algorithms regex
    11
    0 Votes
    11 Posts
    0 Views
    J
    Think about the difference of using cout inside the loop and after the loop.
  • 0 Votes
    11 Posts
    0 Views
    V
    Found this procedure , for Eclipse IDE, which puts difffernt spin onto the problem. To me it implies that linker can use "source" instead of library. To use the latest Bluetooth kernel modules is one important thing, but without support from the user space these modules are useless. For the minimal functionality the bluez package is needed. bluez-5.50.tar.xz Copy and paste the extracted folder (named something like bluez-5.31) to the usr\include folder. The path to usr\include folder may look something like this C:\Intel\iotdk-ide-win\devkit-x86\sysroots\i586-poky-linux\usr\include Now on Eclipse (assuming your project is open) add the linker flags for your project. On Eclipse's menus select Project>Properties>C/C++ Build>Settings>Tool Settings>Cross GCC Linker>Miscellaneous, add the flag "-bluez-3.1" and click OK. Note: This flag is basically a "-" character concatenated with the name of the bluez folder.    4. Edit the header calls on your main file; add the path to where the header files needed are. In this case bluetooth.h, hci.h and hci_lib.h are inside bluez 5.31, header calls should look something like these: #include "bluez-5.31/bluetooth.h" #include "bluez-5.31/hci.h" #include "bluez-5.31/hci_lib.h"    5. Proceed to save (Ctrl + S) and Build Project. Unfortunately Linux / Eclipse (?) won't let me add the "extracted folder" into /usr/include - need permission. I added full path to my Bluez-5.50 and linker did not complain about that but the overall result was - now getting more errors. I am going to look into linker "miscellaneous " options to see what is missing. Note the /usr/include has folder "bluetooth" which contains the needed headers. That works fine. I have no idea how it got there.
  • 0 Votes
    1 Posts
    0 Views
    No one has replied