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
  • Creating Custom Controls in MFC

    c++ question learning
    4
    0 Votes
    4 Posts
    0 Views
    J
    Because all MFC controls are CWnd based you should use that as base class too. Then add the painting (OnPaint, OnEraseBackground), register the window class and add control specific message handlers as necessary. An old but good article by Chris: Creating Custom Controls[^]
  • 0 Votes
    9 Posts
    1 Views
    L
    void *x;int *a1=a,*b1=b; x=(void *) a1;a1=b1;b1=(int *) x; That just makes no sense, x should be int* the same as a and b.
  • http://naturalhealthstore.info/primex-testo-max/

    css help tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    7 Posts
    0 Views
    L
    Bonobo8 wrote: I actually don't know what this message is or how to handle it. Then you are definitely going to have problems, especially if you are trying to paint the controls at other times. If you do not understand how Window painting works in Windows then you will continue to have problems. I suggest you look for some tutorials on how it is done.
  • Out of Memory Exception in C++

    help c++ performance question
    14
    0 Votes
    14 Posts
    5 Views
    S
    Have you tried catching std::bad_alloc exception?
  • How to interface with an existing C++ Library?

    c++ tutorial csharp asp-net dotnet
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • what is the value of y after the following statements?

    question
    3
    0 Votes
    3 Posts
    0 Views
    _
    As Richard said, the expression only contains integers and so you should get the result of an integer division (3). However, if at least one of the operands / variables are of float type, all integers will be automatically converted to float type. Say, for example - y = (float)17 / 5; Having said this, the answer may be slightly different from the expected 3.4 because of how floating point numbers are represented. Please check this - Floating point inaccuracy examples - Stack Overflow[^] «_Superman_»  _I love work. It gives me something to do between weekends. _Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
  • 0 Votes
    4 Posts
    0 Views
    F
    That's what I thought thanks it wasn't clear from the article
  • C function call question.

    question
    14
    0 Votes
    14 Posts
    5 Views
    _
    It's possible that the compiler patches the call with a default argument. What is the value in channel? I'm guessing it is 0. Anyway this is not valid in standard C and will surely not compile in GCC or Microsoft C compilers. «_Superman_»  _I love work. It gives me something to do between weekends. _Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
  • function soft thresholding

    question
    3
    0 Votes
    3 Posts
    0 Views
    D
    saidinsan000000000 wrote: this code correct or no? It all depends on what you mean by "correct." Are you asking if it is syntactically correct, logically correct, or some other measurement? "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
    4 Posts
    0 Views
    L
    I will assume you are working with new OpenGL 3.3+ (If you aren't you need to switch now) you will have what amounts to a pile of Function pointers you will have got with wglGetProcAddress. Usually what you need to do is first start with that and put them in a class or object. Then build functionality on the class/object interface because you have everything contained. If you aren't comfortable with doing it yourself then use a library like GLEW which will wrangle all the function pointers for you. GLEW isn't great because you can't extend it easily but it's better than nothing. If you haven't wrangled all the function pointers into a sort of API that is where you start. Once you do that at a minimum you will be able to attach/change shaders and apply the matrixes to that class/object and it will store internally whatever it needs. I usually set the class/object creation to take a window handle being the window you want to bind the OpenGL onto. The reason for doing that is when you run multiple windows each window will have it's own render context so you might as well bind the window into your object at construction. If you are using just one main OpenGL window the step will seem to have little benefit but the moment you start with multiple OpenGL windows you will get why you do it. In vino veritas
  • USB eject notification

    question
    11
    0 Votes
    11 Posts
    1 Views
    L
    Hi, There is an amazing amount of high quality information right here on codeproject dating back almost 18 years. Much of it is still relevant. Just use the search box up at the top of the page. Receiving Device Event Notification in Windows Service[^] Best Wishes, -David Delaune
  • Declare member variable on stack or heap

    data-structures
    10
    0 Votes
    10 Posts
    0 Views
    V
    Hometurph Indi wrote: i am still not having a perfect solution with both options Define perfect.:cool:
  • CSplitterWnd with MDI Child Windows

    com help tutorial
    4
    0 Votes
    4 Posts
    0 Views
    U
    Thanks for program. I think it helps in solution.
  • 0 Votes
    6 Posts
    3 Views
    0
    Thanks Jochen for your reply. I also found that Windows Supports both formats YUY2 or NV12. But, I am struggling why it is randomly showing either format which proves that there are some setting that needs to be set As I did not get any theory/description on getting random format from these two formats. Thanks Again for your Reply.
  • Class Shape

    help
    9
    0 Votes
    9 Posts
    0 Views
    D
    How would you do it using pencil and paper? If you coded up everything that calculates said vertices, printing them should be a non-issue, yes? "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
    5 Posts
    0 Views
    B
    After some experimentation (mostly due to this article: CComObject Class[^]), I have made some progress towards a fix. It seems this line, which was OK in VB6, is no longer appropriate: CComObject * pLine = new CComObject (); I replaced it with this logic, and my VB 2017 app no longer crashes: CComObject \* pLine; HRESULT hRes = CComObject::CreateInstance(&pLine); ATLASSERT(SUCCEEDED(hRes)); pLine->AddRef ();
  • Educational: my buffer scroll C++ working code.

    c++ css com debugging json
    5
    0 Votes
    5 Posts
    1 Views
    M
    Quote: This looks more like a Tip than a question and would be better posted at Submit a new Article[^]. I'll do it, when I have read about rules. Echo7
  • CN

    c++ sysadmin
    4
    0 Votes
    4 Posts
    0 Views
    D
    Read #2 here. "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
  • Does CString;;GetBufferSetLength Set/Allocate the CString Buffer

    help
    6
    0 Votes
    6 Posts
    1 Views
    J
    You probably don't need an array class if you just want to copy data and do not need inserting or removing of items. If you know the (max.) size in advance just use a plain array allocated with new. If not, you can still grow by allocating a new array, copying data from the old, and delete the old. CByteArray is also an MFC class which is probably also not thread safe. But it is impossible to help without knowing what your code is doing. The question are (you may ask and solve them yourself): Does my array require special modification functions besides copying? Which functions use my array under which conditions (read only, write only, both)? Where is may array allocated (this might be at different code points if resizing is necessary)? Where it is deleted? Do I need thread safety?