BeforeNavigate2 event and PostData

This is a discussion on BeforeNavigate2 event and PostData within the Windows Programming forums, part of the Platform Specific Boards category; I'm capturing the BeforeNavigate2 event of a WebBrowser control and I tried to edit the PostData parameter from here, but ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102

    BeforeNavigate2 event and PostData

    I'm capturing the BeforeNavigate2 event of a WebBrowser control and I tried to edit the PostData parameter from here, but it won't send my updated data (just sends the original PostData).
    Code:
    void BeforeNavigate2(IDispatch *pDisp, VARIANT * url,VARIANT * Flags,VARIANT * TargetFrameName,
     VARIANT * PostData,VARIANT * Headers,  VARIANT_BOOL * Cancel) 
    {
    		SAFEARRAY* psa = (SAFEARRAY*)SendMessage(msgForward, WM_USER+0xdead,
    			(WPARAM)0, (LPARAM)PostData->pvarVal->parray); //retrieves modified post data into psa
    		SafeArrayCopyData(psa, PostData->pvarVal->parray); //applies the modified data
    }
    I've made sure it all works in debugger, isn't this the place where modifications of PostData before request can be made?
    Last edited by Overlord; 11-08-2008 at 07:48 PM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    According to the manual page - did you read it, or just assume what you were trying would work, the only thing this function can do is decide whether or not to allow the transfer.
    It does that by setting *Cancel = TRUE;

    Oh, and it says some other stuff as well.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102
    I didn't read it all, however, it would make much more sense if I could edit the variables in this function, instead of cancelling the current request and making another one, wouldn't it?

    Thanks for enlightening me on this.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21