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
D

Dansveen

@Dansveen
About
Posts
19
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Changed CMDIChildWnd to CMDIChildWndEx: does not show anything inside the frame
    D Dansveen

    Hi all I have an MFC application that works perfectly with the CMDIChildWnd class, the frame is loaded and a splitterwnd is shown. I needed to create a new MFC application that uses the ribbon as the interface, and for that the only change I made was that my classes inherited from CMDIChildWndEx. The two MFC applications should work with CMDIChildWndEx, but the old application does not show anything in the frames, it does not show errors, exceptions, it does not show inside the window. I already tried changing the style, forcing the frame size, changing the spliterwnd but nothing worked. See the LoadFrame code:

    void CMyFrame::ActivateFrame(int nCmdShow)
    {
    if (m_pMDIFrame && m_pMDIFrame->SendMessage(WM_IS_ENABLE_MDI_TAB))
    {
    LONG style = ::GetWindowLong(GetSafeHwnd(), GWL_STYLE) | WS_MAXIMIZE;
    style &= ~WS_BORDER & ~WS_THICKFRAME & ~WS_DLGFRAME & ~WS_CAPTION;
    ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, style);
    style = ::GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE);
    style &= ~WS_EX_CLIENTEDGE;
    ::SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE, style);
    ShowWindow(SW_SHOWMAXIMIZED);
    return;
    }

    if (m\_bInsideMDIFrame)
    {
    	CMDIChildWndEx::ActivateFrame(nCmdShow);
    	return;
    }
    
    long style = ::GetWindowLong(GetSafeHwnd(), GWL\_STYLE);
    style &= ~WS\_MINIMIZEBOX & ~WS\_MAXIMIZEBOX;
    ::SetWindowLong(GetSafeHwnd(), GWL\_STYLE, style);
    style = ::GetWindowLong(GetSafeHwnd(), GWL\_EXSTYLE);
    style &= ~WS\_EX\_CLIENTEDGE;
    ::SetWindowLong(GetSafeHwnd(), GWL\_EXSTYLE, style);
    
    SetWindowPos(NULL, 0, 0, 0, 0, SWP\_DRAWFRAME | SWP\_NOZORDER | SWP\_NOACTIVATE | SWP\_NOSIZE); 
    
    CFrameWnd::ActivateFrame(SW\_SHOWNOACTIVATE);
    

    }

    BOOL CMyFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle,
    CWnd* pParentWnd, CCreateContext* pContext)
    {
    if (g_globalVariables.GetParentWnd() == NULL)
    {
    if (m_bInsideMDIFrame)
    return CMDIChildWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);

    	return CFrameWnd::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext);
    }
    
    ASSERT(m\_nIDHelp == 0 || m\_nIDHelp == nIDResource);
    
    m\_bInsideMDIFrame = FALSE;
    
    m\_nIDHelp = nIDResource;    // ID for help context (+HID\_BASE\_RESOURCE)
    
    CString strFullString;
    if (strFullString.LoadString(nIDResource))
    	AfxExtractSubString(m\_strTitle, strFullString, 0);    // first sub-string
    
    VERIFY(AfxDeferRegisterClass(AFX\_WNDFRAMEORVIEW\_REG));
    
    dwDefaultStyle = WS\_CHILD | WS\_VISIBLE | WS\_CLIPSIBLINGS;
    
    // attempt to create the window
    LPCTSTR lpszClass = GetIconWndClas
    
    C / C++ / MFC c++ help

  • Circular buffer for file
    D Dansveen

    HI all I'm trying to implement a software that create backup files. The backup are created until a maximum of backup files defined, in my case are 10 files. After that I get the oldest backup file and overwrite. But I have somes question about what use, I tried use Circular buffer but I don't know how to use for files. Anybody can help me. Thank you.

    C / C++ / MFC help tutorial question

  • CFileDialog is not refreshing
    D Dansveen

    Thank you But my problem is not with mask, when I use my activex component inside IE9, when I click on treeview with folder names the screen where show files are not refreshing, my initial dir is C:\ but if I click in e.g D:\ nothing is showed, the screen stays in C:\. This just happen with activex in browser. I could check if set to FALSE the last parameter in CFileDialog constructor is working in both cases, in my application and browser, this parameter set Vista Style dialog, but is not a acceptable solution.

    C / C++ / MFC help announcement com

  • CFileDialog is not refreshing
    D Dansveen

    Hi I'm using default All files (*.*)

    C / C++ / MFC help announcement com

  • CFileDialog is not refreshing
    D Dansveen

    Hi all I created a Activex, when you click a button in Activex opens a FileDialog but when I click on treeview with folders list the list files screen is not update. I started with C:\ folder, even I change folders in treeview or press F5 nothing happens. I'm using Windows 7 and this problem just happen inside a ActiveX and IE9. In the older version this just not happen and the code is the same. Here is the code: CFileDialog dlg(TRUE, szMask, szPath, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, aux, NULL, 0, TRUE); dlg.m_ofn.lpstrInitialDir = initialDir; if (dlg.DoModal() != IDOK) { return; } Anyone can help me. Thank you

    C / C++ / MFC help announcement com

  • Multi touch - Limit CView boudaries when panning
    D Dansveen

    Ok I'm using GetWindowRect like MSDN example. But I have problems when panning. I have a CView with same size as CFrameWnd, if I move the screen beyond origin the screen does not redraw. What I need is do a panning only if my CVIew is bigger than my parent frame, and don't if Cview is in origin. I tried getting screen limits but does not work. Example: ________________ --->CFrameWnd - Glitches and does not redraw | | | ___________|____ ---> CView - out of screen origin | | | | | | | | | | | | | | | |__|_______________| Thank you.

    C / C++ / MFC tutorial visual-studio com help

  • Multi touch - Limit CView boudaries when panning
    D Dansveen

    Hi All I implemented a multi touch application. I follow MSDN tutorial using manipulation interface, here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd371408(v=vs.85).aspx[^] But I have many problems when panning or zooming, is not redrawing and glitches in scrren. I need to limit my CView and do panning when screen is bigger than CFrameWnd, because CFramewnd does not redraw. I don't know how to get frame size and limit CView to don't pass CFrameWnd size. I tried an anchor or dock window but did not work. Please, I need any help. Thank you.

    C / C++ / MFC tutorial visual-studio com help

  • Problems with MFC Ribbon edit with spin button
    D Dansveen

    The problem is resolved: I used: CString str = pEdit->GetEditText(); str.Remove(`,`); pEdit->SetEditText(str); :) Thank you

    C / C++ / MFC help c++

  • Problems with MFC Ribbon edit with spin button
    D Dansveen

    Thank you Now is working but when I click in Up Arrow the increment shows 1,000, 1,001, 1,002 and when I change focus shows the correct value. Thanks for all

    C / C++ / MFC help c++

  • Problems with MFC Ribbon edit with spin button
    D Dansveen

    Hi Here is my code:

    CMFCRibbonEdit *pEdit = DYNAMIC_DOWNCAST(CMFCRibbonEdit, MyApp->GetRibbonElement(ID_RIBBON_FORMAT_WIDTH));
    if(pEdit == NULL)
    return;
    CDrawObj *pObj = (CDrawObj*)m_selection.GetHead();
    if(pObj == NULL){
    ASSERT(0);
    return;
    }
    if(_ttoi(pEdit->GetEditText()) < 1) <==== Here GetEditText() return 1 and not 1,000 I tested with MFCOffice2007Sample and they have the same problem
    return;
    this->InvalObj(pObj);
    int nDelta = _ttoi(pEdit->GetEditText()) - pObj->m_position.Width();
    if(nDelta < GetDocument()->m_size.cx){
    CRect newPosition = pObj->m_position;
    newPosition.right += nDelta;
    pObj->MoveTo(newPosition);
    }

    C / C++ / MFC help c++

  • Problems with MFC Ribbon edit with spin button
    D Dansveen

    The problem is comma, when I use GetEditText() returns '1' and not '1,000', I want 1000 because I'm editing a object and when reach 1000 returns to value 1, that's wrong. I don't have parseInt() method I'm using mfc c++. thank you

    C / C++ / MFC help c++

  • Problems with MFC Ribbon edit with spin button
    D Dansveen

    Hi all In my aplication menu had a ribbon edit with spin button, I'm using this:

    pEdit->EnableSpinButtons(1, 1000);

    But when I increment with up arrow over 999 the value is changed to 1,000 I used GetEditText to change this value but what I have is 1 I can't change increment or ignore ',' or remove ',' from value, that is a bug with ribbon. In old MFC application I have Spinbuttonctrl in create method I have used UDS_NOTHOUSANDS but in ribbon I don't have this option. If somebody can help me. Thank you

    C / C++ / MFC help c++

  • Problems with MFCTabCtrl/MDITabbedControl
    D Dansveen

    Hi all I have a problema with MDITabbedControl. - Open multiple MDI tab screens - Select a tab from one of them and start moving it. Drop it on the "X" thing that closes the screen from another tab - Now move your mouse over the other tabs. As the mouse passes over the tab, the tab still captured, mouse doesn't release the capture. I try overloading pretranslatemsg, catching the message WM_LBUTTONUP, but still happens when during a drag/drop I click on close button.

    C / C++ / MFC announcement

  • Problems with MFCTabCtrl/MDITabbedControl
    D Dansveen

    Hi all I have a problema with MDITabbedControl. - Open multiple MDI tab screens - Select a tab from one of them and start moving it. Drop it on the "X" thing that closes the screen from another tab - Now move your mouse over the other tabs. As the mouse passes over the tab, the tab still captured, mouse doesn't release the capture. I try overloading pretranslatemsg, catching the message WM_LBUTTONUP, but still happens when during a drag/drop I click on close button. This is my code:

    switch (pMsg->message)
    {
    case WM_LBUTTONUP:
    {
    CWnd* pWnd = FromHandle(pMsg->hwnd);
    CMFCTabCtrl* tabGroup = dynamic_cast<CMFCTabCtrl*>(pWnd);
    if (tabGroup)
    {
    CPoint clickLocation = pMsg->pt;
    tabGroup->ScreenToClient(&clickLocation);
    int tabIndex = tabGroup->GetTabFromPoint(clickLocation);
    if (tabIndex >= 0)
    {
    CWnd* pTab = tabGroup->GetTabWnd(tabIndex);
    if (pTab && tabGroup->IsTabCloseButtonHighlighted() && tabGroup->IsTabCloseButtonPressed())
    {
    pTab->SendMessage(WM_CLOSE, 0, 0);
    }
    }
    }
    break;
    }
    default:
    {
    break;
    }
    }

    return CMDIFrameWndEx::PreTranslateMessage(pMsg);
    
    ATL / WTL / STL announcement

  • Problems to print
    D Dansveen

    Hi All I have problems to send print in my application. If I send print and if I change my view before ready to print, all commands will be cancelled. I send direct to print, print setup is not showed, the view can be closed, and OpenDocumentFile doesn't show this view if command is print; My application needs fill a graph, reading from a database, while not read all data he is not ready to print, I have a flag to do this. See my code:

    //if the document was found, try to print it
    if(pDoc!=NULL)
    {
    //if document is ready for printing, print it now
    dwTick=::GetTickCount();
    nPrintWindowTimeout=5;
    if(nPrintWindowTimeout<0)
    nPrintWindowTimeout=0;
    dwWaitLimit=(DWORD)nPrintWindowTimeout*1000;
    if(pDoc->IsReadyForPrintWindow() || (dwTick < item.m_dwTickStart || dwTick - item.m_dwTickStart > dwWaitLimit) )
    {
    //remove screen from the queue
    m_arPrintQueue.RemoveAt(0);
    //print
    pDoc->SetPrinting(TRUE);
    if (pDoc->GetView())
    {
    if (item.m_bPrintSetup == TRUE)
    pDoc->GetView()->SendMessage(WM_COMMAND, ID_FILE_PRINT_SETUP);
    else
    // But if I change my view this is never executed, the message queue is not keeping this in another view
    // This is sended in a CView, not in MainFrame, my derived CView process WM_COMMAND
    pDoc->GetView()->SendMessage(WM_COMMAND, ID_FILE_PRINT);
    }
    pDoc->SetPrinting(FALSE);
    pDoc->OnCloseDocument();
    }
    }
    }

    Somebody, can help me? Thank you

    ATL / WTL / STL data-structures database help question workspace

  • Crash ribbon when PC enter in sleep/standby mode
    D Dansveen

    Ok, this works in first time that I go in sleep/stand by mode. In second time my application crash in the same way. Im using Windbg to see stack. Here is my stack, the problem happens in release/debug version. 02dcf92c 78bbdb80 mfc90u!AfxFindResourceHandle+0x15 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dllinit.cpp @ 237] 02dcf94c 78bb8b74 mfc90u!CPngImage::Load+0x2e [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtoolbarimages.cpp @ 3141] 02dcf9f8 78b38b3d mfc90u!CMFCToolBarImages::LoadStr+0xca [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtoolbarimages.cpp @ 199] 02dcfb20 78bd2e4e mfc90u!CMenuImages::SetColor+0x7e [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxmenuimages.cpp @ 111] 02dcfb50 78bd2d33 mfc90u!CMFCVisualManagerOffice2007::~CMFCVisualManagerOffice2007+0x27 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxvisualmanageroffice2007.cpp @ 305] 02dcfb5c 78bc4772 mfc90u!CMFCVisualManagerOffice2007::`scalar deleting destructor'+0xd 02dcfb6c 78b23736 mfc90u!CMFCVisualManager::SetDefaultManager+0x34 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxvisualmanager.cpp @ 159] 02dcfb80 78b20b95 mfc90u!AFX_GLOBAL_DATA::Resume+0x138 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxglobals.cpp @ 1254] 02dcfb8c 78a3f97c mfc90u!CFrameWndEx::OnPowerBroadcast+0x1d [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxframewndex.cpp @ 1164] 02dcfc3c 78a3f6ce mfc90u!CWnd::OnWndMsg+0x287 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 1897] 02dcfc5c 78a3e2f4 mfc90u!CWnd::WindowProc+0x24 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 1755] 02dcfcc4 78a3e580 mfc90u!AfxCallWndProc+0xa3 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 240] 02dcfd2c 7e418734 mfc90u!AfxWndProc+0x37 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp @ 402] 02dcfd58 7e418816 USER32!InternalCallWinProc+0x28 02dcfdc0 7e428ea0 USER32!UserCallWinProcCheckWow+0x150 02dcfe14 7e428eec USER32!DispatchClientMessage+0xa3 02dcfe3c 7c90e473 USER32!__fnDWORD+0x24 02dcfe60 7e4193e9 ntdll!KiUserCallbackDispatcher+0x13 02dcfe8c 7e419402 USER32!NtUserPeekMessage+0xc 02dcfeb8 78a7ea72 USER32!PeekMessageW+0xbc 02dcfeec 78a7e337 mfc90u!CWinThread::Run+0x86 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 640] 02dcff70 78543433 mfc90u!_AfxThreadEntry+0x10c [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 126] 02dcffa8 785434c7 MSVCR90!_callthreadstartex+0x1b [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 348] 02dcffb4 7c80b729 MSVCR90!_threadstartex+0x69 [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 326

    C / C++ / MFC help question workspace

  • Crash ribbon when PC enter in sleep/standby mode
    D Dansveen

    Here is my derived class: class CMFCMyVisualManagerOffice2007 : public CMFCVisualManagerOffice2007 { DECLARE_DYNCREATE(CMFCMyVisualManagerOffice2007) public: CMFCMyVisualManagerOffice2007(); virtual ~CMFCMyVisualManagerOffice2007(); virtual void OnUpdateSystemColors() { m_bAutoFreeRes = bAutoFree; } }; IMPLEMENT_DYNAMIC(CMFCMyVisualManagerOffice2007, CMFCVisualManagerOffice2007) So, in OnCreate of CMainframe: CMFCMyVisualManagerOffice2007::SetStyle (CMFCMyVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCMyVisualManagerOffice2007));// this line crash application

    C / C++ / MFC help question workspace

  • Crash ribbon when PC enter in sleep/standby mode
    D Dansveen

    So, now the problem is how to use my derived class in MainFrame. I can't use : CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCMyVisualManagerOffice2007)); My application still crash.

    C / C++ / MFC help question workspace

  • Crash ribbon when PC enter in sleep/standby mode
    D Dansveen

    Hi all I have a big problem, when Windows Xp, Vista or Win7 enter in sleep/stand by mode, my software crash in restart. I found where is the problem, the problem is in ribbon bar. I have a MDI application based in ribbon Office 2007, but my mainframe run in another thread where is the ribbonbar and initialization. I have a derived class of CWinthread where is my CMainframe, this is necessary because of software type. In my tests I found: CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); This I set in OnCreate() function of my Mainframe, in tests I can see that problem is only when I choose CMFCVisualManagerOffice2007, there are no problem for the others, Office 2003, XP, VS2005. Im using in development environment WINXP, VS2008 SP1. Anybody can help me? Do you have seen this before? Thank you

    C / C++ / MFC help question workspace
  • Login

  • Don't have an account? Register

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