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
  • Checksum Generators With Advanced Functions

    question announcement
    8
    0 Votes
    8 Posts
    0 Views
    J
    A checksum is trivial functionality and was by the first reference I found, created in 1961. There are variations but those are not relevant unless you have specific requirements. Other than that libraries that might provide that functionality, especially now, would only (or should only) be adding management functionality - such as apply it to an entire directory. So if you want to look for something 'better' you must first determine what, besides the checksum itself, that you need. Then find the libraries that meet those needs.
  • Exception Handling MFC detail information

    c++ data-structures help
    13
    0 Votes
    13 Posts
    1 Views
    B
    Ah We are getting Somewhere! At least some code. On the Off Chance of asking a stupid question, I do not see any declarations for the Index 'I', nor for the class 'mystorage', nor for the object 'as_id'. Are you working on a PC or an IBM Main Frame, with z/OS Operating System. I am getting Confused! :) Bram van Kampen
  • Overload -> operator

    question c++ com graphics
    4
    0 Votes
    4 Posts
    1 Views
    A
    I think I can help but I am struggling with the grammar and intent of your question. -> operator gives you access to the class. It is much like operator .
  • Direct creation of CWnd Object

    graphics
    8
    0 Votes
    8 Posts
    3 Views
    L
    This is why I dislike MFC it mystifies what is actually a simple process. On the windows API itself there is a visibility flag it goes under the name WS_VISIBLE and it tells windows whether to draw a window or not. So a window can exist and even be position on screen but not be visible. There are a number of invisible windows actually at play on the desktop of Windows itself. A hint is what do you think the desktop icons are sitting in. The rule goes if you create a new window which is visible and it is inserted into a parent that is visible, the standard windows system handlers will issue an initial WM_PAINT message. So it is the act of creating the window with a visible parent that for most windows makes it visible. Windows doesn't care about it being a frame or a window it simply cares what the WS_VISIBLE flag of a child and it's parent. So you can create an invisible window easy as hell just don't set the WS_VISIBLE flag (try it on your window). Then you will need to use something like the API call ShowWindow to change it to visible. ShowWindow function (Windows)[^] That call can also be used to make a visible window go invisible and yes the window will still be there just not visible :-) You can also upset visibility by fouling up the message handler so it no longer does the default behaviour correctly and you always know that because you will find your paint behaviour is no longer as it should be. So being visible has absolutely nothing to do with a window existing and invisible windows still exists to the message handlers and you can send message to invisible windows. An invisible window is simply a window that doesn't draw because the visibility flag is wrong or the handler stops it. The only way to destroy a window is via DestroyWindow function (Windows)[^] All the close icons, ALT F4 etc lead to that call if they destroy the window (with the exception an application main window .. it is special and posts a quit message). So a big difference between a window not being visible and a window being destroyed and don't ever think the two things are
  • Local / unique Variable Macro question

    question
    11
    0 Votes
    11 Posts
    1 Views
    B
    Well, The Optimiser has always worked well for me over the last 20 years. When in doubt, you can always switch all optimisation off. I remember the DOS days of more than 30 years ago where we wrote in Assembly, and we had a Friday afternoon party for someone saving 100 bytes or more in the final target, by writing smarter code by hand. These days are thankfully gone. Optimisation is typically switched off for Debug Builds. If you could debug your code at all, even using assembly, it is still unlikely that the optimisation has anything to do with it. If the optimizer had a bug in it, there would soon be a worldwide outcry. The likelihood is that you wrote suspect code. I cannot judge that until I see the offending code. Now, rest assured, and learn this from an old timer. I have often banged my head against the wall about coding issues. Blamed the Compiler, Blamed Windows, etc. In the end, on calm review and reflection, it has always turned out to be a 'misconception' somewhere in the process, solely conceived on my behalf. If your code works in Debug, but not Retail mode, there are several articles on the internet, about 'Surviving the Release Mode' Regards and Sympathy, :) Bram van Kampen
  • C programming Determine Students grade

    css
    5
    0 Votes
    5 Posts
    0 Views
    B
    Hmm Ah, it is that time of the year again. This looks suspiciously like an examination project. There are various reasons why this forum does not do these. For one, most people on this forum have already passed their exams, while many others earned their feathers trough self study and hard graft. Furthermore we would not like to contribute to the creation of qualified software engineers who mis the basic concepts.(as you seem to do). You don't actually show what you have. (maybe you don't know how to, if so, follow the posting guidelines on this site.) Show me yours, and I'll show you Mine. :) Bram van Kampen
  • UDP Sockets and Windows 10

    help question
    14
    0 Votes
    14 Posts
    0 Views
    L
    It's easy to fix go to the network settings and disable IPv6. You are sending IPv6 UDP packets :-) Your device is not IPv6 capable and hence you see the packet on the wireshark but it doesn't respond. You need to update your code to only do an IPV4 connect. In vino veritas
  • 0 Votes
    4 Posts
    0 Views
    U
    Thanks leon de boer. As per your guidelines, i will start writing the codes.
  • How to fix printer error?

    help com algorithms sales tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Disecting a PE File, Revisited

    performance question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    8 Posts
    0 Views
    L
    That is because you are doing it all wrong you either join them all up in one sequence or move the first pointer along They are designed to be used a completely different way :-) Single line: snprintf (msgArray, sizeof(msgArray),"%d%s", 1,"main"); Concat sequence (with buffer safety): char *cur = &msgArray[0]; char *end = &msgArray[sizeof(msgArray)-1]; cur += snprintf(cur, end-cur, "%d", 1); snprintf(cur, end-cur, "%s", "main"); In vino veritas
  • How to solve this compiler error.

    c++ help csharp visual-studio linux
    7
    0 Votes
    7 Posts
    0 Views
    P
    I used VC++ 2008...there is not as much fussy issue, as VC++ 2012 is producing(useless hurdles)....program itself has complex logic... Issue is closed..I changed environmnt vc++ 2008..
  • Need Source Code for Decoding _Using algorithm

    algorithms
    13
    0 Votes
    13 Posts
    0 Views
    L
    You have totally lost me ... you are giving me the formulas tanh is a standard C/C++ function (C library function - tanh) You have the matrix coefficents and like you said the E matrix first coefficent is E11=log(1+tanh(M12/2)tanh(M14/2)/1-tanh(M12/2)tanh(M14/2)) So plug the numbers in and calculate your E matrix coefficents You do all your other calculations and then transpose the matrix .. you know C Program to Find Transpose of a Matrix] You need to explain this statement => "how should i calculate that tanh calculation". I simply don't get it tanh is a trig function like sine/cosine/tan and it just needs "#include " and you have it on any C/C++ compiler that meets the oldest C89 standard. You gave me coefficent values above so I know you know what M12,M14 are and you know what a 2 is. So I query why you ask me how do you do the tanh calculation, why didn't you ask me how you do the log calculation? What is the difference between those that is causing your problems? In vino veritas
  • How to use LM317T?

    javascript html com tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    L
    Haha I get it now .. will ignore in future. In vino veritas
  • Streamin proc for Rich edit

    5
    0 Votes
    5 Posts
    1 Views
    F
    Ok thanks the data just displays storage Thanks
  • ikspropertset declaring variable ksps

    help tutorial
    5
    0 Votes
    5 Posts
    0 Views
    J
    Maybe post the compilation errors that you are seeing along with the pertinent code. "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
  • 0 Votes
    11 Posts
    0 Views
    L
    First let me say you are making a mountain out of a molehill ... "test->" is a dead easy string to pick off with a text auto-replace on. Would take me about 30sec to do on code throughout the project. You could also do what a good programmer would do and get rid of the stupid global pointer and pass it into the functions on the local interface. You can keep it as test on the local interface but pass in lets_use_it.test1. You make your code better, safer and it is simply extending a few local interfaces. That is what I would actually do .. globals are evil :-) The question to ask yourself is why are you using the global pointer rather than having a pointer parameter on the functions that use the global? That all said you could keep the pointer "as is" if you want by typecasting but it is frowned on :-( struct test1* test = lets_use_it.test1; /* Is perfectly valid */ In vino veritas
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • CDateTimeCtrl in Windows 10

    help question announcement
    19
    0 Votes
    19 Posts
    0 Views
    M
    The problem is solved in Microsoft's update of June.
  • Value for a structure is not showing in watch window in VS2008

    debugging
    4
    0 Votes
    4 Posts
    0 Views
    L
    That should work and does on VS2015 and VS2107 so if it doesn't work on VS2008 it's a very old bug. You can however easily hack around it, just make a local variable struct and copy the global struct to the local ... the watch window can't get that wrong and it's one single line of code :-) Other alternative is to try the later compilers, they are free and easy to download and try. In vino veritas