Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VARIANT structure

Posted on 1997-11-25
5
Medium Priority
?
692 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 100 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

718 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