Solved

-# Internet Explorer creating offline sites #-

Posted on 2001-08-26
7
312 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
7 Comments
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Author Comment

by:ptmcomp
Comment Utility
No answer till now :o(
0
 
LVL 5

Expert Comment

by:Netminder
Comment Utility
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
Comment Utility
Still no answer :o(((
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
Comment Utility
Points refunded and question closed.

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now