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
J

Jason De Arte

@Jason De Arte
About
Posts
44
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • duplicate variable names seperated by scope
    J Jason De Arte

    I was once maintaining some odd looking code that had the (no joke) the following pattern: int variable; class CSomething { public:  int variable;   void Func(int variable) {   // do something   {     int variable;     // do something where the bug I was trouble shooting was located   }  }; }; Count them: FOUR declarations of the same variable name (and type) in the same file! 1) In the global scope 2) As a member var 3) as a function parameter 4) declared IN SIDE the function that has the identical named param Yes, it was legal - but it didn't make it right.

    [ Jason De Arte | Toy Maker | 1001010.com ]

    The Weird and The Wonderful com regex help

  • WinVerifyTrust on legacy Win9x?
    J Jason De Arte

    Well, after a few hours of digging and testing my theories - I've answered my own question. There's this thing called CAPICOM.DLL that provides a number of com interfaces for checking the authenticode signature on a file. And it even (as the rumor goes) have a redistributable for win98! With a little work, I'm sure somebody with more time on their hands than I, could write up a full featured article that also Signs and timestamps a file. :)

    #ifndef __SIGNED_CODE_H__
    #define __SIGNED_CODE_H__
    	
    // 2004.Oct.03.JED - A quick tool to check the signatures of an Authenticode signed file
    //  coded under DevStudio6 for an ATL/WTL project
    	
    // MSDN Docs
    // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/signedcode.asp
    	
    // Get the typelib header info
    #import "capicom.dll" named_guids no_implementation
    	
    #pragma once
    	
    class CSignedCode
    {
    protected:
    	CComQIPtr<CAPICOM::ISignedCode> m_spSignedCode;
    
    public:
    	CSignedCode(LPCTSTR pszFileName)
    	{
    		HRESULT hr = m_spSignedCode.CoCreateInstance(CAPICOM::CLSID_SignedCode);
    		if( SUCCEEDED(hr) && pszFileName && *pszFileName )
    			SetFileName( pszFileName );
    	}
    	
    	// The act of setting the filename starts the Authenticode check
    	HRESULT SetFileName( LPCTSTR pszFileName )
    	{
    		if( !m_spSignedCode )
    			return E_POINTER;
    		return m_spSignedCode->put_FileName( CComBSTR(pszFileName) );
    	}
    
    	// XP SP2, calling with TRUE displays the warning dialog that is displayed
    	// when you run an EXE you just downloaded.
    	// THIS DOES NOT DO THE ACTUAL CHECK - SetFileName does
    	HRESULT Verify(BOOL bAllowWindowsPromptUI)
    	{
    		if( !m_spSignedCode )
    			return E_POINTER;
    		return m_spSignedCode->raw_Verify(bAllowWindowsPromptUI?VARIANT_TRUE:VARIANT_FALSE);
    	}
    
    	HRESULT GetDescription(CString& rstrDescription)
    	{
    		if( !m_spSignedCode )
    			return E_POINTER;
    		CComBSTR bs;
    		HRESULT hr = m_spSignedCode->get_Description(&bs);
    		if( SUCCEEDED(hr) )
    			rstrDescription = bs;
    		return hr;
    	}
    
    	HRESULT GetURL(CString& rstrDescriptionURL)
    	{
    		if( !m_spSignedCode )
    			return E_POINTER;
    		CComBSTR bs;
    		HRESULT hr = m_spSignedCode->get_DescriptionURL(&bs);
    		if( SUCCEEDED(hr) )
    			rstrDescriptionURL = bs;
    		return hr;
    	}
    
    	HRESULT GetFileName(CString& rstrFileName)
    	{
    		if( !m_spSignedCode )
    			return E_POINTER;
    		CComBSTR bs;
    		HRESULT hr = m_spSignedCode->get_FileName(&bs);
    		if( SUCCEEDED(hr) )
    			rstrFileName = bs;
    		return hr;
    	}
    };
    
    #endif //__SIGNED_CODE_H__
    
    C / C++ / MFC com cryptography question

  • WinVerifyTrust on legacy Win9x?
    J Jason De Arte

    I'm interested in finding a method to verify the digital signature of a file so that I'll know if it's been altered since I signed it. I looked at WinVerifyTrust(), but it only exists in NT/XP - not Win9x (which I still need to support). Microsoft does however have a tool called ChkTrust.exe Does anyone know "how" chktrust.exe works under win9x? [ Jason De Arte | Toy Maker | 1001010.com ]

    C / C++ / MFC com cryptography question

  • Flickering problem
    J Jason De Arte

    Jörgen Sigvardsson wrote: Say, you don't have a small dialog sample anywhere you'd like to show me, or better yet, write an article about it? When I have some time, I might write a small article - but it's realy easy to do for most controls (except group boxes) on your resizing dialog. 1. In your WM_ERASEBKGND handler... 2. Create a region of the client area 3. For each valid & visible child window you want to exclude, 3.a. create a region of that window (try GetWindowRgn, XP Themes tends to make buttons round) 3.b. remove the child region - CombineRgn(rgnChild,rgnDlg,RGN_XOR) 4. Paint your background, I use FillRgn 5. return TRUE from WM_ERASEBKGRND, or all your work will be undone. Minor details were left out, but you'll get the idea. [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL graphics help

  • Flickering problem
    J Jason De Arte

    While I've never had to do what you're doing, two things come to mind 1. Queue up the display of multiple windows with DeferWindowPos() 2. In the parent, change the erase background code to create a region that exclude the area of the child windows - I neat trick for dealing with excessive flickering when resizing a dialog. I hope this helps [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL graphics help

  • resize ATL activeX control
    J Jason De Arte

    I am as certain of that just as I am certain of my ability to spell the most common of words. constol d'oh! [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL c++ com help tutorial question

  • resize ATL activeX control
    J Jason De Arte

    However if your constol is being hosted in Internet Explorer - that won't work. ;-) The "trick" in IE is to find the IHTMLObjectElement that represents your ActiveX control & change it's height / width. This will cause IE to adjust it's layout & resize your ActiveX control's window. [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL c++ com help tutorial question

  • New game at H*R
    J Jason De Arte

    What do you mean one day ahead of Doom3? We just got it in the office. A co-worker of mine is reviewing it as I type this. http://pc.gamespy.com/pc/doom-3/535138p1.html[^] I just watched him play it - and I have only one word to describe it at this time - DARK. [ Jason De Arte | Toy Maker | 1001010.com ]

    The Lounge c++ html com game-dev lounge

  • MPOTD - Math Problem Of The Day
    J Jason De Arte

    the size of the triangle is undefined. the layout of the circles are undefined - we do not know if they stacked, everlapping or even touching? I say that they are stacked verticaly (like coins) over a triangle smaller than "diameter 1". [ Jason De Arte | Toy Maker | 1001010.com ]

    The Lounge tools csharp database com help

  • Where Did It Go?
    J Jason De Arte

    According to MSDN Knowledge Base Article #229889 titled "QuickView Command Is Missing from Windows 2000" CAUSE QuickView is not an installable option for Windows 2000. STATUS This behavior is by design. [ Jason De Arte | Toy Maker | 1001010.com ]

    The Lounge question adobe sysadmin tools

  • Some WTL - to MFC conversion help
    J Jason De Arte

    Ajnstajn wrote: 1. Tell me, or send me a good wtl tutorial Check out Michael Dunn's excelent series of "WTL for MFC Programmers" articles http://codeproject.com/wtl/wtl4mfc1.asp[^] Ajnstajn wrote: GetStockFont(DEFAULT_GUI_FONT)); You could try AtlGetStockFont(DEFAULT_GUI_FONT); If you look at it's source in atlmisc.h, you see that it's just a wrapper for ::GetStockObject() Ajnstajn wrote: 2.2. What about this? : CWnd* pWndOwner = GetOwner(); How should THIS ^ MFC line be written in WTL ? Well looking at the MFC source (it's always a good thing to install the MFC source when installing devstudio - you'll never know what you'll learn) CWnd::GetOwner looks like this

    _AFXWIN_INLINE CWnd* CWnd::GetOwner() const
    { return m_hWndOwner != NULL ? CWnd::FromHandle(m_hWndOwner) : GetParent(); }

    Depending on your situation, you could probably replace it with someing like CWindow wndOwner = GetParent(). Presuming that you are in a CWindow object ;-) Ajnstajn wrote: 'ASSERT': identifier not found Use ATLASSERT But seriously, check out Michael Dunn's articles, there all found in the WTL section here on CodeProject http://codeproject.com/wtl/index.asp#Beginners[^] You'll learn a lot. [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL c++ help question com tutorial

  • ATL experts, help! Navigating to a new page in an ATL Active X control
    J Jason De Arte

    d'oh! Updated. [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL c++ help tutorial com

  • Menu Ownerdraw and WindowFromDC
    J Jason De Arte

    And it always will. HMENU's are the resource of a window - and never a true user accessable window themselves. It has something to do with the way that windows internally deals with menus - somehow that bit of geek trivia is lost to me & forgotten. But I wouldn't wory about it, if you're doing an owner draw menu - all you need is the HDC anyways. If you need dimensions of the full menu for a side bar or something, I'd check out the multiple ownerdraw menu samples here on codeproject. [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL question

  • ATL experts, help! Navigating to a new page in an ATL Active X control
    J Jason De Arte

    You're on the right track. But missing one detail - IOleObject::GetClientSite Here's a code snip that I used in a recent ATL based ActiveX control to get the IHTMLDocument2 interface of the parent IE WebBrowser. Sure it goes a little farther than what you want by getting the document (one extra call), but it demonstrates the concept.

    inline HRESULT GetIEDocument(IOleObject* pObject, IHTMLDocument2 ** ppDocument2 )
    {
    CComPtr<IOleClientSite> spClientSite;
    CComPtr<IServiceProvider> spSrvProv;
    CComPtr<IWebBrowser2> spWebBrowser;
    CComPtr<IHTMLDocument2> spHTMLDoc2;

    // Param check
    if( !ppDocument2 || !pObject )
    {
    	ATLASSERT(!"Bad pointer param");
    	return E\_POINTER;
    }
    
    //
    // Dig our way up to the Document that contains us
    //
    HRESULT hr = pObject->GetClientSite((IOleClientSite \*\*)&spClientSite);
    if( FAILED(hr) )
    	return hr;
    
    hr = spClientSite->QueryInterface(IID\_IServiceProvider, (void \*\*)&spSrvProv);
    if( FAILED(hr) )
    	return hr;
    
    hr = spSrvProv->QueryService(SID\_SWebBrowserApp, IID\_IWebBrowser2, (void \*\*)&spWebBrowser);
    if( FAILED(hr) )
    	return hr;
    
    hr = spWebBrowser->get\_Document((LPDISPATCH\*)&spHTMLDoc2);
    if( FAILED(hr) )
    	return hr;
    
    //
    // All Done
    //
    (\*ppDocument2) = spHTMLDoc2;
    (\*ppDocument2)->AddRef();
    return S\_OK;
    

    }

    BTW, To the best of my knowlege ActiveX controls don't work in Nutscrape. Did you find a way for them to work? [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL c++ help tutorial com

  • Suicidal Tendencies
    J Jason De Arte

    Then you should check out the in-game radio stations[^] It just so happens that the editorial department and the programming department agreed on something here at GameSpy[^] It's a great game. That and it's predcessor GTA3 are the only reasons that I purchased a PS2 in the first place. [ Jason De Arte | Toy Maker | 1001010.com ]

    The Lounge question

  • Suicidal Tendencies
    J Jason De Arte

    Christian Graus wrote: I miss the 80's. Have you played Grand Theft Auto: Vice City[^]? Half the fun is the flashback [ Jason De Arte | Toy Maker | 1001010.com ]

    The Lounge question

  • (WTL) XP style password edit box
    J Jason De Arte

    I had the same problem a while back when I added a manifest to a MFC project - the password edit boxes had vertical lines instead of nice round circle characters. The issue was that the edit control had the wrong font associated with it. In that project I added the following in the dialogs OnInitDialog() function... GetDlgItem(IDC_EDIT_PASSWORD)->SetFont( CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)) ); In WTL, it might* look something like this... ::SendMessage(GetDlgItem(IDC_EDIT_PASSWORD), WM_SETFONT, (WPARAM)AtlGetStockFont(DEFAULT_GUI_FONT), MAKELPARAM(FALSE, 0)); *your mileage may vary [ Jason De Arte | Toy Maker | 1001010.com ]

    ATL / WTL / STL c++ question

  • the value of ESP was not properly saved across a function call.
    J Jason De Arte

    Some where, some place, there is a function declaration with the wrong calling convention. Imagine if you have an exposed function in a DLL that uses the __stdcall calling convention, but your function pointer is declared as __cdecl. Using the function pointer would cause this error. There's a brief MSDN Dr. GUI article on the topic http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui08072001.asp[^]

    ATL / WTL / STL c++ design help question

  • Restricting a BHO
    J Jason De Arte

    Well, you could just hook the browser events (onload,ondocumentcomplete,ect..) and then check the current document location before doing whatever you need to do.

    ATL / WTL / STL question algorithms testing beta-testing

  • IPersistPropertyBag/IPersistPropertyBagImpl question
    J Jason De Arte

    Whoops! :doh: **PROP_ENTRY**("test", 1, CLSID_NULL) Did I mention that individual milage may vary? ;)

    ATL / WTL / STL question help
  • Login

  • Don't have an account? Register

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