Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

maxmaven

@maxmaven
About
Posts
22
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Newbie: How do I make a progress dialog?
    M maxmaven

    Hi, Do any of you know how to make a progress dialog? I am writing out my data in my CDocument class. I have a menu and a toolbar icon called "process and write out data". I want the progress dialog to update the progress ctrl as work is finished. I was hoping that the right way to do this is to manage the progress dialog updates in my cdocument, since that is where all my data is. Can you give me a little pseudocode that explains how this would work? Or should I be doing it another way? Thanks, Max

    C / C++ / MFC question tutorial announcement

  • MFC Serialization
    M maxmaven

    If you are using the Doc/View architecture, you can do some simple document writing:

    void CYourDoc::Serialize(CArchive& ar)
    {
    if (ar.IsStoring()) {
    // here we are writing
    ar << an_int
    << a_double
    << a_CString
    << a_short;
    } else {
    // here we are reading
    ar >> an_int
    >> a_double
    >> a_CString
    >> a_short;
    }

    Make sure the order and size of the data you write is identical to the order and size of the data you read, otherwise kaboom. If you want to serialize your own classes, you need to inherit them from CObject. It is also a bit more complicated. Websearch for DECLARE_SERIAL, IMPLEMENT_SERIAL. These are macros that you will need to add to your class. Finally, when you actually write the code to do the serialization of your class objects, you will need to over-ride Serialize(...), which your class will inherit from CObject. In your Serialize(...) over-ride, you will implement the necessary code to write your class object to a file. It will be pretty much the same as the sample code above. So, e.g., your class has an int size; member variable, you will do ar << size; in your Serialize(...) over-ride. Max Max

    C / C++ / MFC c++ json help question

  • How to set document file extension?
    M maxmaven

    Hi, I am using serialize to write out my MFC application document data. I want to have names in the file dialog post-fixed with a file extension, like "binky.dfg" (.dfg is the file extension). I understand I need to call CWinApp::RegisterShellFileTypes(...). However, this will only work if I set the appropriate string for the file extension in my CSingleDocTemplate. I browsed around and found CSingleDocTemplate.GetDocString(...). This will let me read what the file extension is for my document. But how do I set a file extension? There is no SetDocString(...). It looks like the CSingleDocTemplate members I am interested in are some/all of regFileTypeId, regFileTypeName, filterExt, or filterName. I'm not sure which one I should be working with. Also, these are member variables of the class. Shouldn't I be not touching these directly? Rather, shouldn't I be using some class member functions to do the work? Help? :doh: Max

    C / C++ / MFC question c++ help tutorial

  • Correct way to remove old unused symbol?
    M maxmaven

    Hello! I am wondering, I made a dialog box button and assigned it an ID such as ID_MyDialogBoxButton. Now that I've removed the button and no longer use it, I want to clean up the unused symbol. Is the best way to go into Resource.h and delete the offending #define line? I seem to remember Visual C++ 2005 has a symbol explorer. How to I bring this explorer up? And is this the best way to remove the symbol? Thanks so much! Max

    C / C++ / MFC c++ tutorial question learning

  • MFC and Serialize... How do I attach an icon/schema?
    M maxmaven

    Hello Steve, Well, you have introduced me to a whole new area of programming that I am not familiar with. :) Do you happen to know of a tutorial or discussion that I can look at to learn more? Thank you, Max

    C / C++ / MFC question c++ database xml

  • MFC and Serialize... How do I attach an icon/schema?
    M maxmaven

    I believe what I am wanting is (b) associate an icon with the file. So, the file is created by the serialize machinery in MFC, perhaps it is called "binky". But there will be a file extension, so it will actually be "binky.dzq" or some other file extension. And the file will have an icon, so that when you view the file in the regular explorer file view (not internet explorer), you will see the file binky.dzq has a nice icon picture so users will know this is a file created by/for my application. How would I get an icon to appear like this on my serialized file? Thank you! Max

    C / C++ / MFC question c++ database xml

  • MFC and Serialize... How do I attach an icon/schema?
    M maxmaven

    Hello, I am using the MFC archive mechanism (serialize) to write out my document data. So I have something like:

    void MyDoc::Serialize(CArchive& ar)
    {
    if (ar.IsStoring())
    {
    // TODO: add storing code here
    ar << somedata;
    }
    else
    {
    // TODO: add loading code here
    ar >> somedata;
    }
    }

    How do I attach an icon to the file I have written out? Thank you! Max

    C / C++ / MFC question c++ database xml

  • How to enable XP look and feel?
    M maxmaven

    Hi, I made an app with an ok and cancel button in visual studio c++ 2005, but they are blocky (old look). How can I enable the XP look and feel so these buttons look nice? My computer is running XP. Thanks, Max

    C / C++ / MFC question csharp c++ visual-studio tutorial

  • Setting minimum size for a CFrameWnd
    M maxmaven

    How do I add the message map entry using a wizard? Do I use the "Add Member Function" wizard? Thanks, Max

    C / C++ / MFC csharp c++ visual-studio debugging question

  • Setting minimum size for a CFrameWnd
    M maxmaven

    I do not have a message map entry. How do I add one for ON_WM_GETMINMAXINFO? Max

    C / C++ / MFC csharp c++ visual-studio debugging question

  • Setting minimum size for a CFrameWnd
    M maxmaven

    All I did was cut and paste the code into MainFrm.cpp, and add the function to the class declaration in MainFrm.h. Max

    C / C++ / MFC csharp c++ visual-studio debugging question

  • Setting minimum size for a CFrameWnd
    M maxmaven

    Can you tell me exactly what you did? And are you in Visual Studio 2005, C++? I did: SDI: doesn't work SDI + DocView architecture: doesn't work SDI + Split Window: doesn't work Are you setting anything special? Or adding more than just the OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) function? Thank you, Max

    C / C++ / MFC csharp c++ visual-studio debugging question

  • Setting minimum size for a CFrameWnd
    M maxmaven

    Hi, I'd like to make my CFrameWnd subclass not resize any smaller than a certain size. Everywhere I web-search, I see that the suggested way to do this is: void CWndDerived::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // set the minimum tracking width // and the minimum tracking height of the window lpMMI->ptMinTrackSize.x = 200; lpMMI->ptMinTrackSize.y = 150; } I type this into my (very simple) app, and set a breakpoint at the start of this function. It is never called. Is this method still valid? (under Visual Studio 2005 c++) Thanks, Max

    C / C++ / MFC csharp c++ visual-studio debugging question

  • I removed default hover behavior in my toolbar. Can I get it back?
    M maxmaven

    Thank you kindly for your help. I just noticed I have an entire chapter on message maps in the MFC book I bought. I will learn by reading this chapter. Once again, thank you! Max

    C / C++ / MFC tutorial question

  • I removed default hover behavior in my toolbar. Can I get it back?
    M maxmaven

    I see what is going on! If I do not assign the button an ID like "ID_APP_ABOUT", the button is disabled. It looks like the ID must match one of the symbols in the resource symbols list. I have two more questions about this: How do I make a new symbol, should I be using a wizard? How do I add an entry to the message map? (use a wizard?) By this, I mean the list below BEGIN_MESSAGE_MAP(MyApp, CWinApp) ON_COMMAND(ID_APP_ABOUT, &MyApp::OnAppAbout) // Standard file based document commands ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen) // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup) END_MESSAGE_MAP()

    C / C++ / MFC tutorial question

  • I removed default hover behavior in my toolbar. Can I get it back?
    M maxmaven

    I already have this style. I think I know more about what the problem is now: My buttons are *disabled*. Is there a way in the toolbar editor to set a button to be enabled? Max

    C / C++ / MFC tutorial question

  • I removed default hover behavior in my toolbar. Can I get it back?
    M maxmaven

    Hi, I have a CToolbar and somehow managed to cause the buttons in the toolbar to not have a box drawn around them when the user's mouse is positioned over them. Is there an easy way to get this behavior back? I don't know how I managed to remove this behavior, that's why I have no idea how to put it back in. Thanks, Max

    C / C++ / MFC tutorial question

  • Newbie learning MFC, confused about Document/View
    M maxmaven

    This is why I'm confused. So just to recall, I have UsefulSplitterWnd and two child views of the split. The left one is a CTreeView and the right one is a CFormView. Each of the CFormViews has an associated dialog that it displays. Here's what I've tried with these CFormViews. First, I tried overriding OnCreate(...). But this function is never called at any time during execution of my application. Next, I tried overriding OnUpdate(...) and OnInitialUpdate(...). I put breakpoints in these functions and found that they are only executed once, at the start up of the application. They are never called again, even when CUsefulSplitterWnd::replaceview(...) is called. There are basically two important functions that CUsefulSplitterWnd::replaceview(...) calls. They are:

    // Delete existing view
    ((CView *) GetPane(row,col))->DestroyWindow();

    This destroys the window associated with the CFormView. However, in searching the MSDN help docs, it says that this function doesn't destroy the CFormView class object. So my class must be around somewhere (?). The second important function is:

    // Create new view

    context.m_pNewViewClass=pViewClass;
    context.m_pCurrentDoc=pDoc;
    context.m_pNewDocTemplate=NULL;
    context.m_pLastView=NULL;
    context.m_pCurrentFrame=NULL;

    CreateView(row,col,pViewClass,size, &context);

    This should be telling me what function I need to override so that the dialog is initialized to the saved values in my CDocument subclass. But, I tried all the sensible functions. They are either never called in the app, or only called once at app startup. I'm pretty lost. :confused: Max

    C / C++ / MFC c++ question csharp java visual-studio

  • Newbie learning MFC, confused about Document/View
    M maxmaven

    Hi, I'm learning MFC, with prior experience in java, so I have a little bit of understanding about the general concept of a document and a view (I hope). I'm trying to figure out some missing knowledge I don't have about the concept of Document/View in MFC when using a splitter window. I have two questions. The first question, I will explain something I did and ask your advice. I think I did it the "right" way, but I'm not 100%. By the right way, I am meaning, the way that makes the most sense and uses MFC as properly as possible. I know there are lots of ways to do the same thing, I am just hoping I did it the most appropriate way. My second question points out that I am missing something major. I know I did it the wrong way. Could you point me towards the proper way? All this was done in Visual Studio 2005. Question 1: I have a MainFrame and the App Wizard added a window splitter for me. I made the splitter static with one row, two columns. The left pane has a CTreeView subclass. The right pane displays one of two CFormViews, call them info_pane_1 and info_pane_2 (imagine a project settings kind of situation). There are two items in the left CTreeView pane, clicking on the first item causes info_pane_1 to appear in the right pane. Similarly, clicking on the second item causes info_pane_2 to appear in the right pane. I didn't implement any of the fancy splitter stuff myself, I used "CUsefulSplitterWnd" on this website. The only code I needed to add was a message handler, OnTvnSelchanged(...) to my CTreeView subclass. In this function, I figure out which item was clicked on in the tree view, then I get a pointer to the parent frame (MainFrame). I call a new member I added to MainFrm.cpp called ChangeDialog(int which). The variable "which" is either 1 for info_pane_1 or 2 for info_pane_2. The function ChangeDialog(...) in MainFrm.cpp is just: (paraphrasing)

    switch(which)

    case 1:
    m_wndSplitter.ReplaceView(0,1,RUNTIME_CLASS(info_pane_1),...)

    or

    case 2:
    m_wndSplitter.ReplaceView(0,1,RUNTIME_CLASS(info_pane_2)

    Everything works exactly as I had hoped; Clicking in the tree (in the left pane) dynamically changes what appears in the right pane. Did I do this the right way? Question 2: Here is where I'm confused about how to properly use the Doc/View architecture. What I need to do is simple: The user clicks on the various checkboxes and radio-boxes in info_pane_1, and I have an "Apply" button. When the user clicks "Apply", the state of the

    C / C++ / MFC c++ question csharp java visual-studio

  • Windows Lex/Yacc (and Bumblebee)
    M maxmaven

    I'm trying to get Bumbleebee Software's lex and yacc generator up and running. I'm pretty experienced with lex and yacc, but only on unix systems. The problem is, if I use Bumblebee's ParserWizard, I get a good grammar and can compile, but the resulting application (I'm building into a windows console application) always crashes. I've tried "empty" grammars. I've also tried a grammar that can only produce a single non-terminal, i.e., it should be able to match an input of "binky", and nothing else. No matter what I try, the resulting application always crashes. I've tried reading from stdin and from a file, with no luck. I wish I could copy and paste some of the examples provided with bumblebee (like the calculator grammar), but it seems that most of them are the grammar without an accompanying lexer. I had hoped that there would be a complete example that I could compile in ParserGenerator and then compile in Visual C++ and have a working application (no matter how simple). But, apparently, no luck there. I would be immensely grateful for any of the following: 1. Any simple grammar (and lexer if needed) that I can compile in Bumblebee and then MSVC and run the resulting console app without a crash. 2. Advice, tips, suggestions on what is needed to get a working Bumblebee generated grammar and lexer. I obviously don't know why my parsers and lexers are not working. Could it be because under unix, anything not parsed gets dumped to stdout, and this is not acceptable in windows? Is it something else that I have not done properly? Thanks for any help you can offer! maxmaven

    C / C++ / MFC c++ help question regex tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups