Try the following modification that uses the SetShow method of PageBase class:
void hidewindows(char anfangsb)
{
Project pr;
PageBase pg;
string Source;
foreach (pg in pr.Pages)
{
pg.GetName(Source);
if (Source.GetAt(0) == anfangsb )
{
pg.SetShow(PAGE_HIDDEN);
}
}
}
P.S. Make sure you have the latest Origin update...select Help:Check for Updates.
OriginLab Technical Support