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
T

Tony Teveris

@Tony Teveris
About
Posts
34
Topics
24
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • VS 2010 - SubClass - FromHandlePermanent Assert
    T Tony Teveris

    Trying to subclass a combobox i order to have the entries have a tab stop. When I perform the subclass I get an assert. This code use to work in the early days of MFC but with 2010 it fails. I did not try it with any VS version in between. Is it something very simple I'm missing? Thanks

    class CTabCBox : public CComboBox
    {
    public:
    CTabCBox() {icTab=0; lpiTab=NULL;}
    ~CTabCBox() {if (lpiTab) free(lpiTab);}

    // subclassed construction
    BOOL SubclassCBox(UINT nID,CWnd\* pParent,int icTabs,LPINT lpiTabs);
    

    protected:
    int icTab; // count of tab stops
    LPINT lpiTab; // tab stops in logical units

    virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMis);
    virtual void DrawItem(LPDRAWITEMSTRUCT lpDis);
    

    };

    // CtestDlg dialog
    class CtestDlg : public CDialogEx
    {
    // Construction
    public:
    CtestDlg(CWnd* pParent = NULL); // standard constructor

    // Dialog Data
    enum { IDD = IDD_TEST_DIALOG };

    protected:
    virtual void DoDataExchange(CDataExchange\* pDX);	// DDX/DDV support
    

    // Implementation
    protected:
    HICON m_hIcon;

    // Generated message map functions
    virtual BOOL OnInitDialog();
    afx\_msg void OnSysCommand(UINT nID, LPARAM lParam);
    afx\_msg void OnPaint();
    afx\_msg HCURSOR OnQueryDragIcon();
    DECLARE\_MESSAGE\_MAP()
    

    public:
    CTabCBox m_ctrlFontsX;
    CComboBox m_ctrlFonts;
    };

    // from INITDIALOG
    // TODO: Add extra initialization here
    TEXTMETRIC tm;
    int iTab;

    // compute tab stop
    if (m\_ctrlFonts.GetDC()->GetTextMetrics(&tm))
    	iTab = (33+8) \* tm.tmAveCharWidth;
    
    m\_ctrlFontsX.SubclassCBox(IDC\_COMBO1,this,1,&iTab);
    
    CString csS("Font title string\\tnnnnnnnn");
    
    m\_ctrlFontsX.AddString(csS);
    

    BOOL CTabCBox::SubclassCBox(UINT nID, CWnd* pParent, int icTabs, LPINT lpiTabs)
    {
    DWORD dwcb;
    int iRc = 0;

    // make very sure all tab members are free and clear
    if (lpiTab)
    	free(lpiTab);
    lpiTab = NULL;
    icTab = 0;
    
    if (icTabs>0)
    	{
    	// make copy of tab info
    	dwcb = icTabs\*sizeof(int);
    	if (!(lpiTab = (LPINT)malloc(dwcb)))
    		return(FALSE);
    	memcpy(lpiTab,lpiTabs,(size\_t)dwcb);
    	icTab = icTabs;
    	}
    iRc = SubclassDlgItem(nID, pParent); // THIS CAUSES THE ASSERT
    return(iRc);
    

    } // end of SubclassCBox

    It always fails on the second assert (FromHandle....) from wincore.cpp
    BOOL CWnd::Attach(HWND hWndNew)
    {
    ASSERT(m_hWnd == NULL); // only attach once, detach on destroy
    ASSERT(FromHandlePermanent(hWndNew) == NULL);
    // must not already be in permanent map

    Tony Teveris Gerb

    C / C++ / MFC c++ css visual-studio question announcement

  • Creating Help (CHM) Files
    T Tony Teveris

    I would like to know what everyone uses to create standalone help files for application that do NOT have access to the iNet. You know your standard *.chm files. We have used RoBoHelp in the past but are looking for something easier. Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC help

  • VS 2008 - CDialogBar - older application
    T Tony Teveris

    Converted an older application to VS 2008, this is NOT a new application. This code has been used for years with no problems. Now when built with VS 2008 the CDialogBar is no longer visable but when I check the code (debugging) everything is going through the motions as if very thing is fine. So does anyone have any ideas? TIA IDD_HRULE_DIALOG DIALOG 0, 0, 511, 21 STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN CONTROL "",IDC_HRULER,"Static",SS_WHITERECT | SS_NOTIFY | SS_SUNKEN,43,4,429,12 END // just who is derived from whom class CFrameWnd : public CWnd class CMDIChildWnd : public CFrameWnd class CChildFrame : public CMDIChildWnd class CRuleHDlgBar : public CDialogBar // create code int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // create ruler dialog bars if (!m_RuleHDlgBar.Create(this, IDD_HRULE_DIALOG,CBRS_TOP| CBRS_SIZE_FIXED,-1) || !m_RuleHDlgBar.InitDialog()) { TRACE0("Failed to create dialog bar\n"); return -1; // fail to create } if (!m_RuleVDlgBar.Create(this, IDD_VRULE_DIALOG,CBRS_LEFT| CBRS_SIZE_FIXED|CBRS_ORIENT_VERT,-1) || !m_RuleVDlgBar.InitDialog()) { TRACE0("Failed to create dialog bar\n"); return -1; // fail to create } Like I said, the actual code to draw, size the dialogbar executes fine.

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC visual-studio question

  • Determine executing OS, not application architecture
    T Tony Teveris

    Right now I'm just debugging the code and just looking "quick watch" on the structure. As a first time .Net/VB coder it should be ByRef. Now it works. I'll do more testing on other OSs

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    .NET (Core and Framework) testing beta-testing architecture tutorial question

  • Determine executing OS, not application architecture
    T Tony Teveris

    On my Windows 7 64 bit the value is "Microsoft Windows NT 6.1.7600.0"

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    .NET (Core and Framework) testing beta-testing architecture tutorial question

  • Determine executing OS, not application architecture
    T Tony Teveris

    I'm not sure why this has to be so hard but I've check and seen a bunch of solutions that do not work. Currently I've tried this: Private Structure SYSTEM_INFO Public wProcessorArchitecture As Integer Public wReserved As Integer Public dwPageSize As Long Public lpMinimumApplicationAddress As Long Public lpMaximumApplicationAddress As Long Public dwActiveProcessorMask As Long Public dwNumberOfProcessors As Long Public dwProcessorType As Long Public dwAllocationGranularity As Long Public wProcessorLevel As Integer Public wProcessorRevision As Integer End Structure Private Declare Sub GetNativeSystemInfo Lib "kernel32" (ByVal lpSystemInfo As SYSTEM_INFO) . . . Dim si As SYSTEM_INFO GetNativeSystemInfo(si) If si.wProcessorArchitecture = 9 Then Console.WriteLine("64 bitter") End If . . . What I noticed is that the structure never gets filled in. I'm testing this on a Windows 7 64 bit OS Any idea why this does not work or any ideas on how to figure out the OS architecture? Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    .NET (Core and Framework) testing beta-testing architecture tutorial question

  • VB.Net - The dependency service does not exist or has been marked for deletion. (Exception from HRESULT: 0x80070433)
    T Tony Teveris

    First timer with VB and .Net In the following code I get the displayed error when I execute the objOS.Get. I'm executing on an XP Pro SP3 and have all updates installed. I would assume I'm missing something but WHAT? Any help is appreciated. Dim objMgmt As ManagementObject Dim objOS As New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem") For Each objMgmt In objOS.Get A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Management.dll An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Management.dll Additional information: The dependency service does not exist or has been marked for deletion. (Exception from HRESULT: 0x80070433) TIA

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    .NET (Core and Framework) help csharp question

  • Looking for Mathematical Expressions Evaluator
    T Tony Teveris

    I'm looking for a MEE that can handle number expressed with factions. Example: A user may use 3.5 * 4 7/8 or 3 1/2 * 4.875 I see a lot of MEE but do not want to go through each one. Any help, pointers would be helpful Thanks

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC help tutorial

  • Enable / Disable ClearType font rendering via system call?
    T Tony Teveris

    Does anyone know a way to disable the ClearType font rendering via a system function? We render a lot of text (monochrome) into memory bitmaps and dibs and it takes forever. If we disable ClearType via the control panel the process is very, very fast but the users screen looks like crap. Our apps execute on both XP and Vista. The user wouldn’t even mind if the screen looked bad during the process and reverted back to cleartype after the process. Any ideas? Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    Graphics performance question

  • CObject (CView - CDoument) callbacks
    T Tony Teveris

    It is NOT an extension DLL, just a normal DLL. I see your point and will look into extension DLL or mangage the state in the callback. I think were done here - many thanks

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC c++ question announcement lounge

  • CObject (CView - CDoument) callbacks
    T Tony Teveris

    Sorry about that DLGPROC pfn; pfn = (DLGPROC) MakeProcInstance((FARPROC) pfnDialog, AfxGetApp()->m_hInstance); nRet = (L_INT) DialogBoxParam(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(nDialog), hWnd, pfn, lParam); FreeProcInstance((FARPROC) pfn); Regular DLL using / linked with MFC (NOT static, same as main app) within wincore.cpp here is where it fails // should be a normal window ASSERT(::IsWindow(m_hWnd)); // should also be in the permanent or temporary handle map CHandleMap* pMap = afxMapHWND(); ASSERT(pMap != NULL); I have to ask the programmer of the main app some questions. I agree with you so far so I think there has to be something in our code messing something up.

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC c++ question announcement lounge

  • CObject (CView - CDoument) callbacks
    T Tony Teveris

    the DLL function AFX_MANAGE_STATE(AfxGetStaticModuleState( )); nRet = DoDialogBoxParam(IDD_BCI_DLG, hParentWnd, (DLGPROC)BCIDlgProc, (LPARAM) pBciDlgData); the partent windows is that of the main app, the dialog resource is in the DLL

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC c++ question announcement lounge

  • CObject (CView - CDoument) callbacks
    T Tony Teveris

    If the DLL is displaying a dialog and the dialog code through it's messageing calls the callback is there a problem. Do dialogs operate in the same thread or different ? When I first did this I thought that same as you but it does fail. In the DLL I am using some 3rd part imaging software (LEAD) but it all links with the same liraries.

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC c++ question announcement lounge

  • CObject (CView - CDoument) callbacks
    T Tony Teveris

    callback (p1, p2, p3, ....) { CView *pView = (CView *)p1 pView->whatever() causes ASSERT as defined in wincore.cpp - void CWnd::AssertValid() } MainApp{ CDocument::OnCommand - selected some operation from menu CView *pView = get active view call DLL (pView, p2, p3, ...) } DLL { put up dialog move slider, now need to update pView in main app callback(pView, p2, p3 ...) } No matter if I pass a ptr to CDocument or CView the callback will fail (ASSERT) someplace If I pass in the HWND and in the callback use CWnd::FromHandle() and then call InvalidateRect() I can get thinks to redraw but I want to access items in the Doc or View. The ASSERT code states // Note: if either of the above asserts fire and you are // writing a multithreaded application, it is likely that // you have passed a C++ object from one thread to another // and have used that object in a way that was not intended. // (only simple inline wrapper functions should be used) // // In general, CWnd objects should be passed by HWND from // one thread to another. The receiving thread can wrap // the HWND with a CWnd object by using CWnd::FromHandle. // // It is dangerous to pass C++ objects from one thread to // another, unless the objects are designed to be used in // such a manner. So does anyone have a way around this? Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC c++ question announcement lounge

  • Insert popup menu
    T Tony Teveris

    Looks like this will do. I will give it a try. Many thanks

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC question learning

  • Insert popup menu
    T Tony Teveris

    I have a popup menu defined as a resource and want to insert it into the apps main menu between the File and Edit menu items. How do I get this done. Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    C / C++ / MFC question learning

  • Borland C++ Builder to MS VS 2005
    T Tony Teveris

    Has anyone have any thoughts on converting a Borland C++ Builder project to MS VS 2005 ? I don’t know anything about Borland’s environment but we have acquired a company that does all it’s software using Borland. We are strictly an MS environment group. The project is a simple MDI application, no .NET. Are there any blogs, papers, etc on the subject ? Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

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

  • Explorer login / password reset
    T Tony Teveris

    I've noticed a couple of times now that my Vista Internet explorer resets WEB page login / passwords. I'm one that always leaves my system on. Maybe every other day I come in the morning to browse the WEB and the WEB sites I visit always need to be relogined in, sometimes the auto complete works and sometimes I need to remember logins and password. I don't think it's the cleaning crew.

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    Windows API

  • Shell Extensions - Vista 64 Bit
    T Tony Teveris

    Oh boy, more work. I'll assume that means that my modules dependents must also be 64 bit. Thats a lot of work since we have not gone there yet (compile / built) for 64 bit. Thanks, I knew YOU would pipe in with the answer. Again thanks

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    Windows API linux question

  • Shell Extensions - Vista 64 Bit
    T Tony Teveris

    I have created 3 shell extensions that our users have used over the years. Two being a property sheet addition and the most popular being a thumbnail viewer extension. These all work in W2K, XP and Vista 32 bit but not in Vista 64 bit. Does the 64 bit explorer "thunk" to 32 extensions or do I now need to create 64 bit versions of these ? Does it have anything to do with the WOW factor in the 64 bit world, registery, etc ? Thanks in advance

    Tony Teveris Gerber Scientific Products Senior Software Engineer Phone: 860 648 8151 Fax: 860 648 8214 83 Gerber Road West South Windsor, CT 06074

    Windows API linux question
  • Login

  • Don't have an account? Register

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