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
  • Change Dir inside CFileDialog

    help tutorial question
    28
    0 Votes
    28 Posts
    0 Views
    U
    I try 2 solution: void MyClass::OnTypeChange() { if(m_ofn.nFilterIndex==2){ // .doc char szPath [MAX_PATH] = {"c:\\DocFiles"}; SetCurrentDirectory(szPath); m_ofn.lpstrFile=szPath; } else { // .txt char szPath2 [MAX_PATH] = {"c:\\TxtFiles"}; SetCurrentDirectory(szPath2); m_ofn.lpstrFile=szPath2; } Invalidate(); UpdateData(false); } and void MyClass::OnTypeChange() { if(m_ofn.nFilterIndex==2){ // .doc char szPath [MAX_PATH] = {"c:\\DocFiles\\file.doc"}; //SetCurrentDirectory(szPath); m_ofn.lpstrFile=szPath; } else { // .txt char szPath2 [MAX_PATH] = {"c:\\TxtFiles\\file.txt"}; //SetCurrentDirectory(szPath2); m_ofn.lpstrFile=szPath2; } Invalidate(); UpdateData(false); } But don't work. N.B.: c:\DocFiles\file.doc and c:\TxtFiles\file.txt are existing files on the disk. I Try, but I'm not sure :))
  • Use of string class in c++

    c++
    11
    0 Votes
    11 Posts
    0 Views
    CPalliniC
    There's no need, actually.
  • Change Dir inside CFileDialog

    help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    4 Posts
    0 Views
    L
    All that is necessary is to load the dialog resource into memory and change the font size and name in the dialog template. This would involve copying it from the loaded resource to a new memory location to allow for changes in the number of characters in the font name. The sizes of individual controls should not need any changes, as the Windows library handles converting dialog units to pixels. See LoadResource function (libloaderapi.h) - Win32 apps | Microsoft Docs[^] and Dialog Box Structures - Win32 apps | Microsoft Docs[^] for more information.
  • How do people even do LL(k) parsing?

    css algorithms json tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    CPalliniC
    Quote: the major one by Terrence Parr himself Who changes the 'damn thing' at each release in a way that irremediably invalidates the previous stuff... :rolleyes:
  • 0 Votes
    7 Posts
    1 Views
    S
    Hi, Thanks for your reply. Indeed I am using a 3rd party library but they are all set to ANSI (no unicode at all). I fixed the problem by dynamically changing the Dialog Title. Regards, sdancer75
  • Regular expression confusion (std::regex_replace).

    regex com question
    7
    0 Votes
    7 Posts
    1 Views
    K
    Be aware that sed_format uses "\0" to replace matches. In your case if the user input was "A2347\01GBFC", you'd get the same output as for "A2347X$01GBFC" with format_default. If that's not an issue, then you're good to go.
  • gcov linker errors

    help c++ question visual-studio linux
    7
    0 Votes
    7 Posts
    0 Views
    V
    Leon, I got sidetracked by another issue, and this one was "FIXED" - see my next post. From my research - it is optioned / initialized in the library I have build and I really do not understand what it supposedly doing with just the options being set. It is definitely incomplete. I did try to delete the options, but it is "built-in".
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    3 Posts
    0 Views
    S
    Thanks for your answer. The CGdiPlusBitmapResource is part of an older codeproject.com article at Loading JPG & PNG resources using GDI+[^] Anyway, I found the root of the problem. I had to call DrawImage with the size of the image. Now all works just fine. graphics.DrawImage(*pPngChannel, 0, 0, 800, 50); sdancer75
  • replace words in a file

    database
    7
    0 Votes
    7 Posts
    0 Views
    S
    A couple of things I've noticed: 1. You are always using 'file1.txt' in your code, not the filename(s) passed as argument 2. As has been pointed out, lines can be longer than 1000 chars. 3. You never close the file you've opened. That will cause changes in one file buffer to overwrite previous changes once the files are closed (or at the end of the program). 4. You only check for one occurence of a word per line. What if there are multiple occurrences? Suggestions: - As already pointed out, start with your replace functions and make sure they work as intended, before dealing with files! - Make sure you always close the files you've opened - Write the modified text into another, temporary file. Later erase the original file, and rename the temporary one. That way you can just keep on reading/writing without needing to close/open the file over and over again. 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)
  • 0 Votes
    6 Posts
    1 Views
    V
    I am sorry. Yes, I got it all mixed up as far as architecture. . From the start of this project I did not like terms "server / client". Now I got caught in my own trap. I am renaming my projects RPI_BT_SERVER_X86 - runs on PC X86-64 RPI_BT_CLIENT_ARM runs on ARM7 32 bits Cheers
  • Linking libraries - follow-up- gcc++ won't link

    c++ help linux
    10
    0 Votes
    10 Posts
    2 Views
    L
    Vaclav_ wrote: how does the RPI_BT_LIB library manages to use "bluetooth" library. The same way that any code uses any library. Define the external references and add the library to the build process. Take a look at gcc library - Google Search[^] for more detailed information.
  • #define statement reported error message

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    8 Posts
    0 Views
    V
    THANKS
  • DPI aware, I am confused

    c++ graphics regex tutorial question
    9
    0 Votes
    9 Posts
    3 Views
    E
    Hi Thanks for your replies. I drew the controls with the MFC resource editor, so the scaling doesnt match as you said. So, I started a Win32 desktop application from scratch without MFC or other wrappers. I will do all drawings and scalings myself for all elements. I hope this will solve my DPI problems. I know that this is much work, but I only have experience with VisualStudio and MFC and I have to learn the basic WIN32 stuff first. I wanted to know the underlying win32 basics anyway. Thanks for your help! regards Erich
  • 0 Votes
    9 Posts
    0 Views
    C
    In case someone runs into this in the future - Microsoft has released an update for SP1 for VS2008 Professional that addresses the problem I was having. I really think I applied it one time before, but maybe I got things out of sequence. Anyway, it's KB2483802, link: Download Visual Studio 2008 update for Windows Embedded Compact 7 from Official Microsoft Download Center[^] Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
  • win32 Radio button doesn't show when is checked

    learning c++ graphics help tutorial
    10
    0 Votes
    10 Posts
    1 Views
    _
    You are welcome :) I am glad to help !
  • 0 Votes
    5 Posts
    0 Views
    L
    Has happened to me more than once.
  • SetWindowsHookEx failed

    help tutorial question
    8
    0 Votes
    8 Posts
    0 Views
    L
    Member 14105155 wrote: Therefore, the choice exists, but it is very poor one. On the contrary it is a very good one, as it allows the user to control which programs are allowed to make significant changes to their system.