Solved

VARIANT structure

Posted on 1997-11-25
5
688 Views
Last Modified: 2013-11-20
I am using function
HRESULT IWebBrowser::Navigate(
    BSTR URL,                     // URL to navigate to
    VARIANT FAR* Flags,           // addr of option flags
    VARIANT FAR* TargetFrameName, // addr of frame name
    VARIANT FAR* PostData,        // addr of http Postdata
    VARIANT FAR* Headers,         // addr of HTTP headers
);

and wand to set the second parameter Flags.
It can come from another enum structure called
BrowserNavConstants. Could anyone tell me how
to put the values in BrowserNavConstants into
Flags? What is wrong in my code as following?

IWebBrowser mSearch;
VARIANT *flgaddr;
BrowserNavConstants flg;
flgaddr=&flg; //Wrong! how to set?
m_search.Navigate(URL, flgaddr, NULL, NULL, NULL);

0
Comment
Question by:hbh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1310811
Try using

 IWebBrowser mSearch;
 VARIANT *flgaddr;
 BrowserNavConstants flg;
 COleVariant v;
 v = flg;
 flgaddr = v;
 m_search.Navigate(URL, flgaddr, NULL, NULL, NULL);


 

0
 

Author Comment

by:hbh
ID: 1310812
That doesn't work.
We can find, according to Help Information about the second
paramenter Flags:
"The variable can be a combination of the values defined by the
BrowserNavConstants enumeration." and

typedef enum BrowserNavConstants {
    navOpenInNewWindow = 1,
    navNoHistory = 2,
    navNoReadFromCache = 4,
    navNoWriteToCache = 8
} BrowserNavConstants;
which has been defined in Exdisp.h file.

However, the Flags is an address of VARIANT structure.
So I confuse about the two structures. Can anyone help me?  
hbh

0
 

Expert Comment

by:rakhras
ID: 1310813
Try the following:

IWebBrowser mSearch;
VARIANT varFlag;
BrowserNavConstants flg;

V_BYREF(&varFlag) = (void *) &flg;

m_search.Navigate(URL, &varFlag, NULL, NULL, NULL);
0
 

Expert Comment

by:rakhras
ID: 1310814
Oops, you must initialize your VARIANT, so go first::

VariantInit(&varFlag);
V_VT(&varFlag) = VT_BYREF;
V_BYREF(&varFlag) = (void *) &flg;

m_search.Navigate(URL, &varFlag, NULL, NULL, NULL);


0
 

Author Comment

by:hbh
ID: 1310815
Very good, it works. I think the Flag is long typ, so it
should be:
   VARIANT varFlag;
   BrowserNavConstants flg;
   flg = navNoHistory;
   VariantInit(&varFlag);
   V_VT(&varFlag) = VT_I4;
   V_I4REF(&varFlag) = (long *) &flg;
   m_search.Navigate(s_homepage, &varFlag, NULL, NULL, NULL);

However there is no any effct after "Flag" is set.
Acturally, here m_search is a WebBrowser control mumber variable.
Maybe this parameter is not effect to the Nevigate Method.
hbh.

0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question