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
  • Dialog box margins

    csharp visual-studio wpf question
    15
    0 Votes
    15 Posts
    2 Views
    D
    Alexander Kindel wrote: ...size the dialog box such that the distance between the left edge of the client region and the left edge of the leftmost control is the same as that between the right edge of the rightmost control and the right edge of the client region. Unless I'm way out in left field, this is what you do via the resource editor. If you have the guides enabled (Format ==> Toggle Guides), then you can drag your leftmost control to the left until it snaps to the left, and drag your rightmost control to the right until it snaps to the right. If you don't have or want the guides enabled, you can do it manually. For the leftmost control, just drag it until its left edge is at whatever X pos you want, usually 7 DLUs. For the rightmost control, take the sum of the control's width and the guide value (e.g., 7), and subtract that from the from the dialog's width. That is X pos of the control. It sounds way more complicated than it is. Back when I was doing dialog design regularly, I could do it easily. Just get within 10 DLUs visually, and then do the math on the tens place in your head. Microsoft used to adhere to these guidelines where spacing, DLUs, and such were all explained, but that may have changed. "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
    J
    HS_C_Student wrote: My problem is that as I write larger and more complicated (C) programs, errors in manual memory management become much harder to find and more catastrophic, particularly if caused by memory corruption....I couldn't find a standard practice Err...because you are going at it from the wrong end. You are trying to fix it after it happens rather than stopping it before it occurs. You do the latter by strict care in your design and implementation. Create design that strictly specify where allocations occur and where they are cleaned up. Implement code that follows that and if you allocate something then BEFORE you do anything else implement, strictly, how it is cleaned up. That also applies to how you use each pointer also. If you are code a piece of code and your are not sure how to use it, whether it is defined or what you can put in it, then you have already done something wrong.
  • 0 Votes
    9 Posts
    1 Views
    V
    No! But I know this guy and I trust him. Besides, I used some code example from his site. PS: just read something about him! There is quite enough info about him in the web.
  • Wants guidance.

    tutorial question learning
    2
    0 Votes
    2 Posts
    0 Views
    CPalliniC
    Tutorials, books, programming, programming, programming (get a decent, updated compiler, e.g. g++). You might easily find many many resources freely available on the web, Google is your friend.
  • Overriding problem

    help question
    5
    0 Votes
    5 Posts
    0 Views
    D
    You might not need to make them virtual.
  • 0 Votes
    5 Posts
    1 Views
    D
    Definitely remove the line: using namespace std; My advice: NEVER do that.
  • Selected Row while updating in CListCtrl in MFC

    question c++
    2
    0 Votes
    2 Posts
    3 Views
    V
    Store the selected item index (or, maybe, item data) before the updating the list. After update select the stored item.
  • 0 Votes
    7 Posts
    0 Views
    F
    Thanks for participating. I researched your recommendations. I will use not all the plugins, but some of them I added in VS
  • Using OpenMP - #of CPU or # of threads ?

    question learning
    13
    0 Votes
    13 Posts
    0 Views
    L
    I would suggest you need a better understand of threads, and some practical experience of using them. Without understanding the basics, I doubt that OpenMP is going to bring you any benefit.
  • Why "make"?

    question c++ visual-studio wcf xml
    8
    0 Votes
    8 Posts
    0 Views
    CPalliniC
    baid is a IDE , bash is a shell. :rolleyes:
  • memory device context coordinates

    graphics performance question
    8
    0 Votes
    8 Posts
    0 Views
    L
    It always defaults to TA_TEXT In vino veritas
  • C coding to evaluate an arithmetic expression

    4
    0 Votes
    4 Posts
    1 Views
    CPalliniC
    strtok[^] is your friend.
  • Menu bar on title bar of application

    c++ tutorial question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • _findfirst and fopen very slow

    graphics help question
    28
    0 Votes
    28 Posts
    0 Views
    C
    The definitive solution: ctrl-x from HDD to SSD, restart the PC (probably not needed), ctrl-x from SSD to HDD. Now the process takes 8.2 s instead of 61 s, which seems reasonable to me.
  • How to print all source code what was running?

    tutorial question
    33
    0 Votes
    33 Posts
    3 Views
    U
    Thank you!
  • Choosing my next Programming Language

    csharp c++ java html css
    6
    0 Votes
    6 Posts
    0 Views
    M
    It seems to me that C will not die completely yet. Projects will exist, vacancies will be open. I like object oriented languages. Therefore, I would advise working with them. Even without knowing the syntax of the language, just knowing and understanding OOP, you can quickly learn a new language
  • C++ Typedefs

    c++ question discussion
    7
    0 Votes
    7 Posts
    0 Views
    L
    I don't understand why you would need to look up a typedef constantly, if you want one you just declare it what does it matter what it is ... that is sort of the point to hide the base type and give a little more safety. Explain a situation where you are saying you need to look at what the type is and I am suggesting you are probably doing something wrong. You can size any type without knowing what it is by the sizeof function that is the usual error people make when they think they need to know what a typedef base type actually is. I don't care if you have thousands of types they make things easier not harder, so there is something going on with why you think otherwise. In vino veritas
  • write in .xlsx extension excel file using c++

    c++ tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    L
    As with all Microsoft stuff from their developer network (MSDN) they publish the standards [MS-XLSX]: Excel (.xlsx) Extensions to the Office Open XML SpreadsheetML File Format[^] You write your code to encapsulate the standard. In vino veritas
  • Win API or other?

    question c++ json
    4
    0 Votes
    4 Posts
    1 Views
    L
    WIN32 API any framework including MFC just adds another layer of abstraction and the issue that the frameworks itself often becomes incompatible with newer windows versions. There is already a growing list of bugs with MFC and Windows 10. Conceptually if you want a C++ objectification of the Win32 API then an old framework called Win32++ is still around it does nothing other than take the standard Win32 API into objects it doesn't mess around with the message system like MFC and is completely opensource. It also doesn't have the problems with .NET integration that MFC has. C++ Win32 Framework for Beginners[^] Last revision 8.6 was done nov 2018 Win32++ download | SourceForge.net[^][^] Win32++ - Browse /Win32++/Version 8.6.0 at SourceForge.net[^] Probably worth adding that if you are interested in the cutting edge windows area of WSL (Windows subsystem running linux) you can throw a X server on a Windows 10 64 bit box and start working out how to encapsulate linux GUI. You can guess where MS is going with this (MS hasn't announced any frameworks but some public test ones have appeared GitHub - kpocza/LoWe: Linux on Windows extender[^]) :-) One company has already hit the WSL space hard https://www.whitewaterfoundry.com/[^] In vino veritas