Solved

-# Internet Explorer creating offline sites #-

Posted on 2001-08-26
7
313 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IdTelnet1DataAvailable handler freezes the Application 4 62
Cross compile release version of c++ program for linux 2 129
Socket Programming (Unix) 8 118
C++ question 3 61
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

930 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

11 Experts available now in Live!

Get 1:1 Help Now