Solved

-# Internet Explorer creating offline sites #-

Posted on 2001-08-26
7
316 Views
Last Modified: 2008-03-17
I'm trying to create a offline site using the ISubscritpionMgr interface. The site should be synchronized every 12 hours.
I currently got stucked with the code below - I always get an "invalid parameter" error. I've no idea why.

void CSubscriptionMgr::SubcribeURL(CString strURL, CString strFiendlyName, TASK_TRIGGER_TYPE Interval, TRIGGER_TYPE_UNION IntervalSettings, int iStartHour, int iStartMinute)
{
     HRESULT hr;
     BSTR bstrURL;
     BSTR bstrName;
     SUBSCRIPTIONINFO sinfo;
    TASK_TRIGGER trig;
     SYSTEMTIME st;
     
     memset(&sinfo, 0, sizeof(sinfo));
     sinfo.cbSize = sizeof(sinfo);
     memset(&trig, 0, sizeof(trig));
     trig.cbTriggerSize = sizeof(trig);
     
     bstrURL = strURL.AllocSysString();
     bstrName = strFiendlyName.AllocSysString();

// Fill in current local date and time
     GetLocalTime(&st);
     trig.wBeginYear = st.wYear;
     trig.wBeginMonth = st.wMonth;
     trig.wBeginDay = st.wDay;
     trig.wStartHour = iStartHour;
     trig.wStartMinute = iStartMinute;
     trig.TriggerType = Interval;
     trig.Type = IntervalSettings;

     sinfo.fUpdateFlags = SUBSINFO_SCHEDULE | SUBSINFO_RECURSE | SUBSINFO_WEBCRAWL | SUBSINFO_TASKFLAGS | SUBSINFO_GLEAM | SUBSINFO_FRIENDLYNAME | SUBSINFO_NEEDPASSWORD | SUBSINFO_TYPE;
     sinfo.schedule = SUBSSCHED_WEEKLY; //SUBSSCHED_CUSTOM;
     sinfo.pTrigger = &trig;
     sinfo.dwRecurseLevels = 3;
     sinfo.fWebcrawlerFlags = WEBCRAWL_GET_IMAGES & WEBCRAWL_GET_VIDEOS & WEBCRAWL_GET_BGSOUNDS & WEBCRAWL_GET_CONTROLS;
     sinfo.bMailNotification = false;
     sinfo.bGleam = true;
     sinfo.bChangesOnly = false;
     sinfo.bNeedPassword = false;
     sinfo.fChannelFlags = 0; //CHANNEL_AGENT_PRECACHE_ALL;
     sinfo.bstrFriendlyName = bstrName;
     sinfo.dwMaxSizeKB = 500;
     sinfo.subType = SUBSTYPE_URL;
     sinfo.fTaskFlags = 1040; /////0000000000000
     sinfo.dwReserved = 0;
     
//     hr = pSubscriptionMgr->IsSubscribed(bstrURL, &Bool);
     hr = pSubscriptionMgr->CreateSubscription(NULL,
                                        bstrURL,
                                        bstrName,
                                        CREATESUBS_NOUI | CREATESUBS_ADDTOFAVORITES | CREATESUBS_FROMFAVORITES,
                                        SUBSTYPE_URL,
                                        &sinfo);
     SysFreeString (bstrURL);
     SysFreeString (bstrName);
     CheckHResult(hr);
}
0
Comment
Question by:ptmcomp
[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
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6433602
Did you check the sample at http://support.microsoft.com/support/kb/articles/Q264/4/60.ASP ?

BTW,

sinfo.fWebcrawlerFlags = WEBCRAWL_GET_IMAGES & WEBCRAWL_GET_VIDEOS & WEBCRAWL_GET_BGSOUNDS & WEBCRAWL_GET_CONTROLS;

should probably read

sinfo.fWebcrawlerFlags = WEBCRAWL_GET_IMAGES | WEBCRAWL_GET_VIDEOS | WEBCRAWL_GET_BGSOUNDS | WEBCRAWL_GET_CONTROLS;

(to combine bitflags, you have to use the bitwise 'or', not the bitwise 'and')
0
 
LVL 10

Author Comment

by:ptmcomp
ID: 6438580
Hi jkr

The MSDN sample above won't work since the trig structure is not correct initialized (cbSize is not set!).
I found out why my code didn't work. Whenever I set the pTrigger pointer, it failed. Actually I worked around by setting everything but the pTrigger pointer. Then I retrieve the cookie CLSID value and enumerate the triggers (ITaskScheduler interface) looking for same CLSID. Then I set the properties through the ITaskItem interface. This works for me. However if someone can tell me how to do this without this workaround, I still offer this 200 points.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6676602
ptmcomp:

You logged in as recently as November, but have not updated/finalized your open questions, many of which are very old.  You've asked 20 questions, but only graded/closed 10 of them.  I have updated all your open questions with this information so that you can easily navigate through the and finalize them.  

Here are the options:
 
1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.
 
2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.
 
3.  Ask Community Support to help split points between participating experts.  Just comment here with details.
 
4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.
 
If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  
 
PLEASE DO NOT AWARD THE POINTS TO ME.  
____________________________________________
 
 
Hi Experts:
 
In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.
 
Experts, please do not add further "answer" information to this question.  I will be back as quickly as I can to finalize this, if it remains open.
 
Thank you everyone.
 
Moondancer :)
Community Support Moderator @ Experts Exchange
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Author Comment

by:ptmcomp
ID: 6677123
No answer till now :o(
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6780422
ptmcomp,

These questions are still open and our records indicate you logged in as recently as today. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.

http://www.experts-exchange.com/jsp/qShow.jsp?qid=20114574
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20174312
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20114575
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20114691
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20154079
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20257617

EXPERTS: Please leave your thoughts on this question here.

Thanks,

Netminder
Community Support Moderator
Experts Exchange
0
 
LVL 10

Author Comment

by:ptmcomp
ID: 6784144
Still no answer :o(((
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 6821923
Points refunded and question closed.

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

733 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