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
  • 0 Votes
    5 Posts
    39 Views
    D
    ok! thanks
  • 0 Votes
    12 Posts
    85 Views
    D
    hi, have you resolve the problem?
  • Code change request (From Linux To Windows)

    csharp linux question c++ wpf
    4
    0 Votes
    4 Posts
    32 Views
    Richard DeemingR
    It doesn't work like that. There are plenty of sites where you can hire someone to do your work for you. This is not one of them. We're happy to help with specific problems in code you have written. But this is not a "do my work for me" or a "convert this code for me" type of site. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • opengl glut freeglut

    graphics game-dev json performance question
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • C++ DLL Debugging - Visual Studio 2022

    visual-studio debugging announcement csharp c++
    4
    0 Votes
    4 Posts
    40 Views
    J
    PaulS_UK wrote: how do you attempt serious debugging in complex C++ code within your MyDLL.dll functions Any language - I use logging. Last time I did C++ I rolled my own. But googling I see Log4cxx and Log4cpp. I might go with the second but I would do more research first.
  • TextBox File Open

    question com help tutorial
    2
    0 Votes
    2 Posts
    17 Views
    L
    I am not sure what you mean by "use a textbox to open a file", but all you need is the actual path to the file. There is example C++/CLI code at File.Open Method (System.IO) | Microsoft Learn[^].
  • timer does not start

    c++
    8
    0 Votes
    8 Posts
    47 Views
    Richard Andrew x64R
    I'm sorry, my answer was a quick guess. That's why I put a question mark after it. Truth is I'm not sure. The difficult we do right away... ...the impossible takes slightly longer.
  • C++, epiphanies, article content ideas

    c++ visual-studio
    9
    0 Votes
    9 Posts
    37 Views
    J
    honey the codewitch wrote: hardware mapping of a C++ based device controller. Sounds good. But I don't want some mid-level developer that just discovered templates and databases to decide that he/she is going to improve the world by creating templates that encapsulate everything in the database layer.
  • AfxRegisterWndClass crashes when called again

    c++
    6
    0 Votes
    6 Posts
    16 Views
    V
    etechX2 wrote: Maybe the AfxRegisterWndClass is set to release class automatically at the end when library exits. ? 1. Please read the Microsoft documentation about AfxRegisterWndClass; 2. Why are you trying to unregister and then reregister already registered Class? just save its name and then use it again!
  • 0 Votes
    30 Posts
    248 Views
    honey the codewitchH
    There is a time and a place for it, and it's sometimes useful when doing some heavy Generic Programming. Like, in theory if you had to design your own tuple type (I know std already has one, but ignoring that), the function to access a tuple's value might be an auto because it's difficult to even type out the template instantiation necessary for the return type, much less come up with it. Another place I use it: In my graphics library you can define pixels with an arbitrary memory footprint. Different amounts of bits for different channels, like RGB565 or YUV888 etc. Because of the arbitrary nature of it the integer values for each channel may be a different type. For example, while a channel probably won't be more than a uint8_t can hold (8-bits) it might be (12 bits? uint16_t would be necessary) Because of that, when I go to assign values from arbitrary pixel formats I don't actually *know* what type it is, other than some kind of integer of 64 bits or less (based on static_assert constraints). So I could always promote it to a uint64_t but that creates other problems when you have to cast down again. So auto is what's for dinner. Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
  • Inserting a user defined key in a C++ map

    c++ help
    2
    0 Votes
    2 Posts
    13 Views
    D
    Try std::multimap. It does exactly what you want. Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.
  • I never fail to be impressed by this

    c++ hardware question
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • Passing a class (pointer) to library - Linux

    help question discussion linux debugging
    5
    0 Votes
    5 Posts
    37 Views
    L
    I explained what you should do to correct this in my previous reply. Passing a class pointer or reference is just the same as passing any other type. So a simple example: // a useless class class Foo { private : int bar; public: Foo(int i) : bar(i) {} // constructor takes a value int getBar() {return bar; } // this method returns the value }; // an arbitrary function which accepts a Foo* int MyFunc(Foo* param) { int rc = param->getBar(); // ask the class object for the value return rc * 2; // and return it doubled } int main { Foo* pFoo = new Foo(4); // create a new object with a value of 4 int ans = MyFunc(pFoo); // call MyFunc passing it the pointer to the class object cout << "result: " << ans << endl; return 0; } And all of that, and more, is fully explained in any C++ reference, either online or in printed copy.
  • How C++ manage memory in event driven system ?

    performance question c++ code-review
    7
    0 Votes
    7 Posts
    35 Views
    L
    Thank you for your constructive contribution to this discussion. Appreciate your input and now I have a better understanding of the process.
  • 0 Votes
    4 Posts
    22 Views
    L
    Thanks for reply. I have riposted this, hoping for help with constructing with C++ reg expression .
  • 0 Votes
    7 Posts
    37 Views
    L
    error: declaration of anonymous class must be a definition and do not known how and where to correct this error. STAND BY I have another fish to fry and I need to rebuild this task from scratch. I took a wrong approach and that is why I got this error.
  • Can this be the cause of a memory leak

    graphics docker performance question
    12
    0 Votes
    12 Posts
    67 Views
    C
    Ah memory leaks (and small buffer overruns). I would point out that your example is fairly obvious. If you have a long running task, and this code is in some sort of processing loop, you'll see it quickly. What will really bite you in the a$$ are the small leaks. A byte here, a byte there. I live in the embedded world where customers forget our equipment was installed under their production line 10 years ago. The engineer responsible either died, retired or moved on to another company. I'm not being morbid, I have stories I could tell you :) The group I work in is a decent group of smart people. Sadly, they never let us into the field to see how the product is actually used. The few times I've seen examples, they always shock me with "I didn't see that coming" sort of response. What amazes me is that if your customer never turns off your machine, why not set up an area where a test unit runs forever? I guess it falls under diminishing returns. 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.
  • mfc, vs2022 compatible?

    c++ question workspace
    10
    0 Votes
    10 Posts
    71 Views
    C
    lol, true. But going into the mfc afx, etc header files where "those people" took macros to an art form (I'm being generous) is tedious. 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.
  • C++ language updates / old C++ code

    csharp question c++ visual-studio com
    11
    0 Votes
    11 Posts
    71 Views
    CPalliniC
    You are welcome. "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • USB power control

    c++ question
    4
    0 Votes
    4 Posts
    31 Views
    C
    yeah, you are going to be down into device drivers and what not. I'm sure Microsoft has an API somewhere, but it'll change. 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.