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
  • X button in the Dialog MFC vc++

    c++ question
    6
    0 Votes
    6 Posts
    0 Views
    D
    While OnClose() does get called when dismissing the dialog using the X or Alt+F4, it will not get called when dismissing the dialog using Esc or clicking the Cancel button (if one is present). This may not be an issue for your specific dialog, however. "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
  • Edit Control MFC vc++

    c++ tutorial
    13
    0 Votes
    13 Posts
    1 Views
    L
    Use 3 radio buttons; default select the first option (1L). Or leave it "empty" (tri-state) and warn if no selection made. Standard stuff that everyone recognizes. The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.' ― Confucian Analects
  • List control view and button MFC vc++

    c++
    5
    0 Votes
    5 Posts
    0 Views
    M
    Thank you so much for the example :)
  • 0 Votes
    7 Posts
    0 Views
    M
    Thank you.
  • pdf995.ini in Program Files (x86)

    question
    5
    0 Votes
    5 Posts
    0 Views
    L
    Then you need to move it to a location that is not protected. Neither Program Files nor Program Files (x86) should be used for files that may need updating at run time.
  • C++ string assignment to struct

    c++ database data-structures help
    8
    0 Votes
    8 Posts
    0 Views
    F
    Thanks
  • 0 Votes
    18 Posts
    0 Views
    D
    I would be inclined to change how the data was presented. What you have: List of data +---Details of an item in the list +---Editable view of that item seems a bit convoluted. I just see too many places for errors, and possibly maintainability. At a minimum, I would combine the last two items. That would go a long way toward solving your immediate problem. "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
  • MFC vc++ and MySQL database

    c++ database mysql tutorial
    21
    0 Votes
    21 Posts
    0 Views
    _
    I think that line should be: CHeaderCtrl* pHeader = m_ListControl.GetHeaderCtrl(); See here[^]. However, that line retrieve first control item from m_ListCtrl object ... does working that line ? I didn't met such approach ...
  • MFC VC++

    c++
    14
    0 Votes
    14 Posts
    0 Views
    CPalliniC
    Quote: Is this concept similar for CWinApp::InitInstance . Even when I commented this line my application still works. why? There are two alternative explanations: The CWinApp::InitInstance does nothing, so it is safe to discard its call. InitInstance does perform some initialization that now is missing in your application. Your application may run fine, at the moment, (for instance because it doesn't need such initializations) but this is definitely not a safe scenario. Bottom line: if they (Microsoft) do invoke CWinApp::InitInstance in their code samples (and in generated code) then I would do the same. Quote: hy do we assign the address of the dialog to m_pMainWnd? I know m_pMainWnd is a CWnd* m_pMainWnd. Possibly because the dialog it is the application main window.
  • Unresolved extern "dwTlsIndex" exported function in dll

    help
    4
    0 Votes
    4 Posts
    0 Views
    F
    thanks
  • manual kerning with winAPI

    regex json question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Error 12029 WinHTTP

    data-structures json help learning
    6
    0 Votes
    6 Posts
    0 Views
    L
    Hi, Diprom wrote: After cyclic sending of n-requests, error 12029 is often generated. The Windows operating system limits the number of half-open TCP connections. On the Windows 10 operating system you will be limited to 20 and on the older operating systems it could be as low as 10. Diprom wrote: for (int i = 0; i < 2000; i++) That's alot of asynchronous connections... the Windows operating system will not allow you to make 2000 outgoing connections this fast. Best Wishes, -David Delaune Scientiæ de conservata veritate.
  • typedef for a function for different platforms

    help
    5
    0 Votes
    5 Posts
    0 Views
    F
    thanks
  • 0 Votes
    6 Posts
    0 Views
    S
    Ok, I'll add some more mystery. Here's my take: #include using namespace std; class Loo { public: static int x; static int y; static int z; int a; int b = ++y; int c; Loo() : a(++x), c(b+(++z)) {} Loo(int i) : a(++b), b(++i), c(++b) {} void show(){ cout << "a " << a << ", b " << b << ", c " << c << endl;} static void show_(){ cout << "x " << x << ", y " << y << ", z " << z << endl;} }; int Loo::x = 0; int Loo::y = 0; int Loo::z = 0; int main() { Loo::show_(); Loo l; l.show(); Loo::show_(); Loo l5(5); l5.show(); Loo::show_(); return 0; } And the output I get is: x 0, y 0, z 0 a 1, b 1, c 2 x 1, y 1, z 1 a 1, b 7, c 7 x 1, y 1, z 1 The first two lines are unspectactular: they show what can be expected from the code. The third line is also unsurprising. Importantly, it shows that the member initialization of b was invoked by the default constructor (y=1). The fourth line however is very odd: It starts with a=1. How? Let's take apart the commonly known rules on initilization order: the initializer list gets processed left to right for all virtual base classes, than all base classes, then all members. We only have members, so initialization order is a, then b, then c. Next, according to this site Non-static data members - cppreference.com[^] the non-static member initialization of b gets skipped, because b is on the initalizer list. This means, b is not initialized at all by the time a is getting initialized! Note that y remains unchanged, proving that the member initializer is not invoked! Therefore the value assigned to a is undefined. As it seems, in this case b assumes a value of 0, incremented to 1, and then assigned to a. Next, b gets initialized. It's value is based on i, which is 5, so the value of b should be 6. The output shows 7 - but let's look further: we still have to initialize c, which again is based b, incrementing it. There
  • MFC VC++ ListCtrl

    c++
    6
    0 Votes
    6 Posts
    0 Views
    D
    Have you looked at the NM_CLICK notification code? "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
  • fast return of data to the server

    sysadmin data-structures json help tutorial
    3
    0 Votes
    3 Posts
    0 Views
    S
    I'm confused: 1. TCP/IP already takes care of packet delivery; it makes sure it arrives, and if it doesn't, it gets resent. Why implement another queue on top of that? That just creates more traffic, and you made a point you want to avoid that. 2. You said something about asynchronous processing, but if you implement a queue as you said, it enforces synchronization! So what do you want? Synchronized or not? That said, I have no experience in programming this kind of stuff, I only know the theory. But maybe there's something to the many things people say about theory and practice http://wiki.c2.com/?QuotesOnTheoryVsPractice[^] ;) GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
  • CString to const char*

    question
    14
    0 Votes
    14 Posts
    0 Views
    D
    _Flaviu wrote: TRACE(">>>>>>>>>>>>>>>>>>>%s\n", chTemp); What if you try: TRACE(">>>>>>>>>>>>>>>>>>>%S\n", chTemp); // capital S "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
    7 Posts
    0 Views
    S
    If you have to ask this, then I doubt that the address you're reading is what you think it is. Not to mention what it points to. Every process uses it's own mapping from it's address space to the underlying physical addresses, and the system functions take care that each address used within a process is mapped accordingly: to some location within the momry space that is associated to this, and only this, process! Consequently, a process can never access memory from another process, unless the two processes are set up specifically for that purpose: the only way I know to read memory from another process is setting up shared memory. And I doubt that your game allows this. Take this with a grain of salt and a big AFAIK - I'm anything but a specialist on this topic ;-) GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
  • _open generate "Access is denied" error

    help c++ linux question
    18
    0 Votes
    18 Posts
    0 Views
    L
    Windows has GetLastError you notice CreateFile Simply returns invalid handle for an error if you get that then you call GetLastError GetLastError function (errhandlingapi.h) | Microsoft Docs[^] That is the equivalent of your original int it's just a non zero number identifying the error, 0 always equals no error. In vino veritas
  • Backtracking in C.

    help question
    3
    0 Votes
    3 Posts
    1 Views
    S
    Washiko wrote: A + E + B is not valid I don't see why not. Above the condition was stated that Washiko wrote: a coalition of More than 60 must be negotiated which means neither A+E nor A+B or B+E would be enough - all three are needed to get more than 60. As for your program, if you don't know what backtracking means, look up recursion and backtracking. There's nothing difficult about coding these concepts in C. If you do know what it means, write a program and, if at any point you're stuck, show the code you're stuck with. We don't write full programs for other people on request. If it's homework, we'd do you a disfavor by destroying a chance for you to learn. If it's work, you'd get paid, and you can't expect from others to do that work for you without payment. If it's a contest, it's part of the contest to find out how to write the program - if others do it for you it tells nothing about your skills, and it would be unfair to the other contestants. GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)