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
  • Script generation from Objects using C++

    c++ design tools tutorial
    6
    0 Votes
    6 Posts
    0 Views
    CPalliniC
    If chains can be avoided, if feasible, leveraging on polymorphism.
  • Ok im back with another problem...

    help csharp c++ asp-net visual-studio
    3
    0 Votes
    3 Posts
    0 Views
    L
    You have setup a Console project to what is a Win GUI code or vice vesa. When you first setup the project you had two choices windows console or windows GUI you selected the wrong one, whatever the case. Not sure why you are staying on VS2010 rather than updating as it's free but on VS2017 You can change it after you make the project via Project -> Properties -> Configuration Properties -> Linker -> System It will be something similar on VS2010 and what you are after is subsystem and it will be either Windows (/SUBSYSTEM:WINDOWS) OR Console (/SUBSYSTEM:CONSOLE) Whichever one it is on currently it's wrong for the project, select the other. In vino veritas
  • Mobile app

    c++ mobile
    2
    0 Votes
    2 Posts
    0 Views
    L
    Lots of different ones. But it all depends on what the application is supposed to do. Please read HOW TO ASK A QUESTION - C / C++ / MFC Discussion Boards[^].
  • Hello I am having a problem

    c++ help csharp visual-studio debugging
    2
    0 Votes
    2 Posts
    0 Views
    D
    wrote: BOOL DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID) Should be BOOL __stdcall DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID) or BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID) "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
  • Shared sections in a DLL

    question
    3
    0 Votes
    3 Posts
    1 Views
    1
    Place POD data to Dll shared section. Use named objects (mutex, event) to synchronize this shared data. Named synchronization objects should not be placed to the shared section. Interprocess Synchronization | Microsoft Docs[^]
  • Games

    game-dev tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    CPalliniC
    Let me Google that for you[^].
  • 0 Votes
    8 Posts
    1 Views
    O
    I think a very useful reaction. Just because of the flexibility to use ANSI and Unicode and prepare for 32-bit and 64-bit alongside, it turned out to be wise to take MFC (and ATL). I understood MFC and ATL are more or less integrated and coupled now. To be critical on the role of Microsoft is wise to. Meanwhile (2018) the version for MFC is 14. Newer versions of Visual Studio aren't linked to new versions for MFC anymore. But … hate to say … sometimes the one you criticize (or criticizes you)... has right. For example the preparation for Unicode wasn't understood by a lot of MFC-users (for a long time including me). I'm sure it even gave MFC a bad reputation. What the hell with … CString, TCHAR, LPCTSTR, LPTSTR, TEXT, etc. ??? The level of understanding of preprocessors has to be high. So even more people will drop out as fans for MFC. My level of understanding of preprocessors is very modest. Some quick testing showed that MFC can be used 64-bit still. The CDAO... classes might be an exception. Although the MS communication on DAO in general was kind of an example of a large dragon with two heads (or even more) speaking with 2 mouths and thus speaking the truth always … or never. I didn't test, but perhaps those CDAO... classes can be used in 64-bit code as well. Let's be aware of the fact that 64-bit compilers are often 32-bit programs themselves. The IDE for 64-bit development … is often 32-bit. Real programmers have to laugh for the request for 64- bit software, because of the belief that for sure that will be faster. Even Microsoft again turns out to be that multi-mouth-dragon. Some people hope to sell us new 64-bit software … because of … In my humble opinion MFC can be used seamingly alongside raw Win32 code. Many may smile now. It comes close to the contra for MFC being it just a little wrapper around Win32. It can be used seamingly alongside managed code of NetFramework, although I prepare for disappointments for years already. For many developers that sounded as crazy sadomasochism. How many developers understand (and use!) the concept of deployment with debug-builds and runtime support with surveillance tools at site with the customers ? Do developers have to prepare for that before compile-time ? Do developers have to prepare for testing ? As a developer my ego tends to shrink and shrink. To hear experiences from others is still welcome. I still use MFC but still … critical … I hope.
  • Conways Game of life game in C

    css database game-dev data-structures announcement
    4
    0 Votes
    4 Posts
    0 Views
    V
    元昊 潘 wrote: When calculating the N array, the element of the boundary is overstepped by the Z array access as calculated by your algorithm in your compute function. for (i = 1; i <=6; i++) { for (j = 1; j <= 6; j++) { N[i][j]=Z[i-1][j-1]+Z[i][j-1]+Z[i+1][j-1] + Z[i-1][j] +Z[i+1][j]+ Z[i-1][j+1] +Z[i][j+1]+Z[i+1][j+1]; } } Yes. And the same is for N array itself! The OP tries to set the element with the index 6 while the "allowed" indexes are 0 to 5!
  • Referencing a class in other in a other class

    question
    7
    0 Votes
    7 Posts
    0 Views
    B
    Well, Well, Well! This question is the result of too much abstraction in education of computer scientists! A bit of learning of how a compiler works, Things like Bits and Bytes, the underlying mechanisms, and what it cannot do would help you here. This is an insolvable problem! Ultimately, a compiler lays out code, reserves blocks of memory of a certain size, etc. The compiler needs to know how much memory is needed for each user defined type (in C(++)) that is a union, structure or a class! When you Declare a class, you tell the compiler to take note of the name of the class! The Linker may than be able to find that class properly defined in another file, and hence in another .obj file! The compiler cannot at that stage know anything about the size of the object, so, all you can use is either a pointer of an object of that type, or, a reference to it! A Reference to an object is very similar to a pointer, it is a compiler guaranteed pointer, that cannot be null, and always points at an object of the type! In Your code class 'c' needs to be defined in the file before class a in which it is used! Otherwise your compiler cannot calculate the size of class a! Best of luck learning more, There may be rules around this conundrum in synthetic languages such as C#,Java etc. I would know nothing of these! There are no such shortcuts in C or CPP! I encourage anyone to take up C or CPP! It are the base languages on which all others are built! A knowledge of Machine Code, and how it translates in ASM, would also help you Bram van Kampen
  • Print Bitmap from Printing Class Library

    com graphics question learning
    8
    0 Votes
    8 Posts
    0 Views
    L
    The PrintBitMap code is likely just calling the standard windows API call LoadImage. LoadImageA function | Microsoft Docs[^] If you read the documentation the fix will be obvious, you need to not set the LR_LOADFROMFILE flag when passing in a resource ID in the string. Down the bottom in the remarks you will find reference to a neat macro IS_INTRESOURCE(lpszName). IS_INTRESOURCE macro | Microsoft Docs[^] So Microsoft gives you a macro to work out if a string is actually an INTRESOURCE. So basically a one line fix in the code find the LR_LOADFROMFILE and set it only if IS_INTRESOURCE returns false. It is the always setting of that flag that is fouling the LoadImage working properly because you want the extended behaviour that is spelled out in this statement Quote: The image to be loaded. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the LoadImage function. As an extended answer you may want to consider adding a few lines of code to test the string extension for known types JPG etc not just resource ID and use IPicture to add that support. As an example this will take a filename string and convert a jpg to a bitmap handle. You would use this function in place of LoadImage in the situation you had a jpeg filename and you could then print jpegs. The disadvantages of using classes and frameworks is you never learn the Windows API and how it is designed to work. Anyhow the small code block follows, I gave you the option of returning the wth, ht of the jpeg loaded but you can use NULL if you don't want them returned. #include HBITMAP HBMPFromJPGF
  • Private test case failed

    com data-structures question
    4
    0 Votes
    4 Posts
    0 Views
    B
    The process where it will be getting the particular part which is having the following aspects that are going to get the[ canon error b200 ](https://oniton.com/blog/fix-canon-printer-error-b200/)are going to access it for the following process to proceed it.
  • Catch javascript event in CHtmlView

    question javascript algorithms
    5
    0 Votes
    5 Posts
    0 Views
    _
    This is not good idea, because when the app doesn't have the focus, this trick doesn't work ...
  • How can I simulate Enter key in CHtmlView ?

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • double signed comparison in C++

    question c++
    3
    0 Votes
    3 Posts
    0 Views
    V
    It is because your** Quote: bool flag; **was NOT initialized and contains garbage that is treated as true just because it is not zero. Try: double a = -60 ; double b = -7500 bool flag = (a < b);
  • clistctrl class

    c++ csharp visual-studio question
    4
    0 Votes
    4 Posts
    0 Views
    D
    Do you need to adjust the column width? Without showing your relevant code, it's anybody's guess. "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
  • help

    game-dev help tutorial
    11
    0 Votes
    11 Posts
    0 Views
    OriginalGriffO
    Then you have made at least two mistakes. 1) You have picked up bits and bobs from videos without any structure or real explanation of why you do that - and for a language like C the "Why?" is far more important than the "How?". Plus most development videos on YouTube are created by people who know little more than you do, and couldn;t teach if their lives depended on it ... Get a book (or better a course) and follow it from beginning to end, doing all the exercises. It may not be as exciting as jumping into code, but it is a much, much better way to learn - and you don't miss out essentials either! 2) You picked the wrong "beginner language" - I'd strongly suggest you shelve C for the moment, and start with C# (or even VB if you must) and get a solid grounding in development using that - it's a lot easier for a beginner, despite seeming to be much, much bigger and more complicated. In fact, it shows you up front how big and flexible it is, and makes the beginner (and expert!) developer's life a whole load easier by hiding the complexities of C behind the scenes where you don't have to worry about them. Get a good book on C# - Addison Wesley do good onew, as do Wrox and Microsoft Press - and a copy of Visual Studio (free from MS!) and follow it through all the way. Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!
  • Solve this runt time error code

    css database graphics design data-structures
    9
    0 Votes
    9 Posts
    0 Views
    CPalliniC
    Quote: Input 1: It will be string which tells two integers separated by a single comma that represent M and N respectively. Input 2: It will be the integer B, the maximum cost you can afford (i.e., your budget). It is the cost of removing ith plot. Input 3: It will be the integer P, the residential plots found in the list. Input 4: It will be string array where: Does't match with the sample input, for instance: Quote: 6,9 - Input 1 42 - Input 2 5 - Input 3 5 - ?????? 4,1,6,3,12 - Input 4 3,6,5,6,9 1,3,3,8,24 3,8,6,9,21 5,1,6,2,20
  • Split paragraph into lines based on width in pixels

    css json help question
    8
    0 Votes
    8 Posts
    2 Views
    J
    Look at ExtTextOut.
  • 0 Votes
    8 Posts
    11 Views
    V
    :thumbsup: G:thumbsup:lad you have solved your problem! :)
  • Microsoft Office Object Library

    sharepoint help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied