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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
E

electronicman_x

@electronicman_x
About
Posts
21
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Restricting resizing of controlbars
    E electronicman_x

    I put a handler for WM_GETMINMAXINFO in as OnGetMinMaxInfo() but sizing the control bar never results in the program entering this code. I'm not sure if this control bar acts like a standard CWnd, the WM_SIZING message never gets called either. Perhaps this message is being handled for me at a lower level class? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics

  • Restricting resizing of controlbars
    E electronicman_x

    I'm currently using controlbars (stingray studio SECControlbars which are derived from CControlbar) and I'm trying to limit the size that you can reduce them to. Currently, i'm able to catch the WM_SIZE message in my SECControlbar derived class, but im not entirely able to control the actual sizing. What happens is i catch the size message and im able to see what size is requested, but when i attempt to change the size and pass to the base class, the results are incorrect. In my specific case, im trying to limit the width of a vertical controlbar to 132 or more pixels. What happens with my code is the first sizing that goes below the 132 barrier actually happens despite my efforts to stop it. When i size again (also attempting below 132) the size is adjusted towards my 132 barrier but not exactly right and depending on how small i actually tried to make it. These two results happen one after the other, so every other size appears to try and size correctly. I think im setting my size after the actual controlbar size is interpretted but i can't seem to find the message i should capture and override to prevent this. I've tried using spy++ on the window but i can't seem to find any other messages that could be responsible. I also think I could be misusing the CalcDynamicLayout() function, but i've tried most all of the options and it doesnt seem to matter all that much. Any solution for a CControlbar should work in this situation, but i haven't seen one in any examples. Here's part of my OnSize handler: void VHelpDlg::OnSize(UINT nType, int cx, int cy) { VMainFrame *pMainFrame = static_cast(AfxGetMainWnd()); if(pMainFrame) VGENyDoc* pDoc = pMainFrame->GetDocument(); else return; CSize szCtrlBar; if(this->m_szDockVert.cx<132) { this->m_szDockVert.cx=132; cx=132; szCtrlBar=CalcDynamicLayout(132,LM_COMMIT|LM_VERTDOCK|LM_STRETCH); } SECControlBar::OnSize(nType,cx,cy); Invalidate(); } Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics

  • CFileDialog change directory?
    E electronicman_x

    Thanks, that works great. I must have missed that m_ofn data item. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC c++ question graphics tutorial

  • CFileDialog change directory?
    E electronicman_x

    This is for an MDI program (mfc) with visual c++ 6.0 Probably a pretty easy question: I am using CFileDialog for open/save as file operations. I want to be able to create an instance of the dialog, change the working directory in code at runtime, and then domodal() having the dialog show the directory i specified as the current directory. I'm able to get the directory names i want to use in the format CString (i.e. "c:\project\dbc") and i want to use this path/directory string to change the directory but i can't seem to figure out how to do it. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC c++ question graphics tutorial

  • Window Size and position in registry
    E electronicman_x

    I'll have to try that out. The SPI_GETWORKAREA seems to work but probably because i have nView on my Geforce laptop video card. It acts like one wide monitor. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics windows-admin debugging tutorial

  • Window Size and position in registry
    E electronicman_x

    Thanks, that worked well. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics windows-admin debugging tutorial

  • Window Size and position in registry
    E electronicman_x

    2 questions: Q1: I'm currently working on an MDI program with controlbars and the Stingray Toolkit. I want to save the program's last size and position in the registry when the program is closed. Currently i'm able to store the controlbars locations into the registry using the SaveBarState function. I basically need to create my own registry key or find some similar function that will store the program's size and position like the SaveBarState function. I'm not really sure how to go about doing this. I can get the information about the program, but i dont know how to store it to the registry properly. Q2: The reason I'm doing this is because i want to save the appearance of the program so when it runs again it looks just as it was when it was closed. I also want to be able to size the program according to the screen real-estate on the desktop (the first time it runs or if the resolution changes). The reason for this is i have a few systems im running this program on that use multiple monitors and i dont want the window stretched across them. I also want to have control over the window size and position when it runs. I have some rough code, but i dont know if i should do things this way. some crappy code im playing with: (This lets me control the size but im not sure how safe this method is) //(inside MyApp()) CRect rClientSpace; CRect rc2; CWnd * pWndMain; pWndMain=(CWnd *)pMainFrame; pWndMain->GetWindowRect(rc2); SystemParametersInfo(SPI_GETWORKAREA,0,&rClientSpace,0); //checks horiz. and vert. to make sure it can make this window. if ( ((rc2.left+1000) < rClientSpace.right)&&((rc2.top+750) < rClientSpace.bottom) ) { pWndMain->SetWindowPos(NULL, rc2.left, rc2.top, 1000, 750,SWP_NOZORDER);//I want 1000x750 when feasible } pWndMain->GetWindowRect(rc2);//to see the results in debugger Any ideas or code would be great. Thanks ! Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics windows-admin debugging tutorial

  • Richedit control font problem
    E electronicman_x

    Yeah i was using the SetSelectionCharFormat(). I went over my code and apparently i was missing the SetDefaultCharFormat() and it seems to solve the problem. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC csharp visual-studio graphics help question

  • Richedit control font problem
    E electronicman_x

    I'm using a richedit control in my mdi program w/controlbars and i'm having issues with the font changing on me. I'm using the richedit control to display information in a control bar, this control consists of a tab window with 4 tabs, each being a richedit control (i'm trying for something like the message window in visual studio 6.) I'm having issues setting fonts, i'm able to set them initially but they change on me when certain actions happen within the program. I can get the font to change on me when i run the program, do something to make messages appear, click and highlight the message text, and do another task to make more messages appear. If i only click and not highlight text in that richedit control, the font does not change. There are a few other random events that cause this change but i cannot pinpoint the steps that caused it. Is there some way to set a font permanently for the control? What would be the best place to set a font for this control initially so that it's unlikely to be changed? I'm using Visual Studio 6, with Stingray library. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC csharp visual-studio graphics help question

  • Window position
    E electronicman_x

    I'm currently working on an MDI application that has dockable toolbars and a child window (view). I want to make a menu item that allows me to return the windows & toolbars to their initial position. I am able to place the toolbars successfully via docktoolbar(), but i cannot recall how to handle the child window. I would like to capture the window's position during/just after it's creation, and upon the appropriate menu call, restore that position. I've looked into Get/Set-WindowPlacement() but i'm very unclear on it's usage. Any advice would be appreciated, code is especially helpful. I was also wondering how i can call the built in functionality from the window->tile menu command that tiles your child windows (from within my code at runtime). Thanks Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics tutorial

  • Dynamic menus
    E electronicman_x

    Many options will be showing, and i basically need to record the actual text that shows up in the menu. I cannot save the index value when i set the menu text, because i do not know which item will be chosen. I want the menu text simply to help me figure out which one i actually chose. For example File Edit Sections ->Section 1 I do something and create 3 more sections at runtime modifying the menu. Now the menu looks like this Sections ->Section 1 ->Section 2 ->Section 3 ->Section 4 Each Menu choice is bound to ID_SECTION. ID_SECTION corresponds to OnSection() In my code: void OnSection() { int section; // I need to fill the section variable with // the index of the item i picked from the menu // since all of them have the same ID. If(section==1) handle section 1 If(section==2) handle section 2 If(section==3) handle section 3 If(section==4) handle section 4 } Hopefully this helps. Thanks. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC tutorial graphics question

  • Dynamic menus
    E electronicman_x

    How can i get the currently displayed option? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC tutorial graphics question

  • Dynamic menus
    E electronicman_x

    I'm trying to implement a dynamic menu system to my program. Currently, i can add and remove the items from the menu, and make the menu items run code that i've premade. for example i can add "section 1" to a section menu, while associating ID_SECTION_1 to the command in the menu. This will call my OnSection1() code when this command is executed. I want this to be boundless (i.e. i dont want to have to make code for OnSection2, OnSection3, OnSection4... , or the strings in the string table, and so on.) I can currently bind each new menu item to the same id, for example section 1, section 2, and section 3 all run the OnSection() command which is bound to ID_SECTION. What i cannot do, is figure out how to determine which of the 3 i called. I would like to basically get the location of the last menu choice i picked, so if section 2 is in the second spot on the menu, i want to know this when i call OnSection(). Any ideas? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC tutorial graphics question

  • Getting pointer to MFC Document
    E electronicman_x

    Great!! works good thanks Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC question c++ graphics data-structures

  • A simple C compiler
    E electronicman_x

    There used to be a compiler called DJGPP that was good for C stuffs. It might be free or shareware too. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC help question

  • Getting pointer to MFC Document
    E electronicman_x

    I attempted your suggestion with this code: void ModuleTab::OnModulemenuAddchannel() { // TODO: Add your command handler code here CString display; int work; AfxMessageBox(_T("add channel. later.")); //start CFrameWnd* pMWnd; pMWnd=(CFrameWnd *)AfxGetMainWnd(); CView* pVWnd; pVWnd=pMWnd->GetActiveView(); CGENyDoc* pDoc; pDoc=(CGENyDoc *)pVWnd->GetDocument();//fails debug assertion here. //end work=pDoc->m_myint; work++; pDoc->m_myint=work; display.Format(_T(" value: %d"),work); AfxMessageBox(display); Invalidate(); } It fails where i call get document. It appears that I'm getting the wrong pointer. Any suggestions? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC question c++ graphics data-structures

  • UpdateData won't cut it
    E electronicman_x

    Maybe you should spawn a thread to countdown? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC question announcement

  • Getting pointer to MFC Document
    E electronicman_x

    I'm currently working with an MDI application and RogueWave's Stingray library. I'm using their SECControlBar class for a dockable window which will contain 2 tree controls selectable by tabs. I have the trees working and the tabs working, but I'm trying to keep all my data in the Document class of my MDI. This SECControlBar class is not doc/view based, it's just a CWnd derivative. My question is how do i get access to my document class via this CWnd derived dockable window? Normally i just use a GetDocument for my view classes to obtain the related document but there is no such function i can see for the same thing from this CWnd derivative. Thanks for you time. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC question c++ graphics data-structures

  • Image list
    E electronicman_x

    I am looking to make a view in my MFC MDI application that is a list of bitmaps that have captions under them. This would be a dockable window that opens up when the program starts. I have a dockable toolset that I can use, but I'm not sure how to go about making a scrollable window that has these bitmap icons in them. I want to be able to have this view on the left side, and when you click on a particular bitmap the right side view changes to reflect your selection. I'd also like to be able to grey out certain icons to disable them from my program. Any ideas? Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics c++ tutorial question

  • Static controls
    E electronicman_x

    I'm trying to display a bitmap in a Dialog and I've created a static control named IDC_PICTURE. I added this through the resource editor and placed it in my dialog and associated a picture. The picture shows up fine when i run my program. What i want to do is change the picture during the program to a different bitmap. I added the second bitmap to the resource list (right under the first one) and I'm trying to figure out how I can get control over which bitmap is displayed. Usually, I work with simple edit boxes and I do the following to gain control over them. CWnd * pWnd = GetDlgItem(IDC_BYTE0);//where IDC_BYTE0 is an edit control pWnd->ShowWindow(SW_SHOW); // i use this to control it, in this case to make it show instead of hidden. I want to do this: CStatic *pPic = GetDlgItem(IDC_PICTURE);//where IDC_PICTURE is the static control of type picture so i can do this pPic->SetBitmap(IDB_BITMAP2) //where IDB_BITMAP is the first one and IDB_BITMAP2 is the second picture This code doesn't compile because GetDlgItem returns a CWnd type pointer.. but how do i get the pointer I need to use the CStatic functions? Thanks Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    C / C++ / MFC graphics question learning
  • Login

  • Don't have an account? Register

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