Problem Printing using IWebBrowser2 from IWAM Account on Server 2003

S

ScottLR

The code below successfully invokes printing from an ASP page.

If I run the code before a user manually logs in as the IWAM account, the
printer selection dialog is unfortunately displayed. If I have logged into
the IWAM account and logged out, then the printer selection dialog does not
display.

I do not want the printer selection dialog to display. Logging into the IWAM
account requires changing the account's password and is not an acceptable
solution. What must be done so that the printer selection dialog is
suppressed without requiring needing to log in as the IWAM account?

VARIANT parameter;
VariantInit(&parameter);
V_VT(&parameter) = VT_ARRAY | VT_BYREF;
V_ARRAY(&parameter) = parameter_array;

// start printing browser contents

hr =
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL);
 
S

Steven Cheng[MSFT]

Hi Scott,

Welcome to MSDN newsgroup.
From your description you're using some c++ unmanaged code to do printing
work for a web page. Also, you got some problem when printing, since
there'll occur the print setting dialog sometimes.

As for your problem, I'd like to confirm the following things:

1. Is your printing code running in a activex control or at serverside
through COM component in asp page?

2. If running in ActiveX control, since Activex Control is rich client
component which running at clientside, I think it won't care about the IWAM
account since IWAM account is a serverside account used to running IIS
application.

Please feel free to let me know if there're anything I misunderstand.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "ScottLR" <[email protected]>
| Subject: Problem Printing using IWebBrowser2 from IWAM Account on Server
2003
| Date: Wed, 14 Sep 2005 11:02:38 -0700
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| The code below successfully invokes printing from an ASP page.
|
| If I run the code before a user manually logs in as the IWAM account, the
| printer selection dialog is unfortunately displayed. If I have logged
into
| the IWAM account and logged out, then the printer selection dialog does
not
| display.
|
| I do not want the printer selection dialog to display. Logging into the
IWAM
| account requires changing the account's password and is not an acceptable
| solution. What must be done so that the printer selection dialog is
| suppressed without requiring needing to log in as the IWAM account?
|
| VARIANT parameter;
| VariantInit(&parameter);
| V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| V_ARRAY(&parameter) = parameter_array;
|
| // start printing browser contents
|
| hr =
|
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
);
|
|
|
 
S

ScottLR

Steven,

1. It is running serverside through a com component in an ASP page.

2. Agreed.

The issue can also be demonstrated as follows:

1. a new account is created on 2003 in the administrators group.

2. The administrator invokes cmd.exe using "run as" with the new account.

3. The code will display the printer selection dialog and prints
successfully.

4. The new account is used to log into 2003 server and logs out.

5. The administrator invokes cmd.exe using "run as" with the new account.

6 The code will NOT display the printer selection dialog and prints
successfully.
--

Thank you,

Scott
Software995 Support
 
S

Steven Cheng[MSFT]

Thanks for your response Scott,

OK. So you've used a custom COM component in your asp page(not asp.net
yes?) and try printing in that component, and there'll always occur printer
selection dialog if you haven't interactively logon through that service
account on the server yet ,yes?

One thing I'm still confused is since the ASP's page processing thread
running in a daemon process belonging to a non displayable windows station,
how could you see the Printer selection dialog? It's only possible for us
to see such UI in application running interactively or in a visible windows
station.

Anyway, from the symptom of the issue, I think it's likely due to the
USERPROFILE of your IWAM(or other custom account) account. when we
interactively logon , the certain user/account's User Profile is loaded,
then the Printer selection dialog won't appear. You can try using the
LoadUserProfile win32 API to manually load the userProfile of your
process's account to see whether it helps.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Thu, 15 Sep 2005 09:41:11 -0700
| Lines: 114
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven,
|
| 1. It is running serverside through a com component in an ASP page.
|
| 2. Agreed.
|
| The issue can also be demonstrated as follows:
|
| 1. a new account is created on 2003 in the administrators group.
|
| 2. The administrator invokes cmd.exe using "run as" with the new account.
|
| 3. The code will display the printer selection dialog and prints
| successfully.
|
| 4. The new account is used to log into 2003 server and logs out.
|
| 5. The administrator invokes cmd.exe using "run as" with the new account.
|
| 6 The code will NOT display the printer selection dialog and prints
| successfully.
| --
|
| Thank you,
|
| Scott
| Software995 Support
|
| | > Hi Scott,
| >
| > Welcome to MSDN newsgroup.
| > From your description you're using some c++ unmanaged code to do
printing
| > work for a web page. Also, you got some problem when printing, since
| > there'll occur the print setting dialog sometimes.
| >
| > As for your problem, I'd like to confirm the following things:
| >
| > 1. Is your printing code running in a activex control or at serverside
| > through COM component in asp page?
| >
| > 2. If running in ActiveX control, since Activex Control is rich client
| > component which running at clientside, I think it won't care about the
| > IWAM
| > account since IWAM account is a serverside account used to running IIS
| > application.
| >
| > Please feel free to let me know if there're anything I misunderstand.
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | Subject: Problem Printing using IWebBrowser2 from IWAM Account on
Server
| > 2003
| > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | Lines: 23
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | The code below successfully invokes printing from an ASP page.
| > |
| > | If I run the code before a user manually logs in as the IWAM account,
| > the
| > | printer selection dialog is unfortunately displayed. If I have logged
| > into
| > | the IWAM account and logged out, then the printer selection dialog
does
| > not
| > | display.
| > |
| > | I do not want the printer selection dialog to display. Logging into
the
| > IWAM
| > | account requires changing the account's password and is not an
| > acceptable
| > | solution. What must be done so that the printer selection dialog is
| > | suppressed without requiring needing to log in as the IWAM account?
| > |
| > | VARIANT parameter;
| > | VariantInit(&parameter);
| > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | V_ARRAY(&parameter) = parameter_array;
| > |
| > | // start printing browser contents
| > |
| > | hr =
| > |
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > );
| > |
| > |
| > |
| >
|
|
|
 
S

ScottLR

Steven,

We do not see the printer selection dialog. However, the process stops. We
know the dialog displays because when performing a "run as" with a user that
has not logged on manually, the printer selection dialog displays.

I am inclined to agree that running LoadUserProfile will solve the issue.
How can I run this for the IWAM account if I do not know its password?


Scott
 
S

Steven Cheng[MSFT]

Hi Scott,

The LoadUserProfile API will take an Handle object as input which represent
of the account's logon session token for which you'd like to load the user
profile.

BOOL LoadUserProfile(
HANDLE hToken,
LPPROFILEINFO lpProfileInfo
);

Also, we can get a Token object from the current running thread or process,
the following WIN32 api just provide such functionality:

BOOL OpenProcessToken(
HANDLE ProcessHandle,
DWORD DesiredAccess,
PHANDLE TokenHandle
);


bool OpenThreadToken(
DWORD dwDesiredAccess,
bool bImpersonate = false,
bool bOpenAsSelf = true,
SECURITY_IMPERSONATION_LEVEL sil = SecurityImpersonation
) throw(...);

Thus, we don't need to manually call logonUser API with cleartext
uesrname/password to establish a logon session/token

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)





--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Fri, 16 Sep 2005 08:48:32 -0700
| Lines: 197
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10864
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven,
|
| We do not see the printer selection dialog. However, the process stops.
We
| know the dialog displays because when performing a "run as" with a user
that
| has not logged on manually, the printer selection dialog displays.
|
| I am inclined to agree that running LoadUserProfile will solve the issue.
| How can I run this for the IWAM account if I do not know its password?
|
|
| Scott
|
| | > Thanks for your response Scott,
| >
| > OK. So you've used a custom COM component in your asp page(not asp.net
| > yes?) and try printing in that component, and there'll always occur
| > printer
| > selection dialog if you haven't interactively logon through that service
| > account on the server yet ,yes?
| >
| > One thing I'm still confused is since the ASP's page processing thread
| > running in a daemon process belonging to a non displayable windows
| > station,
| > how could you see the Printer selection dialog? It's only possible for
us
| > to see such UI in application running interactively or in a visible
| > windows
| > station.
| >
| > Anyway, from the symptom of the issue, I think it's likely due to the
| > USERPROFILE of your IWAM(or other custom account) account. when we
| > interactively logon , the certain user/account's User Profile is loaded,
| > then the Printer selection dialog won't appear. You can try using the
| > LoadUserProfile win32 API to manually load the userProfile of your
| > process's account to see whether it helps.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
| > Server 2003
| > | Date: Thu, 15 Sep 2005 09:41:11 -0700
| > | Lines: 114
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Steven,
| > |
| > | 1. It is running serverside through a com component in an ASP page.
| > |
| > | 2. Agreed.
| > |
| > | The issue can also be demonstrated as follows:
| > |
| > | 1. a new account is created on 2003 in the administrators group.
| > |
| > | 2. The administrator invokes cmd.exe using "run as" with the new
| > account.
| > |
| > | 3. The code will display the printer selection dialog and prints
| > | successfully.
| > |
| > | 4. The new account is used to log into 2003 server and logs out.
| > |
| > | 5. The administrator invokes cmd.exe using "run as" with the new
| > account.
| > |
| > | 6 The code will NOT display the printer selection dialog and prints
| > | successfully.
| > | --
| > |
| > | Thank you,
| > |
| > | Scott
| > | Software995 Support
| > |
| > | | > | > Hi Scott,
| > | >
| > | > Welcome to MSDN newsgroup.
| > | > From your description you're using some c++ unmanaged code to do
| > printing
| > | > work for a web page. Also, you got some problem when printing, since
| > | > there'll occur the print setting dialog sometimes.
| > | >
| > | > As for your problem, I'd like to confirm the following things:
| > | >
| > | > 1. Is your printing code running in a activex control or at
serverside
| > | > through COM component in asp page?
| > | >
| > | > 2. If running in ActiveX control, since Activex Control is rich
client
| > | > component which running at clientside, I think it won't care about
the
| > | > IWAM
| > | > account since IWAM account is a serverside account used to running
IIS
| > | > application.
| > | >
| > | > Please feel free to let me know if there're anything I
misunderstand.
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: "ScottLR" <[email protected]>
| > | > | Subject: Problem Printing using IWebBrowser2 from IWAM Account on
| > Server
| > | > 2003
| > | > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | > | Lines: 23
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > 63.201.229.153
| > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | The code below successfully invokes printing from an ASP page.
| > | > |
| > | > | If I run the code before a user manually logs in as the IWAM
| > account,
| > | > the
| > | > | printer selection dialog is unfortunately displayed. If I have
| > logged
| > | > into
| > | > | the IWAM account and logged out, then the printer selection dialog
| > does
| > | > not
| > | > | display.
| > | > |
| > | > | I do not want the printer selection dialog to display. Logging
into
| > the
| > | > IWAM
| > | > | account requires changing the account's password and is not an
| > | > acceptable
| > | > | solution. What must be done so that the printer selection dialog
is
| > | > | suppressed without requiring needing to log in as the IWAM
account?
| > | > |
| > | > | VARIANT parameter;
| > | > | VariantInit(&parameter);
| > | > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | > | V_ARRAY(&parameter) = parameter_array;
| > | > |
| > | > | // start printing browser contents
| > | > |
| > | > | hr =
| > | > |
| > | >
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > | > );
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
S

ScottLR

Hi Steven,

LoadUserProfile does not appear to help. I am testing as follows:
| > | 1. a new account is created on 2003 in the ADMINISTRATORS group.
| > |
| > | 2. The administrator invokes cmd.exe using "run as" with the new
| > account.
| > |
| > | 3. The code will display the printer selection dialog and prints
| > | successfully.
| > |
| > | 4. The new account is used to log into 2003 server and logs out.
| > |
| > | 5. The administrator invokes cmd.exe using "run as" with the new
| > account.
| > |
| > | 6 The code will NOT display the printer selection dialog and prints
| > | successfully.

I am successfully calling LoadUserProfile and then UnLoadUserProfile in the
process before attempting to print. The calls succeed. However, it still
fails to suppress the printer selection dialog., even if I try it again
afterwards. It appears, that something other than running LoadUserProfile
may be necessary to suppress the printer selection dialog when the
Webbrowser control is invoked from a process owned by a user who has not
logged on via control alt delete. Again, if I log in using control alt
delete, then the printer selection dialog does not display.

This is the code I am running to call LoadUserProfile. There do not appear
to be errors.

PROFILEINFO profileInfo;

ZeroMemory( &profileInfo, sizeof(profileInfo) );
profileInfo.dwSize = sizeof(profileInfo);


//memset(&profileInfo, 0, sizeof(PROFILEINFO));
//profileInfo.dwSize = sizeof(PROFILEINFO);

//strcpy(profileInfo.lpUserName, szUserName);
profileInfo.lpUserName = szUserName;
// profileInfo.lpUserName = "CVC";
profileInfo.dwFlags = PI_NOUI;

BOOL ret;

try
{
ret = LoadUserProfile(
hToken,
&profileInfo
);
}
catch(...)
{
DWORD err = GetLastError();
return FALSE;
}

if (ret == 0)
{
DWORD err = GetLastError();
int a = 1;
AfxMessageBox("failed");

}

// Unload the profile when it is no longer needed
if ( !UnloadUserProfile(
hToken, // token for the user
profileInfo.hProfile ) ) { // registry key handle
GetLastError();
}

--

Thank you,

Scott
 
S

Steven Cheng[MSFT]

Thanks Scott for you further followup.

OK. Seems the problem is concerned with something else in the serverside
printing. In my reviewing this thread, I saw that you've manually construct
a webbrowser component in your COM component's printing. Do you think it
convenient that you provide me a simple reproduce version of your COM
component or just the code that your construct the WEBbrowser control ,
navigate a certain page and printing? I'd like to perform some local tests
on it.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Mon, 19 Sep 2005 15:34:11 -0700
| Lines: 377
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10912
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Hi Steven,
|
| LoadUserProfile does not appear to help. I am testing as follows:
|
| > | > | 1. a new account is created on 2003 in the ADMINISTRATORS group.
| > | > |
| > | > | 2. The administrator invokes cmd.exe using "run as" with the new
| > | > account.
| > | > |
| > | > | 3. The code will display the printer selection dialog and prints
| > | > | successfully.
| > | > |
| > | > | 4. The new account is used to log into 2003 server and logs out.
| > | > |
| > | > | 5. The administrator invokes cmd.exe using "run as" with the new
| > | > account.
| > | > |
| > | > | 6 The code will NOT display the printer selection dialog and
prints
| > | > | successfully.
|
| I am successfully calling LoadUserProfile and then UnLoadUserProfile in
the
| process before attempting to print. The calls succeed. However, it still
| fails to suppress the printer selection dialog., even if I try it again
| afterwards. It appears, that something other than running LoadUserProfile
| may be necessary to suppress the printer selection dialog when the
| Webbrowser control is invoked from a process owned by a user who has not
| logged on via control alt delete. Again, if I log in using control alt
| delete, then the printer selection dialog does not display.
|
| This is the code I am running to call LoadUserProfile. There do not
appear
| to be errors.
|
| PROFILEINFO profileInfo;
|
| ZeroMemory( &profileInfo, sizeof(profileInfo) );
| profileInfo.dwSize = sizeof(profileInfo);
|
|
| //memset(&profileInfo, 0, sizeof(PROFILEINFO));
| //profileInfo.dwSize = sizeof(PROFILEINFO);
|
| //strcpy(profileInfo.lpUserName, szUserName);
| profileInfo.lpUserName = szUserName;
| // profileInfo.lpUserName = "CVC";
| profileInfo.dwFlags = PI_NOUI;
|
| BOOL ret;
|
| try
| {
| ret = LoadUserProfile(
| hToken,
| &profileInfo
| );
| }
| catch(...)
| {
| DWORD err = GetLastError();
| return FALSE;
| }
|
| if (ret == 0)
| {
| DWORD err = GetLastError();
| int a = 1;
| AfxMessageBox("failed");
|
| }
|
| // Unload the profile when it is no longer needed
| if ( !UnloadUserProfile(
| hToken, // token for the user
| profileInfo.hProfile ) ) { // registry key handle
| GetLastError();
| }
|
| --
|
| Thank you,
|
| Scott
|
| | > Hi Scott,
| >
| > The LoadUserProfile API will take an Handle object as input which
| > represent
| > of the account's logon session token for which you'd like to load the
user
| > profile.
| >
| > BOOL LoadUserProfile(
| > HANDLE hToken,
| > LPPROFILEINFO lpProfileInfo
| > );
| >
| > Also, we can get a Token object from the current running thread or
| > process,
| > the following WIN32 api just provide such functionality:
| >
| > BOOL OpenProcessToken(
| > HANDLE ProcessHandle,
| > DWORD DesiredAccess,
| > PHANDLE TokenHandle
| > );
| >
| >
| > bool OpenThreadToken(
| > DWORD dwDesiredAccess,
| > bool bImpersonate = false,
| > bool bOpenAsSelf = true,
| > SECURITY_IMPERSONATION_LEVEL sil = SecurityImpersonation
| > ) throw(...);
| >
| > Thus, we don't need to manually call logonUser API with cleartext
| > uesrname/password to establish a logon session/token
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <#[email protected]>
| > <[email protected]>
| > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
| > Server 2003
| > | Date: Fri, 16 Sep 2005 08:48:32 -0700
| > | Lines: 197
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10864
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Steven,
| > |
| > | We do not see the printer selection dialog. However, the process
stops.
| > We
| > | know the dialog displays because when performing a "run as" with a
user
| > that
| > | has not logged on manually, the printer selection dialog displays.
| > |
| > | I am inclined to agree that running LoadUserProfile will solve the
| > issue.
| > | How can I run this for the IWAM account if I do not know its password?
| > |
| > |
| > | Scott
| > |
| > | | > | > Thanks for your response Scott,
| > | >
| > | > OK. So you've used a custom COM component in your asp page(not
asp.net
| > | > yes?) and try printing in that component, and there'll always occur
| > | > printer
| > | > selection dialog if you haven't interactively logon through that
| > service
| > | > account on the server yet ,yes?
| > | >
| > | > One thing I'm still confused is since the ASP's page processing
thread
| > | > running in a daemon process belonging to a non displayable windows
| > | > station,
| > | > how could you see the Printer selection dialog? It's only possible
for
| > us
| > | > to see such UI in application running interactively or in a visible
| > | > windows
| > | > station.
| > | >
| > | > Anyway, from the symptom of the issue, I think it's likely due to
the
| > | > USERPROFILE of your IWAM(or other custom account) account. when we
| > | > interactively logon , the certain user/account's User Profile is
| > loaded,
| > | > then the Printer selection dialog won't appear. You can try using
the
| > | > LoadUserProfile win32 API to manually load the userProfile of your
| > | > process's account to see whether it helps.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | > --------------------
| > | > | From: "ScottLR" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
Account
| > on
| > | > Server 2003
| > | > | Date: Thu, 15 Sep 2005 09:41:11 -0700
| > | > | Lines: 114
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <#[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > 63.201.229.153
| > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | Steven,
| > | > |
| > | > | 1. It is running serverside through a com component in an ASP
page.
| > | > |
| > | > | 2. Agreed.
| > | > |
| > | > | The issue can also be demonstrated as follows:
| > | > |
| > | > | 1. a new account is created on 2003 in the administrators group.
| > | > |
| > | > | 2. The administrator invokes cmd.exe using "run as" with the new
| > | > account.
| > | > |
| > | > | 3. The code will display the printer selection dialog and prints
| > | > | successfully.
| > | > |
| > | > | 4. The new account is used to log into 2003 server and logs out.
| > | > |
| > | > | 5. The administrator invokes cmd.exe using "run as" with the new
| > | > account.
| > | > |
| > | > | 6 The code will NOT display the printer selection dialog and
prints
| > | > | successfully.
| > | > | --
| > | > |
| > | > | Thank you,
| > | > |
| > | > | Scott
| > | > | Software995 Support
| > | > |
message
| > | > | | > | > | > Hi Scott,
| > | > | >
| > | > | > Welcome to MSDN newsgroup.
| > | > | > From your description you're using some c++ unmanaged code to do
| > | > printing
| > | > | > work for a web page. Also, you got some problem when printing,
| > since
| > | > | > there'll occur the print setting dialog sometimes.
| > | > | >
| > | > | > As for your problem, I'd like to confirm the following things:
| > | > | >
| > | > | > 1. Is your printing code running in a activex control or at
| > serverside
| > | > | > through COM component in asp page?
| > | > | >
| > | > | > 2. If running in ActiveX control, since Activex Control is rich
| > client
| > | > | > component which running at clientside, I think it won't care
about
| > the
| > | > | > IWAM
| > | > | > account since IWAM account is a serverside account used to
running
| > IIS
| > | > | > application.
| > | > | >
| > | > | > Please feel free to let me know if there're anything I
| > misunderstand.
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | >
| > | > | >
| > | > | >
| > | > | > --------------------
| > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | Subject: Problem Printing using IWebBrowser2 from IWAM
Account
| > on
| > | > Server
| > | > | > 2003
| > | > | > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | > | > | Lines: 23
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > 63.201.229.153
| > | > | > | Path:
| > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | > | > | X-Tomcat-NG:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > |
| > | > | > | The code below successfully invokes printing from an ASP page.
| > | > | > |
| > | > | > | If I run the code before a user manually logs in as the IWAM
| > | > account,
| > | > | > the
| > | > | > | printer selection dialog is unfortunately displayed. If I have
| > | > logged
| > | > | > into
| > | > | > | the IWAM account and logged out, then the printer selection
| > dialog
| > | > does
| > | > | > not
| > | > | > | display.
| > | > | > |
| > | > | > | I do not want the printer selection dialog to display. Logging
| > into
| > | > the
| > | > | > IWAM
| > | > | > | account requires changing the account's password and is not an
| > | > | > acceptable
| > | > | > | solution. What must be done so that the printer selection
dialog
| > is
| > | > | > | suppressed without requiring needing to log in as the IWAM
| > account?
| > | > | > |
| > | > | > | VARIANT parameter;
| > | > | > | VariantInit(&parameter);
| > | > | > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | > | > | V_ARRAY(&parameter) = parameter_array;
| > | > | > |
| > | > | > | // start printing browser contents
| > | > | > |
| > | > | > | hr =
| > | > | > |
| > | > | >
| > | >
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > | > | > );
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
S

ScottLR

Steven,

I have determined the problem is that there is no default printer. The api
call SetDefaultPrinter fails until the user has logged on with
control-alt-delete. Try creating a user, do a run as to start notepad.
Select print. You will not be able to specify a default printer.

Thank you for your help.

-Scott
 
S

Steven Cheng[MSFT]

Thanks for your response Scott,

I think the lack of a default printer sounds reasonable. Also, as you
mentioned that directly call SetDefaultPrinter in your ASP environment ,
I'm thinking whether it is still caused by No UserProfile for the daemon
logon session of the ASP process account? Have you tried call the
LoadUserProfile first before calling the SetDefaultPrinter?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Tue, 20 Sep 2005 10:48:48 -0700
| Lines: 476
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10932
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven,
|
| I have determined the problem is that there is no default printer. The
api
| call SetDefaultPrinter fails until the user has logged on with
| control-alt-delete. Try creating a user, do a run as to start notepad.
| Select print. You will not be able to specify a default printer.
|
| Thank you for your help.
|
| -Scott
|
| | > Thanks Scott for you further followup.
| >
| > OK. Seems the problem is concerned with something else in the serverside
| > printing. In my reviewing this thread, I saw that you've manually
| > construct
| > a webbrowser component in your COM component's printing. Do you think it
| > convenient that you provide me a simple reproduce version of your COM
| > component or just the code that your construct the WEBbrowser control ,
| > navigate a certain page and printing? I'd like to perform some local
tests
| > on it.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <#[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
| > Server 2003
| > | Date: Mon, 19 Sep 2005 15:34:11 -0700
| > | Lines: 377
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10912
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Hi Steven,
| > |
| > | LoadUserProfile does not appear to help. I am testing as follows:
| > |
| > | > | > | 1. a new account is created on 2003 in the ADMINISTRATORS
group.
| > | > | > |
| > | > | > | 2. The administrator invokes cmd.exe using "run as" with the
new
| > | > | > account.
| > | > | > |
| > | > | > | 3. The code will display the printer selection dialog and
prints
| > | > | > | successfully.
| > | > | > |
| > | > | > | 4. The new account is used to log into 2003 server and logs
out.
| > | > | > |
| > | > | > | 5. The administrator invokes cmd.exe using "run as" with the
new
| > | > | > account.
| > | > | > |
| > | > | > | 6 The code will NOT display the printer selection dialog and
| > prints
| > | > | > | successfully.
| > |
| > | I am successfully calling LoadUserProfile and then UnLoadUserProfile
in
| > the
| > | process before attempting to print. The calls succeed. However, it
still
| > | fails to suppress the printer selection dialog., even if I try it
again
| > | afterwards. It appears, that something other than running
| > LoadUserProfile
| > | may be necessary to suppress the printer selection dialog when the
| > | Webbrowser control is invoked from a process owned by a user who has
not
| > | logged on via control alt delete. Again, if I log in using control alt
| > | delete, then the printer selection dialog does not display.
| > |
| > | This is the code I am running to call LoadUserProfile. There do not
| > appear
| > | to be errors.
| > |
| > | PROFILEINFO profileInfo;
| > |
| > | ZeroMemory( &profileInfo, sizeof(profileInfo) );
| > | profileInfo.dwSize = sizeof(profileInfo);
| > |
| > |
| > | //memset(&profileInfo, 0, sizeof(PROFILEINFO));
| > | //profileInfo.dwSize = sizeof(PROFILEINFO);
| > |
| > | //strcpy(profileInfo.lpUserName, szUserName);
| > | profileInfo.lpUserName = szUserName;
| > | // profileInfo.lpUserName = "CVC";
| > | profileInfo.dwFlags = PI_NOUI;
| > |
| > | BOOL ret;
| > |
| > | try
| > | {
| > | ret = LoadUserProfile(
| > | hToken,
| > | &profileInfo
| > | );
| > | }
| > | catch(...)
| > | {
| > | DWORD err = GetLastError();
| > | return FALSE;
| > | }
| > |
| > | if (ret == 0)
| > | {
| > | DWORD err = GetLastError();
| > | int a = 1;
| > | AfxMessageBox("failed");
| > |
| > | }
| > |
| > | // Unload the profile when it is no longer needed
| > | if ( !UnloadUserProfile(
| > | hToken, // token for the user
| > | profileInfo.hProfile ) ) { // registry key handle
| > | GetLastError();
| > | }
| > |
| > | --
| > |
| > | Thank you,
| > |
| > | Scott
| > |
| > | | > | > Hi Scott,
| > | >
| > | > The LoadUserProfile API will take an Handle object as input which
| > | > represent
| > | > of the account's logon session token for which you'd like to load
the
| > user
| > | > profile.
| > | >
| > | > BOOL LoadUserProfile(
| > | > HANDLE hToken,
| > | > LPPROFILEINFO lpProfileInfo
| > | > );
| > | >
| > | > Also, we can get a Token object from the current running thread or
| > | > process,
| > | > the following WIN32 api just provide such functionality:
| > | >
| > | > BOOL OpenProcessToken(
| > | > HANDLE ProcessHandle,
| > | > DWORD DesiredAccess,
| > | > PHANDLE TokenHandle
| > | > );
| > | >
| > | >
| > | > bool OpenThreadToken(
| > | > DWORD dwDesiredAccess,
| > | > bool bImpersonate = false,
| > | > bool bOpenAsSelf = true,
| > | > SECURITY_IMPERSONATION_LEVEL sil = SecurityImpersonation
| > | > ) throw(...);
| > | >
| > | > Thus, we don't need to manually call logonUser API with cleartext
| > | > uesrname/password to establish a logon session/token
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: "ScottLR" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <#[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
Account
| > on
| > | > Server 2003
| > | > | Date: Fri, 16 Sep 2005 08:48:32 -0700
| > | > | Lines: 197
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > 63.201.229.153
| > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10864
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | Steven,
| > | > |
| > | > | We do not see the printer selection dialog. However, the process
| > stops.
| > | > We
| > | > | know the dialog displays because when performing a "run as" with a
| > user
| > | > that
| > | > | has not logged on manually, the printer selection dialog displays.
| > | > |
| > | > | I am inclined to agree that running LoadUserProfile will solve the
| > | > issue.
| > | > | How can I run this for the IWAM account if I do not know its
| > password?
| > | > |
| > | > |
| > | > | Scott
| > | > |
message
| > | > | | > | > | > Thanks for your response Scott,
| > | > | >
| > | > | > OK. So you've used a custom COM component in your asp page(not
| > asp.net
| > | > | > yes?) and try printing in that component, and there'll always
| > occur
| > | > | > printer
| > | > | > selection dialog if you haven't interactively logon through that
| > | > service
| > | > | > account on the server yet ,yes?
| > | > | >
| > | > | > One thing I'm still confused is since the ASP's page processing
| > thread
| > | > | > running in a daemon process belonging to a non displayable
windows
| > | > | > station,
| > | > | > how could you see the Printer selection dialog? It's only
possible
| > for
| > | > us
| > | > | > to see such UI in application running interactively or in a
| > visible
| > | > | > windows
| > | > | > station.
| > | > | >
| > | > | > Anyway, from the symptom of the issue, I think it's likely due
to
| > the
| > | > | > USERPROFILE of your IWAM(or other custom account) account. when
we
| > | > | > interactively logon , the certain user/account's User Profile is
| > | > loaded,
| > | > | > then the Printer selection dialog won't appear. You can try
using
| > the
| > | > | > LoadUserProfile win32 API to manually load the userProfile of
your
| > | > | > process's account to see whether it helps.
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | >
| > | > | >
| > | > | > --------------------
| > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > <[email protected]>
| > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
| > Account
| > | > on
| > | > | > Server 2003
| > | > | > | Date: Thu, 15 Sep 2005 09:41:11 -0700
| > | > | > | Lines: 114
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | Message-ID: <#[email protected]>
| > | > | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > 63.201.229.153
| > | > | > | Path:
| > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| > | > | > | X-Tomcat-NG:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > |
| > | > | > | Steven,
| > | > | > |
| > | > | > | 1. It is running serverside through a com component in an ASP
| > page.
| > | > | > |
| > | > | > | 2. Agreed.
| > | > | > |
| > | > | > | The issue can also be demonstrated as follows:
| > | > | > |
| > | > | > | 1. a new account is created on 2003 in the administrators
group.
| > | > | > |
| > | > | > | 2. The administrator invokes cmd.exe using "run as" with the
new
| > | > | > account.
| > | > | > |
| > | > | > | 3. The code will display the printer selection dialog and
prints
| > | > | > | successfully.
| > | > | > |
| > | > | > | 4. The new account is used to log into 2003 server and logs
out.
| > | > | > |
| > | > | > | 5. The administrator invokes cmd.exe using "run as" with the
new
| > | > | > account.
| > | > | > |
| > | > | > | 6 The code will NOT display the printer selection dialog and
| > prints
| > | > | > | successfully.
| > | > | > | --
| > | > | > |
| > | > | > | Thank you,
| > | > | > |
| > | > | > | Scott
| > | > | > | Software995 Support
| > | > | > |
| > message
| > | > | > | | > | > | > | > Hi Scott,
| > | > | > | >
| > | > | > | > Welcome to MSDN newsgroup.
| > | > | > | > From your description you're using some c++ unmanaged code
to
| > do
| > | > | > printing
| > | > | > | > work for a web page. Also, you got some problem when
printing,
| > | > since
| > | > | > | > there'll occur the print setting dialog sometimes.
| > | > | > | >
| > | > | > | > As for your problem, I'd like to confirm the following
things:
| > | > | > | >
| > | > | > | > 1. Is your printing code running in a activex control or at
| > | > serverside
| > | > | > | > through COM component in asp page?
| > | > | > | >
| > | > | > | > 2. If running in ActiveX control, since Activex Control is
| > rich
| > | > client
| > | > | > | > component which running at clientside, I think it won't care
| > about
| > | > the
| > | > | > | > IWAM
| > | > | > | > account since IWAM account is a serverside account used to
| > running
| > | > IIS
| > | > | > | > application.
| > | > | > | >
| > | > | > | > Please feel free to let me know if there're anything I
| > | > misunderstand.
| > | > | > | > Thanks,
| > | > | > | >
| > | > | > | > Steven Cheng
| > | > | > | > Microsoft Online Support
| > | > | > | >
| > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > (This posting is provided "AS IS", with no warranties, and
| > confers
| > | > no
| > | > | > | > rights.)
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | > --------------------
| > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | Subject: Problem Printing using IWebBrowser2 from IWAM
| > Account
| > | > on
| > | > | > Server
| > | > | > | > 2003
| > | > | > | > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | > | > | > | Lines: 23
| > | > | > | > | X-Priority: 3
| > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | Message-ID: <[email protected]>
| > | > | > | > | Newsgroups:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | NNTP-Posting-Host:
| > adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > 63.201.229.153
| > | > | > | > | Path:
| > | > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | > | > | > | X-Tomcat-NG:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > |
| > | > | > | > | The code below successfully invokes printing from an ASP
| > page.
| > | > | > | > |
| > | > | > | > | If I run the code before a user manually logs in as the
IWAM
| > | > | > account,
| > | > | > | > the
| > | > | > | > | printer selection dialog is unfortunately displayed. If I
| > have
| > | > | > logged
| > | > | > | > into
| > | > | > | > | the IWAM account and logged out, then the printer
selection
| > | > dialog
| > | > | > does
| > | > | > | > not
| > | > | > | > | display.
| > | > | > | > |
| > | > | > | > | I do not want the printer selection dialog to display.
| > Logging
| > | > into
| > | > | > the
| > | > | > | > IWAM
| > | > | > | > | account requires changing the account's password and is
not
| > an
| > | > | > | > acceptable
| > | > | > | > | solution. What must be done so that the printer selection
| > dialog
| > | > is
| > | > | > | > | suppressed without requiring needing to log in as the IWAM
| > | > account?
| > | > | > | > |
| > | > | > | > | VARIANT parameter;
| > | > | > | > | VariantInit(&parameter);
| > | > | > | > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | > | > | > | V_ARRAY(&parameter) = parameter_array;
| > | > | > | > |
| > | > | > | > | // start printing browser contents
| > | > | > | > |
| > | > | > | > | hr =
| > | > | > | > |
| > | > | > | >
| > | > | >
| > | >
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > | > | > | > );
| > | > | > | > |
| > | > | > | > |
| > | > | > | > |
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
S

Steven Cheng[MSFT]

Nevermind Scott,

Since this is a programmatical specific issue, if you still need any
assistance from us, plesase feel free to post here or in other programmatic
related newsgroup. Also, if convenient, I'd suggest you provide the
complete code list of your COMponent which construct the webbrowser
component instance and call its printing funciton.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Wed, 21 Sep 2005 17:16:26 -0700
| Lines: 1495
| MIME-Version: 1.0
| Content-Type: multipart/alternative;
| boundary="----=_NextPart_000_01D7_01C5BED0.334FF400"
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10960
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven,
| Yes. I did that to no avail. I have posted a new message to
| microsoft.public.windowsxp.print_fax and am awaiting a reply.
| Thank you for all of your help,
| Scott
| > Thanks for your response Scott,
| >
| > I think the lack of a default printer sounds reasonable. Also, as you
| > mentioned that directly call SetDefaultPrinter in your ASP environment
,
| > I'm thinking whether it is still caused by No UserProfile for the
daemon
| > logon session of the ASP process account? Have you tried call the
| > LoadUserProfile first before calling the SetDefaultPrinter?
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <#[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
| > Server 2003
| > | Date: Tue, 20 Sep 2005 10:48:48 -0700
| > | Lines: 476
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10932
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Steven,
| > |
| > | I have determined the problem is that there is no default printer.
The
| > api
| > | call SetDefaultPrinter fails until the user has logged on with
| > | control-alt-delete. Try creating a user, do a run as to start
notepad.
| > | Select print. You will not be able to specify a default printer.
| > |
| > | Thank you for your help.
| > |
| > | -Scott
| > |
| > | "Steven Cheng said:
| > | > Thanks Scott for you further followup.
| > | >
| > | > OK. Seems the problem is concerned with something else in the
serverside
| > | > printing. In my reviewing this thread, I saw that you've manually
| > | > construct
| > | > a webbrowser component in your COM component's printing. Do you
think it
| > | > convenient that you provide me a simple reproduce version of your
COM
| > | > component or just the code that your construct the WEBbrowser
control ,
| > | > navigate a certain page and printing? I'd like to perform some
local
| > tests
| > | > on it.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | > --------------------
| > | > | From: "ScottLR" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <#[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
Account on
| > | > Server 2003
| > | > | Date: Mon, 19 Sep 2005 15:34:11 -0700
| > | > | Lines: 377
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > 63.201.229.153
| > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10912
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | Hi Steven,
| > | > |
| > | > | LoadUserProfile does not appear to help. I am testing as follows:
| > | > |
| > | > | > | > | 1. a new account is created on 2003 in the ADMINISTRATORS
| > group.
| > | > | > | > |
| > | > | > | > | 2. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 3. The code will display the printer selection dialog and
| > prints
| > | > | > | > | successfully.
| > | > | > | > |
| > | > | > | > | 4. The new account is used to log into 2003 server and
logs
| > out.
| > | > | > | > |
| > | > | > | > | 5. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 6 The code will NOT display the printer selection dialog
and
| > | > prints
| > | > | > | > | successfully.
| > | > |
| > | > | I am successfully calling LoadUserProfile and then
UnLoadUserProfile
| > in
| > | > the
| > | > | process before attempting to print. The calls succeed. However,
it
| > still
| > | > | fails to suppress the printer selection dialog., even if I try it
| > again
| > | > | afterwards. It appears, that something other than running
| > | > LoadUserProfile
| > | > | may be necessary to suppress the printer selection dialog when the
| > | > | Webbrowser control is invoked from a process owned by a user who
has
| > not
| > | > | logged on via control alt delete. Again, if I log in using
control alt
| > | > | delete, then the printer selection dialog does not display.
| > | > |
| > | > | This is the code I am running to call LoadUserProfile. There do
not
| > | > appear
| > | > | to be errors.
| > | > |
| > | > | PROFILEINFO profileInfo;
| > | > |
| > | > | ZeroMemory( &profileInfo, sizeof(profileInfo) );
| > | > | profileInfo.dwSize = sizeof(profileInfo);
| > | > |
| > | > |
| > | > | //memset(&profileInfo, 0, sizeof(PROFILEINFO));
| > | > | //profileInfo.dwSize = sizeof(PROFILEINFO);
| > | > |
| > | > | //strcpy(profileInfo.lpUserName, szUserName);
| > | > | profileInfo.lpUserName = szUserName;
| > | > | // profileInfo.lpUserName = "CVC";
| > | > | profileInfo.dwFlags = PI_NOUI;
| > | > |
| > | > | BOOL ret;
| > | > |
| > | > | try
| > | > | {
| > | > | ret = LoadUserProfile(
| > | > | hToken,
| > | > | &profileInfo
| > | > | );
| > | > | }
| > | > | catch(...)
| > | > | {
| > | > | DWORD err = GetLastError();
| > | > | return FALSE;
| > | > | }
| > | > |
| > | > | if (ret == 0)
| > | > | {
| > | > | DWORD err = GetLastError();
| > | > | int a = 1;
| > | > | AfxMessageBox("failed");
| > | > |
| > | > | }
| > | > |
| > | > | // Unload the profile when it is no longer needed
| > | > | if ( !UnloadUserProfile(
| > | > | hToken, // token for the user
| > | > | profileInfo.hProfile ) ) { // registry key handle
| > | > | GetLastError();
| > | > | }
| > | > |
| > | > | --
| > | > |
| > | > | Thank you,
| > | > |
| > | > | Scott
| > | > |
message
| > | > | | > | > | > Hi Scott,
| > | > | >
| > | > | > The LoadUserProfile API will take an Handle object as input
which
| > | > | > represent
| > | > | > of the account's logon session token for which you'd like to
load
| > the
| > | > user
| > | > | > profile.
| > | > | >
| > | > | > BOOL LoadUserProfile(
| > | > | > HANDLE hToken,
| > | > | > LPPROFILEINFO lpProfileInfo
| > | > | > );
| > | > | >
| > | > | > Also, we can get a Token object from the current running thread
or
| > | > | > process,
| > | > | > the following WIN32 api just provide such functionality:
| > | > | >
| > | > | > BOOL OpenProcessToken(
| > | > | > HANDLE ProcessHandle,
| > | > | > DWORD DesiredAccess,
| > | > | > PHANDLE TokenHandle
| > | > | > );
| > | > | >
| > | > | >
| > | > | > bool OpenThreadToken(
| > | > | > DWORD dwDesiredAccess,
| > | > | > bool bImpersonate = false,
| > | > | > bool bOpenAsSelf = true,
| > | > | > SECURITY_IMPERSONATION_LEVEL sil = SecurityImpersonation
| > | > | > ) throw(...);
| > | > | >
| > | > | > Thus, we don't need to manually call logonUser API with
cleartext
| > | > | > uesrname/password to establish a logon session/token
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > --------------------
| > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > <[email protected]>
| > | > | > <#[email protected]>
| > | > | > <[email protected]>
| > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
| > Account
| > | > on
| > | > | > Server 2003
| > | > | > | Date: Fri, 16 Sep 2005 08:48:32 -0700
| > | > | > | Lines: 197
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > 63.201.229.153
| > | > | > | Path:
| > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10864
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > |
| > | > | > | Steven,
| > | > | > |
| > | > | > | We do not see the printer selection dialog. However, the
process
| > | > stops.
| > | > | > We
| > | > | > | know the dialog displays because when performing a "run as"
with a
| > | > user
| > | > | > that
| > | > | > | has not logged on manually, the printer selection dialog
displays.
| > | > | > |
| > | > | > | I am inclined to agree that running LoadUserProfile will
solve the
| > | > | > issue.
| > | > | > | How can I run this for the IWAM account if I do not know its
| > password?
| > | > | > |
| > | > | > |
| > | > | > | Scott
| > | > | > |
| > | > | > | "Steven Cheng said:
| > | > | > | | > | > | > | > Thanks for your response Scott,
| > | > | > | >
| > | > | > | > OK. So you've used a custom COM component in your asp
page(not
| > | > asp.net
| > | > | > | > yes?) and try printing in that component, and there'll
always
| > | > occur
| > | > | > | > printer
| > | > | > | > selection dialog if you haven't interactively logon through
that
| > | > | > service
| > | > | > | > account on the server yet ,yes?
| > | > | > | >
| > | > | > | > One thing I'm still confused is since the ASP's page
processing
| > | > thread
| > | > | > | > running in a daemon process belonging to a non displayable
| > | > | > | > station,
| > | > | > | > how could you see the Printer selection dialog? It's only
| > possible
| > | > for
| > | > | > us
| > | > | > | > to see such UI in application running interactively or in a
| > | > visible
| > | > | > | > windows
| > | > | > | > station.
| > | > | > | >
| > | > | > | > Anyway, from the symptom of the issue, I think it's likely
due
| > to
| > | > the
| > | > | > | > USERPROFILE of your IWAM(or other custom account) account.
when
| > we
| > | > | > | > interactively logon , the certain user/account's User
Profile is
| > | > | > loaded,
| > | > | > | > then the Printer selection dialog won't appear. You can
try
| > using
| > | > the
| > | > | > | > LoadUserProfile win32 API to manually load the userProfile
of
| > your
| > | > | > | > process's account to see whether it helps.
| > | > | > | >
| > | > | > | > Thanks,
| > | > | > | >
| > | > | > | > Steven Cheng
| > | > | > | > Microsoft Online Support
| > | > | > | >
| > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > (This posting is provided "AS IS", with no warranties, and
| > | > no
| > | > | > | > rights.)
| > | > | > | >
| > | > | > | >
| > | > | > | > --------------------
| > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | References: <[email protected]>
| > | > | > | > <[email protected]>
| > | > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
| > | > Account
| > | > | > on
| > | > | > | > Server 2003
| > | > | > | > | Date: Thu, 15 Sep 2005 09:41:11 -0700
| > | > | > | > | Lines: 114
| > | > | > | > | X-Priority: 3
| > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | Message-ID: <#[email protected]>
| > | > | > | > | Newsgroups:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | NNTP-Posting-Host:
adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > 63.201.229.153
| > | > | > | > | Path:
| > | > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| > | > | > | > | X-Tomcat-NG:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > |
| > | > | > | > | Steven,
| > | > | > | > |
| > | > | > | > | 1. It is running serverside through a com component in an
ASP
| > | > page.
| > | > | > | > |
| > | > | > | > | 2. Agreed.
| > | > | > | > |
| > | > | > | > | The issue can also be demonstrated as follows:
| > | > | > | > |
| > | > | > | > | 1. a new account is created on 2003 in the administrators
| > group.
| > | > | > | > |
| > | > | > | > | 2. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 3. The code will display the printer selection dialog and
| > prints
| > | > | > | > | successfully.
| > | > | > | > |
| > | > | > | > | 4. The new account is used to log into 2003 server and
logs
| > out.
| > | > | > | > |
| > | > | > | > | 5. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 6 The code will NOT display the printer selection dialog
and
| > | > prints
| > | > | > | > | successfully.
| > | > | > | > | --
| > | > | > | > |
| > | > | > | > | Thank you,
| > | > | > | > |
| > | > | > | > | Scott
| > | > | > | > | Software995 Support
| > | > | > | > |
in
| > | > message
| > | > | > | > | | > | > | > | > | > Hi Scott,
| > | > | > | > | >
| > | > | > | > | > Welcome to MSDN newsgroup.
| > | > | > | > | > From your description you're using some c++ unmanaged
code
| > to
| > | > do
| > | > | > | > printing
| > | > | > | > | > work for a web page. Also, you got some problem when
| > printing,
| > | > | > since
| > | > | > | > | > there'll occur the print setting dialog sometimes.
| > | > | > | > | >
| > | > | > | > | > As for your problem, I'd like to confirm the following
| > | > | > | > | >
| > | > | > | > | > 1. Is your printing code running in a activex control
or at
| > | > | > serverside
| > | > | > | > | > through COM component in asp page?
| > | > | > | > | >
| > | > | > | > | > 2. If running in ActiveX control, since Activex Control
is
| > | > rich
| > | > | > client
| > | > | > | > | > component which running at clientside, I think it won't
care
| > | > about
| > | > | > the
| > | > | > | > | > IWAM
| > | > | > | > | > account since IWAM account is a serverside account used
to
| > | > running
| > | > | > IIS
| > | > | > | > | > application.
| > | > | > | > | >
| > | > | > | > | > Please feel free to let me know if there're anything I
| > | > | > misunderstand.
| > | > | > | > | > Thanks,
| > | > | > | > | >
| > | > | > | > | > Steven Cheng
| > | > | > | > | > Microsoft Online Support
| > | > | > | > | >
| > | > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > | > (This posting is provided "AS IS", with no warranties,
and
| > | > confers
| > | > | > no
| > | > | > | > | > rights.)
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | > --------------------
| > | > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | > | Subject: Problem Printing using IWebBrowser2 from IWAM
| > | > Account
| > | > | > on
| > | > | > | > Server
| > | > | > | > | > 2003
| > | > | > | > | > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | > | > | > | > | Lines: 23
| > | > | > | > | > | X-Priority: 3
| > | > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE
V6.00.2900.2180
| > | > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | > | Message-ID: <[email protected]>
| > | > | > | > | > | Newsgroups:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > | NNTP-Posting-Host:
| > | > adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > | > 63.201.229.153
| > | > | > | > | > | Path:
| > | > | > | >
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > | >
microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | > | > | > | > | X-Tomcat-NG:
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > |
| > | > | > | > | > | The code below successfully invokes printing from an
ASP
| > | > page.
| > | > | > | > | > |
| > | > | > | > | > | If I run the code before a user manually logs in as
the
| > IWAM
| > | > | > | > account,
| > | > | > | > | > the
| > | > | > | > | > | printer selection dialog is unfortunately displayed.
If I
| > | > have
| > | > | > | > logged
| > | > | > | > | > into
| > | > | > | > | > | the IWAM account and logged out, then the printer
| > selection
| > | > | > dialog
| > | > | > | > does
| > | > | > | > | > not
| > | > | > | > | > | display.
| > | > | > | > | > |
| > | > | > | > | > | I do not want the printer selection dialog to
display.
| > | > Logging
| > | > | > into
| > | > | > | > the
| > | > | > | > | > IWAM
| > | > | > | > | > | account requires changing the account's password and
is
| > not
| > | > an
| > | > | > | > | > acceptable
| > | > | > | > | > | solution. What must be done so that the printer
selection
| > | > dialog
| > | > | > is
| > | > | > | > | > | suppressed without requiring needing to log in as the
IWAM
| > | > | > account?
| > | > | > | > | > |
| > | > | > | > | > | VARIANT parameter;
| > | > | > | > | > | VariantInit(&parameter);
| > | > | > | > | > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | > | > | > | > | V_ARRAY(&parameter) = parameter_array;
| > | > | > | > | > |
| > | > | > | > | > | // start printing browser contents
| > | > | > | > | > |
| > | > | > | > | > | hr =
| > | > | > | > | > |
| > | > | > | > | >
| > | > | > | >
| > | > | >
| > | >
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > | > | > | > | > );
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | >
| > | > | > | > |
| > | > | > | > |
| > | > | > | > |
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
 
S

ScottLR

Steven,

I posted to
microsoft.public.windowsxp.print_fax

on the 20th and still have not received a reply from Microsoft. I was under
the impression that I would receive a reply within 24 hours. Does my msdn
subscription entitle me to this?


--

Thank you,

Scott
Software995 Support

Steven Cheng said:
Nevermind Scott,

Since this is a programmatical specific issue, if you still need any
assistance from us, plesase feel free to post here or in other
programmatic
related newsgroup. Also, if convenient, I'd suggest you provide the
complete code list of your COMponent which construct the webbrowser
component instance and call its printing funciton.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Wed, 21 Sep 2005 17:16:26 -0700
| Lines: 1495
| MIME-Version: 1.0
| Content-Type: multipart/alternative;
| boundary="----=_NextPart_000_01D7_01C5BED0.334FF400"
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10960
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven,
| Yes. I did that to no avail. I have posted a new message to
| microsoft.public.windowsxp.print_fax and am awaiting a reply.
| Thank you for all of your help,
| Scott
| > Thanks for your response Scott,
| >
| > I think the lack of a default printer sounds reasonable. Also, as you
| > mentioned that directly call SetDefaultPrinter in your ASP environment
,
| > I'm thinking whether it is still caused by No UserProfile for the
daemon
| > logon session of the ASP process account? Have you tried call the
| > LoadUserProfile first before calling the SetDefaultPrinter?
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <#[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account
on
| > Server 2003
| > | Date: Tue, 20 Sep 2005 10:48:48 -0700
| > | Lines: 476
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10932
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Steven,
| > |
| > | I have determined the problem is that there is no default printer.
The
| > api
| > | call SetDefaultPrinter fails until the user has logged on with
| > | control-alt-delete. Try creating a user, do a run as to start
notepad.
| > | Select print. You will not be able to specify a default printer.
| > |
| > | Thank you for your help.
| > |
| > | -Scott
| > |
| > | "Steven Cheng said:
| > | > Thanks Scott for you further followup.
| > | >
| > | > OK. Seems the problem is concerned with something else in the
serverside
| > | > printing. In my reviewing this thread, I saw that you've manually
| > | > construct
| > | > a webbrowser component in your COM component's printing. Do you
think it
| > | > convenient that you provide me a simple reproduce version of your
COM
| > | > component or just the code that your construct the WEBbrowser
control ,
| > | > navigate a certain page and printing? I'd like to perform some
local
| > tests
| > | > on it.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | > --------------------
| > | > | From: "ScottLR" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <#[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
Account on
| > | > Server 2003
| > | > | Date: Mon, 19 Sep 2005 15:34:11 -0700
| > | > | Lines: 377
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > 63.201.229.153
| > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10912
| > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | Hi Steven,
| > | > |
| > | > | LoadUserProfile does not appear to help. I am testing as
follows:
| > | > |
| > | > | > | > | 1. a new account is created on 2003 in the
ADMINISTRATORS
| > group.
| > | > | > | > |
| > | > | > | > | 2. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 3. The code will display the printer selection dialog
and
| > prints
| > | > | > | > | successfully.
| > | > | > | > |
| > | > | > | > | 4. The new account is used to log into 2003 server and
logs
| > out.
| > | > | > | > |
| > | > | > | > | 5. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 6 The code will NOT display the printer selection dialog
and
| > | > prints
| > | > | > | > | successfully.
| > | > |
| > | > | I am successfully calling LoadUserProfile and then
UnLoadUserProfile
| > in
| > | > the
| > | > | process before attempting to print. The calls succeed. However,
it
| > still
| > | > | fails to suppress the printer selection dialog., even if I try
it
| > again
| > | > | afterwards. It appears, that something other than running
| > | > LoadUserProfile
| > | > | may be necessary to suppress the printer selection dialog when
the
| > | > | Webbrowser control is invoked from a process owned by a user who
has
| > not
| > | > | logged on via control alt delete. Again, if I log in using
control alt
| > | > | delete, then the printer selection dialog does not display.
| > | > |
| > | > | This is the code I am running to call LoadUserProfile. There do
not
| > | > appear
| > | > | to be errors.
| > | > |
| > | > | PROFILEINFO profileInfo;
| > | > |
| > | > | ZeroMemory( &profileInfo, sizeof(profileInfo) );
| > | > | profileInfo.dwSize = sizeof(profileInfo);
| > | > |
| > | > |
| > | > | //memset(&profileInfo, 0, sizeof(PROFILEINFO));
| > | > | //profileInfo.dwSize = sizeof(PROFILEINFO);
| > | > |
| > | > | //strcpy(profileInfo.lpUserName, szUserName);
| > | > | profileInfo.lpUserName = szUserName;
| > | > | // profileInfo.lpUserName = "CVC";
| > | > | profileInfo.dwFlags = PI_NOUI;
| > | > |
| > | > | BOOL ret;
| > | > |
| > | > | try
| > | > | {
| > | > | ret = LoadUserProfile(
| > | > | hToken,
| > | > | &profileInfo
| > | > | );
| > | > | }
| > | > | catch(...)
| > | > | {
| > | > | DWORD err = GetLastError();
| > | > | return FALSE;
| > | > | }
| > | > |
| > | > | if (ret == 0)
| > | > | {
| > | > | DWORD err = GetLastError();
| > | > | int a = 1;
| > | > | AfxMessageBox("failed");
| > | > |
| > | > | }
| > | > |
| > | > | // Unload the profile when it is no longer needed
| > | > | if ( !UnloadUserProfile(
| > | > | hToken, // token for the user
| > | > | profileInfo.hProfile ) ) { // registry key handle
| > | > | GetLastError();
| > | > | }
| > | > |
| > | > | --
| > | > |
| > | > | Thank you,
| > | > |
| > | > | Scott
| > | > |
message
| > | > | | > | > | > Hi Scott,
| > | > | >
| > | > | > The LoadUserProfile API will take an Handle object as input
which
| > | > | > represent
| > | > | > of the account's logon session token for which you'd like to
load
| > the
| > | > user
| > | > | > profile.
| > | > | >
| > | > | > BOOL LoadUserProfile(
| > | > | > HANDLE hToken,
| > | > | > LPPROFILEINFO lpProfileInfo
| > | > | > );
| > | > | >
| > | > | > Also, we can get a Token object from the current running
thread
or
| > | > | > process,
| > | > | > the following WIN32 api just provide such functionality:
| > | > | >
| > | > | > BOOL OpenProcessToken(
| > | > | > HANDLE ProcessHandle,
| > | > | > DWORD DesiredAccess,
| > | > | > PHANDLE TokenHandle
| > | > | > );
| > | > | >
| > | > | >
| > | > | > bool OpenThreadToken(
| > | > | > DWORD dwDesiredAccess,
| > | > | > bool bImpersonate = false,
| > | > | > bool bOpenAsSelf = true,
| > | > | > SECURITY_IMPERSONATION_LEVEL sil = SecurityImpersonation
| > | > | > ) throw(...);
| > | > | >
| > | > | > Thus, we don't need to manually call logonUser API with
cleartext
| > | > | > uesrname/password to establish a logon session/token
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > --------------------
| > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > <[email protected]>
| > | > | > <#[email protected]>
| > | > | > <[email protected]>
| > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
| > Account
| > | > on
| > | > | > Server 2003
| > | > | > | Date: Fri, 16 Sep 2005 08:48:32 -0700
| > | > | > | Lines: 197
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | NNTP-Posting-Host:
adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > 63.201.229.153
| > | > | > | Path:
| > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10864
| > | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > |
| > | > | > | Steven,
| > | > | > |
| > | > | > | We do not see the printer selection dialog. However, the
process
| > | > stops.
| > | > | > We
| > | > | > | know the dialog displays because when performing a "run as"
with a
| > | > user
| > | > | > that
| > | > | > | has not logged on manually, the printer selection dialog
displays.
| > | > | > |
| > | > | > | I am inclined to agree that running LoadUserProfile will
solve the
| > | > | > issue.
| > | > | > | How can I run this for the IWAM account if I do not know its
| > password?
| > | > | > |
| > | > | > |
| > | > | > | Scott
| > | > | > |
| > | > | > | "Steven Cheng said:
| > | > | > | | > | > | > | > Thanks for your response Scott,
| > | > | > | >
| > | > | > | > OK. So you've used a custom COM component in your asp
page(not
| > | > asp.net
| > | > | > | > yes?) and try printing in that component, and there'll
always
| > | > occur
| > | > | > | > printer
| > | > | > | > selection dialog if you haven't interactively logon
through
that
| > | > | > service
| > | > | > | > account on the server yet ,yes?
| > | > | > | >
| > | > | > | > One thing I'm still confused is since the ASP's page
processing
| > | > thread
| > | > | > | > running in a daemon process belonging to a non displayable
| > | > | > | > station,
| > | > | > | > how could you see the Printer selection dialog? It's only
| > possible
| > | > for
| > | > | > us
| > | > | > | > to see such UI in application running interactively or in
a
| > | > visible
| > | > | > | > windows
| > | > | > | > station.
| > | > | > | >
| > | > | > | > Anyway, from the symptom of the issue, I think it's likely
due
| > to
| > | > the
| > | > | > | > USERPROFILE of your IWAM(or other custom account) account.
when
| > we
| > | > | > | > interactively logon , the certain user/account's User
Profile is
| > | > | > loaded,
| > | > | > | > then the Printer selection dialog won't appear. You can
try
| > using
| > | > the
| > | > | > | > LoadUserProfile win32 API to manually load the userProfile
of
| > your
| > | > | > | > process's account to see whether it helps.
| > | > | > | >
| > | > | > | > Thanks,
| > | > | > | >
| > | > | > | > Steven Cheng
| > | > | > | > Microsoft Online Support
| > | > | > | >
| > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > (This posting is provided "AS IS", with no warranties, and
| > | > no
| > | > | > | > rights.)
| > | > | > | >
| > | > | > | >
| > | > | > | > --------------------
| > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | References: <[email protected]>
| > | > | > | > <[email protected]>
| > | > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from
IWAM
| > | > Account
| > | > | > on
| > | > | > | > Server 2003
| > | > | > | > | Date: Thu, 15 Sep 2005 09:41:11 -0700
| > | > | > | > | Lines: 114
| > | > | > | > | X-Priority: 3
| > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | Message-ID: <#[email protected]>
| > | > | > | > | Newsgroups:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | NNTP-Posting-Host:
adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > 63.201.229.153
| > | > | > | > | Path:
| > | > | >
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| > | > | > | > | X-Tomcat-NG:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > |
| > | > | > | > | Steven,
| > | > | > | > |
| > | > | > | > | 1. It is running serverside through a com component in
an
ASP
| > | > page.
| > | > | > | > |
| > | > | > | > | 2. Agreed.
| > | > | > | > |
| > | > | > | > | The issue can also be demonstrated as follows:
| > | > | > | > |
| > | > | > | > | 1. a new account is created on 2003 in the
administrators
| > group.
| > | > | > | > |
| > | > | > | > | 2. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 3. The code will display the printer selection dialog
and
| > prints
| > | > | > | > | successfully.
| > | > | > | > |
| > | > | > | > | 4. The new account is used to log into 2003 server and
logs
| > out.
| > | > | > | > |
| > | > | > | > | 5. The administrator invokes cmd.exe using "run as" with
the
| > new
| > | > | > | > account.
| > | > | > | > |
| > | > | > | > | 6 The code will NOT display the printer selection dialog
and
| > | > prints
| > | > | > | > | successfully.
| > | > | > | > | --
| > | > | > | > |
| > | > | > | > | Thank you,
| > | > | > | > |
| > | > | > | > | Scott
| > | > | > | > | Software995 Support
| > | > | > | > |
| > | > | > | > | "Steven Cheng[MSFT]" <[email protected]>
wrote
in
| > | > message
| > | > | > | > | | > | > | > | > | > Hi Scott,
| > | > | > | > | >
| > | > | > | > | > Welcome to MSDN newsgroup.
| > | > | > | > | > From your description you're using some c++ unmanaged
code
| > to
| > | > do
| > | > | > | > printing
| > | > | > | > | > work for a web page. Also, you got some problem when
| > printing,
| > | > | > since
| > | > | > | > | > there'll occur the print setting dialog sometimes.
| > | > | > | > | >
| > | > | > | > | > As for your problem, I'd like to confirm the following
| > | > | > | > | >
| > | > | > | > | > 1. Is your printing code running in a activex control
or at
| > | > | > serverside
| > | > | > | > | > through COM component in asp page?
| > | > | > | > | >
| > | > | > | > | > 2. If running in ActiveX control, since Activex
Control
is
| > | > rich
| > | > | > client
| > | > | > | > | > component which running at clientside, I think it
won't
care
| > | > about
| > | > | > the
| > | > | > | > | > IWAM
| > | > | > | > | > account since IWAM account is a serverside account
used
to
| > | > running
| > | > | > IIS
| > | > | > | > | > application.
| > | > | > | > | >
| > | > | > | > | > Please feel free to let me know if there're anything I
| > | > | > misunderstand.
| > | > | > | > | > Thanks,
| > | > | > | > | >
| > | > | > | > | > Steven Cheng
| > | > | > | > | > Microsoft Online Support
| > | > | > | > | >
| > | > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > | > (This posting is provided "AS IS", with no warranties,
and
| > | > confers
| > | > | > no
| > | > | > | > | > rights.)
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | > --------------------
| > | > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | > | Subject: Problem Printing using IWebBrowser2 from
IWAM
| > | > Account
| > | > | > on
| > | > | > | > Server
| > | > | > | > | > 2003
| > | > | > | > | > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | > | > | > | > | Lines: 23
| > | > | > | > | > | X-Priority: 3
| > | > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | > | X-Newsreader: Microsoft Outlook Express
6.00.2900.2180
| > | > | > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE
V6.00.2900.2180
| > | > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | > | Message-ID: <[email protected]>
| > | > | > | > | > | Newsgroups:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > | NNTP-Posting-Host:
| > | > adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > | > 63.201.229.153
| > | > | > | > | > | Path:
| > | > | > | >
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > | >
microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | > | > | > | > | X-Tomcat-NG:
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > |
| > | > | > | > | > | The code below successfully invokes printing from an
ASP
| > | > page.
| > | > | > | > | > |
| > | > | > | > | > | If I run the code before a user manually logs in as
the
| > IWAM
| > | > | > | > account,
| > | > | > | > | > the
| > | > | > | > | > | printer selection dialog is unfortunately displayed.
If I
| > | > have
| > | > | > | > logged
| > | > | > | > | > into
| > | > | > | > | > | the IWAM account and logged out, then the printer
| > selection
| > | > | > dialog
| > | > | > | > does
| > | > | > | > | > not
| > | > | > | > | > | display.
| > | > | > | > | > |
| > | > | > | > | > | I do not want the printer selection dialog to
display.
| > | > Logging
| > | > | > into
| > | > | > | > the
| > | > | > | > | > IWAM
| > | > | > | > | > | account requires changing the account's password and
is
| > not
| > | > an
| > | > | > | > | > acceptable
| > | > | > | > | > | solution. What must be done so that the printer
selection
| > | > dialog
| > | > | > is
| > | > | > | > | > | suppressed without requiring needing to log in as
the
IWAM
| > | > | > account?
| > | > | > | > | > |
| > | > | > | > | > | VARIANT parameter;
| > | > | > | > | > | VariantInit(&parameter);
| > | > | > | > | > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | > | > | > | > | V_ARRAY(&parameter) = parameter_array;
| > | > | > | > | > |
| > | > | > | > | > | // start printing browser contents
| > | > | > | > | > |
| > | > | > | > | > | hr =
| > | > | > | > | > |
| > | > | > | > | >
| > | > | > | >
| > | > | >
| > | >
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > | > | > | > | > );
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | >
| > | > | > | > |
| > | > | > | > |
| > | > | > | > |
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
 
S

Steven Cheng[MSFT]

Hi Scott,

For MSDN subscribe, you're confirmed to get a response in those managed
newsgroup. As for the
microsoft.public.windowsxp.print_fax

It seems a non-development(platform) newsgroup, also from my checking it
isn't a managed newsgroup either. I think that's why the threads in that
group is not monitored as in those managed ones. As far as I know, you can
check the managed MSDN newsgroup in the following page:

http://msdn.microsoft.com/newsgroups/managed/

I'll suggest you try posting in one of the related development newsgroup
listed in them.

If anything else we can help, please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "ScottLR" <[email protected]>
| References: <[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
Server 2003
| Date: Thu, 22 Sep 2005 08:29:08 -0700
| Lines: 726
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
63.201.229.153
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP1
5.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10982
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Steven,
|
| I posted to
| microsoft.public.windowsxp.print_fax
|
| on the 20th and still have not received a reply from Microsoft. I was
under
| the impression that I would receive a reply within 24 hours. Does my msdn
| subscription entitle me to this?
|
|
| --
|
| Thank you,
|
| Scott
| Software995 Support
|
| | > Nevermind Scott,
| >
| > Since this is a programmatical specific issue, if you still need any
| > assistance from us, plesase feel free to post here or in other
| > programmatic
| > related newsgroup. Also, if convenient, I'd suggest you provide the
| > complete code list of your COMponent which construct the webbrowser
| > component instance and call its printing funciton.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "ScottLR" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <#[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM Account on
| > Server 2003
| > | Date: Wed, 21 Sep 2005 17:16:26 -0700
| > | Lines: 1495
| > | MIME-Version: 1.0
| > | Content-Type: multipart/alternative;
| > | boundary="----=_NextPart_000_01D7_01C5BED0.334FF400"
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | Message-ID: <#[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > 63.201.229.153
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10960
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Steven,
| > | Yes. I did that to no avail. I have posted a new message to
| > | microsoft.public.windowsxp.print_fax and am awaiting a reply.
| > | Thank you for all of your help,
| > | Scott
| > | > | > Thanks for your response Scott,
| > | >
| > | > I think the lack of a default printer sounds reasonable. Also, as
you
| > | > mentioned that directly call SetDefaultPrinter in your ASP
environment
| > ,
| > | > I'm thinking whether it is still caused by No UserProfile for the
| > daemon
| > | > logon session of the ASP process account? Have you tried call the
| > | > LoadUserProfile first before calling the SetDefaultPrinter?
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | > --------------------
| > | > | From: "ScottLR" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <#[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
Account
| > on
| > | > Server 2003
| > | > | Date: Tue, 20 Sep 2005 10:48:48 -0700
| > | > | Lines: 476
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > 63.201.229.153
| > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10932
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | Steven,
| > | > |
| > | > | I have determined the problem is that there is no default printer.
| > The
| > | > api
| > | > | call SetDefaultPrinter fails until the user has logged on with
| > | > | control-alt-delete. Try creating a user, do a run as to start
| > notepad.
| > | > | Select print. You will not be able to specify a default printer.
| > | > |
| > | > | Thank you for your help.
| > | > |
| > | > | -Scott
| > | > |
message
| >> | | > | > | > Thanks Scott for you further followup.
| > | > | >
| > | > | > OK. Seems the problem is concerned with something else in the
| > serverside
| > | > | > printing. In my reviewing this thread, I saw that you've
manually
| > | > | > construct
| > | > | > a webbrowser component in your COM component's printing. Do you
| > think it
| > | > | > convenient that you provide me a simple reproduce version of
your
| > COM
| > | > | > component or just the code that your construct the WEBbrowser
| > control ,
| > | > | > navigate a certain page and printing? I'd like to perform some
| > local
| > | > tests
| > | > | > on it.
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | > --------------------
| > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > <[email protected]>
| > | > | > <#[email protected]>
| > | > | > <[email protected]>
| > | > | > <[email protected]>
| > | > | > <[email protected]>
| > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
| > Account on
| > | > | > Server 2003
| > | > | > | Date: Mon, 19 Sep 2005 15:34:11 -0700
| > | > | > | Lines: 377
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups:
microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | NNTP-Posting-Host: adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > 63.201.229.153
| > | > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10912
| > | > | > | X-Tomcat-NG:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > |
| > | > | > | Hi Steven,
| > | > | > |
| > | > | > | LoadUserProfile does not appear to help. I am testing as
| > follows:
| > | > | > |
| > | > | > | > | > | 1. a new account is created on 2003 in the
| > ADMINISTRATORS
| > | > group.
| > | > | > | > | > |
| > | > | > | > | > | 2. The administrator invokes cmd.exe using "run as"
with
| > the
| > | > new
| > | > | > | > | > account.
| > | > | > | > | > |
| > | > | > | > | > | 3. The code will display the printer selection dialog
| > and
| > | > prints
| > | > | > | > | > | successfully.
| > | > | > | > | > |
| > | > | > | > | > | 4. The new account is used to log into 2003 server and
| > logs
| > | > out.
| > | > | > | > | > |
| > | > | > | > | > | 5. The administrator invokes cmd.exe using "run as"
with
| > the
| > | > new
| > | > | > | > | > account.
| > | > | > | > | > |
| > | > | > | > | > | 6 The code will NOT display the printer selection
dialog
| > and
| > | > | > prints
| > | > | > | > | > | successfully.
| > | > | > |
| > | > | > | I am successfully calling LoadUserProfile and then
| > UnLoadUserProfile
| > | > in
| > | > | > the
| > | > | > | process before attempting to print. The calls succeed.
However,
| > it
| > | > still
| > | > | > | fails to suppress the printer selection dialog., even if I
try
| > it
| > | > again
| > | > | > | afterwards. It appears, that something other than running
| > | > | > LoadUserProfile
| > | > | > | may be necessary to suppress the printer selection dialog
when
| > the
| > | > | > | Webbrowser control is invoked from a process owned by a user
who
| > has
| > | > not
| > | > | > | logged on via control alt delete. Again, if I log in using
| > control alt
| > | > | > | delete, then the printer selection dialog does not display.
| > | > | > |
| > | > | > | This is the code I am running to call LoadUserProfile. There
do
| > not
| > | > | > appear
| > | > | > | to be errors.
| > | > | > |
| > | > | > | PROFILEINFO profileInfo;
| > | > | > |
| > | > | > | ZeroMemory( &profileInfo, sizeof(profileInfo) );
| > | > | > | profileInfo.dwSize = sizeof(profileInfo);
| > | > | > |
| > | > | > |
| > | > | > | //memset(&profileInfo, 0, sizeof(PROFILEINFO));
| > | > | > | //profileInfo.dwSize = sizeof(PROFILEINFO);
| > | > | > |
| > | > | > | //strcpy(profileInfo.lpUserName, szUserName);
| > | > | > | profileInfo.lpUserName = szUserName;
| > | > | > | // profileInfo.lpUserName = "CVC";
| > | > | > | profileInfo.dwFlags = PI_NOUI;
| > | > | > |
| > | > | > | BOOL ret;
| > | > | > |
| > | > | > | try
| > | > | > | {
| > | > | > | ret = LoadUserProfile(
| > | > | > | hToken,
| > | > | > | &profileInfo
| > | > | > | );
| > | > | > | }
| > | > | > | catch(...)
| > | > | > | {
| > | > | > | DWORD err = GetLastError();
| > | > | > | return FALSE;
| > | > | > | }
| > | > | > |
| > | > | > | if (ret == 0)
| > | > | > | {
| > | > | > | DWORD err = GetLastError();
| > | > | > | int a = 1;
| > | > | > | AfxMessageBox("failed");
| > | > | > |
| > | > | > | }
| > | > | > |
| > | > | > | // Unload the profile when it is no longer needed
| > | > | > | if ( !UnloadUserProfile(
| > | > | > | hToken, // token for the user
| > | > | > | profileInfo.hProfile ) ) { // registry key
handle
| > | > | > | GetLastError();
| > | > | > | }
| > | > | > |
| > | > | > | --
| > | > | > |
| > | > | > | Thank you,
| > | > | > |
| > | > | > | Scott
| > | > | > |
| > message
| > | > | > | | > | > | > | > Hi Scott,
| > | > | > | >
| > | > | > | > The LoadUserProfile API will take an Handle object as input
| > which
| > | > | > | > represent
| > | > | > | > of the account's logon session token for which you'd like to
| > load
| > | > the
| > | > | > user
| > | > | > | > profile.
| > | > | > | >
| > | > | > | > BOOL LoadUserProfile(
| > | > | > | > HANDLE hToken,
| > | > | > | > LPPROFILEINFO lpProfileInfo
| > | > | > | > );
| > | > | > | >
| > | > | > | > Also, we can get a Token object from the current running
| > thread
| > or
| > | > | > | > process,
| > | > | > | > the following WIN32 api just provide such functionality:
| > | > | > | >
| > | > | > | > BOOL OpenProcessToken(
| > | > | > | > HANDLE ProcessHandle,
| > | > | > | > DWORD DesiredAccess,
| > | > | > | > PHANDLE TokenHandle
| > | > | > | > );
| > | > | > | >
| > | > | > | >
| > | > | > | > bool OpenThreadToken(
| > | > | > | > DWORD dwDesiredAccess,
| > | > | > | > bool bImpersonate = false,
| > | > | > | > bool bOpenAsSelf = true,
| > | > | > | > SECURITY_IMPERSONATION_LEVEL sil = SecurityImpersonation
| > | > | > | > ) throw(...);
| > | > | > | >
| > | > | > | > Thus, we don't need to manually call logonUser API with
| > cleartext
| > | > | > | > uesrname/password to establish a logon session/token
| > | > | > | >
| > | > | > | > Thanks,
| > | > | > | >
| > | > | > | > Steven Cheng
| > | > | > | > Microsoft Online Support
| > | > | > | >
| > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > (This posting is provided "AS IS", with no warranties, and
| > confers
| > | > no
| > | > | > | > rights.)
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | > --------------------
| > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | References: <[email protected]>
| > | > | > | > <[email protected]>
| > | > | > | > <#[email protected]>
| > | > | > | > <[email protected]>
| > | > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from IWAM
| > | > Account
| > | > | > on
| > | > | > | > Server 2003
| > | > | > | > | Date: Fri, 16 Sep 2005 08:48:32 -0700
| > | > | > | > | Lines: 197
| > | > | > | > | X-Priority: 3
| > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | Message-ID: <[email protected]>
| > | > | > | > | Newsgroups:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | NNTP-Posting-Host:
| > adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > 63.201.229.153
| > | > | > | > | Path:
| > | > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:10864
| > | > | > | > | X-Tomcat-NG:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > |
| > | > | > | > | Steven,
| > | > | > | > |
| > | > | > | > | We do not see the printer selection dialog. However, the
| > process
| > | > | > stops.
| > | > | > | > We
| > | > | > | > | know the dialog displays because when performing a "run
as"
| > with a
| > | > | > user
| > | > | > | > that
| > | > | > | > | has not logged on manually, the printer selection dialog
| > displays.
| > | > | > | > |
| > | > | > | > | I am inclined to agree that running LoadUserProfile will
| > solve the
| > | > | > | > issue.
| > | > | > | > | How can I run this for the IWAM account if I do not know
its
| >> | > password?
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | Scott
| > | > | > | > |
in
| >> message
| > | > | > | > | | > | > | > | > | > Thanks for your response Scott,
| > | > | > | > | >
| > | > | > | > | > OK. So you've used a custom COM component in your asp
| > page(not
| > | > | > asp.net
| > | > | > | > | > yes?) and try printing in that component, and there'll
| > always
| > | > | > occur
| > | > | > | > | > printer
| > | > | > | > | > selection dialog if you haven't interactively logon
| > through
| > that
| > | > | > | > service
| > | > | > | > | > account on the server yet ,yes?
| > | > | > | > | >
| > | > | > | > | > One thing I'm still confused is since the ASP's page
| > processing
| > | > | > thread
| > | > | > | > | > running in a daemon process belonging to a non
displayable
| >> windows
| > | > | > | > | > station,
| > | > | > | > | > how could you see the Printer selection dialog? It's
only
| > | > possible
| > | > | > for
| > | > | > | > us
| > | > | > | > | > to see such UI in application running interactively or
in
| > a
| > | > | > visible
| > | > | > | > | > windows
| > | > | > | > | > station.
| > | > | > | > | >
| > | > | > | > | > Anyway, from the symptom of the issue, I think it's
likely
| > due
| > | > to
| > | > | > the
| > | > | > | > | > USERPROFILE of your IWAM(or other custom account)
account.
| > when
| > | > we
| > | > | > | > | > interactively logon , the certain user/account's User
| > Profile is
| > | > | > | > loaded,
| > | > | > | > | > then the Printer selection dialog won't appear. You can
| > try
| > | > using
| > | > | > the
| > | > | > | > | > LoadUserProfile win32 API to manually load the
userProfile
| > of
| > | > your
| > | > | > | > | > process's account to see whether it helps.
| > | > | > | > | >
| > | > | > | > | > Thanks,
| > | > | > | > | >
| > | > | > | > | > Steven Cheng
| > | > | > | > | > Microsoft Online Support
| > | > | > | > | >
| > | > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > | > (This posting is provided "AS IS", with no warranties,
and
| >> confers
| > | > | > no
| > | > | > | > | > rights.)
| > | > | > | > | >
| > | > | > | > | >
| > | > | > | > | > --------------------
| > | > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | > | References: <[email protected]>
| > | > | > | > | > <[email protected]>
| > | > | > | > | > | Subject: Re: Problem Printing using IWebBrowser2 from
| > IWAM
| > | > | > Account
| > | > | > | > on
| > | > | > | > | > Server 2003
| > | > | > | > | > | Date: Thu, 15 Sep 2005 09:41:11 -0700
| > | > | > | > | > | Lines: 114
| > | > | > | > | > | X-Priority: 3
| > | > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | > | X-MIMEOLE: Produced By Microsoft MimeOLE
V6.00.2900.2180
| > | > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | > | Message-ID: <#[email protected]>
| > | > | > | > | > | Newsgroups:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > | NNTP-Posting-Host:
| > adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > | > 63.201.229.153
| > | > | > | > | > | Path:
| > | > | > | >
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > | >
microsoft.public.dotnet.framework.aspnet.webcontrols:10848
| > | > | > | > | > | X-Tomcat-NG:
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > |
| > | > | > | > | > | Steven,
| > | > | > | > | > |
| > | > | > | > | > | 1. It is running serverside through a com component
in
| > an
| > ASP
| > | > | > page.
| > | > | > | > | > |
| > | > | > | > | > | 2. Agreed.
| > | > | > | > | > |
| > | > | > | > | > | The issue can also be demonstrated as follows:
| > | > | > | > | > |
| > | > | > | > | > | 1. a new account is created on 2003 in the
| > administrators
| > | > group.
| > | > | > | > | > |
| > | > | > | > | > | 2. The administrator invokes cmd.exe using "run as"
with
| > the
| > | > new
| > | > | > | > | > account.
| > | > | > | > | > |
| > | > | > | > | > | 3. The code will display the printer selection dialog
| > and
| > | > prints
| > | > | > | > | > | successfully.
| > | > | > | > | > |
| > | > | > | > | > | 4. The new account is used to log into 2003 server and
| > logs
| > | > out.
| > | > | > | > | > |
| > | > | > | > | > | 5. The administrator invokes cmd.exe using "run as"
with
| > the
| > | > new
| > | > | > | > | > account.
| > | > | > | > | > |
| > | > | > | > | > | 6 The code will NOT display the printer selection
dialog
| > and
| > | > | > prints
| > | > | > | > | > | successfully.
| > | > | > | > | > | --
| > | > | > | > | > |
| > | > | > | > | > | Thank you,
| > | > | > | > | > |
| > | > | > | > | > | Scott
| > | > | > | > | > | Software995 Support
| > | > | > | > | > |
| > | > | > | > | > | "Steven Cheng[MSFT]" <[email protected]>
| > wrote
| > in
| > | > | > message
| > | > | > | > | > | | > | > | > | > | > | > Hi Scott,
| > | > | > | > | > | >
| > | > | > | > | > | > Welcome to MSDN newsgroup.
| > | > | > | > | > | > From your description you're using some c++
unmanaged
| > code
| > | > to
| > | > | > do
| > | > | > | > | > printing
| > | > | > | > | > | > work for a web page. Also, you got some problem when
| > | > printing,
| > | > | > | > since
| > | > | > | > | > | > there'll occur the print setting dialog sometimes.
| > | > | > | > | > | >
| > | > | > | > | > | > As for your problem, I'd like to confirm the
following
| >> things:
| > | > | > | > | > | >
| > | > | > | > | > | > 1. Is your printing code running in a activex
control
| > or at
| > | > | > | > serverside
| > | > | > | > | > | > through COM component in asp page?
| > | > | > | > | > | >
| > | > | > | > | > | > 2. If running in ActiveX control, since Activex
| > Control
| > is
| > | > | > rich
| > | > | > | > client
| > | > | > | > | > | > component which running at clientside, I think it
| > won't
| > care
| > | > | > about
| > | > | > | > the
| > | > | > | > | > | > IWAM
| > | > | > | > | > | > account since IWAM account is a serverside account
| > used
| > to
| > | > | > running
| > | > | > | > IIS
| > | > | > | > | > | > application.
| > | > | > | > | > | >
| > | > | > | > | > | > Please feel free to let me know if there're
anything I
| > | > | > | > misunderstand.
| > | > | > | > | > | > Thanks,
| > | > | > | > | > | >
| > | > | > | > | > | > Steven Cheng
| > | > | > | > | > | > Microsoft Online Support
| > | > | > | > | > | >
| > | > | > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > | > | > (This posting is provided "AS IS", with no
warranties,
| > and
| > | > | > confers
| > | > | > | > no
| > | > | > | > | > | > rights.)
| > | > | > | > | > | >
| > | > | > | > | > | >
| > | > | > | > | > | >
| > | > | > | > | > | > --------------------
| > | > | > | > | > | > | From: "ScottLR" <[email protected]>
| > | > | > | > | > | > | Subject: Problem Printing using IWebBrowser2 from
| > IWAM
| > | > | > Account
| > | > | > | > on
| > | > | > | > | > Server
| > | > | > | > | > | > 2003
| > | > | > | > | > | > | Date: Wed, 14 Sep 2005 11:02:38 -0700
| > | > | > | > | > | > | Lines: 23
| > | > | > | > | > | > | X-Priority: 3
| > | > | > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | > | > | X-Newsreader: Microsoft Outlook Express
| > 6.00.2900.2180
| > | > | > | > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE
| > V6.00.2900.2180
| > | > | > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | > | > | Message-ID:
<[email protected]>
| > | > | > | > | > | > | Newsgroups:
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > | > | NNTP-Posting-Host:
| > | > | > adsl-63-201-229-153.dsl.snfc21.pacbell.net
| > | > | > | > | > | > 63.201.229.153
| > | > | > | > | > | > | Path:
| > | > | > | > | >
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > | > | > | >
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10832
| > | > | > | > | > | > | X-Tomcat-NG:
| > | > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | > | > | > |
| > | > | > | > | > | > | The code below successfully invokes printing from
an
| > ASP
| > | > | > page.
| > | > | > | > | > | > |
| > | > | > | > | > | > | If I run the code before a user manually logs in
as
| > the
| > | > IWAM
| > | > | > | > | > account,
| > | > | > | > | > | > the
| > | > | > | > | > | > | printer selection dialog is unfortunately
displayed.
| > If I
| > | > | > have
| > | > | > | > | > logged
| > | > | > | > | > | > into
| > | > | > | > | > | > | the IWAM account and logged out, then the printer
| > | > selection
| > | > | > | > dialog
| > | > | > | > | > does
| > | > | > | > | > | > not
| > | > | > | > | > | > | display.
| > | > | > | > | > | > |
| > | > | > | > | > | > | I do not want the printer selection dialog to
| > display.
| > | > | > Logging
| > | > | > | > into
| > | > | > | > | > the
| > | > | > | > | > | > IWAM
| > | > | > | > | > | > | account requires changing the account's password
and
| > is
| > | > not
| > | > | > an
| > | > | > | > | > | > acceptable
| > | > | > | > | > | > | solution. What must be done so that the printer
| > selection
| > | > | > dialog
| > | > | > | > is
| > | > | > | > | > | > | suppressed without requiring needing to log in as
| > the
| > IWAM
| > | > | > | > account?
| > | > | > | > | > | > |
| > | > | > | > | > | > | VARIANT parameter;
| > | > | > | > | > | > | VariantInit(&parameter);
| > | > | > | > | > | > | V_VT(&parameter) = VT_ARRAY | VT_BYREF;
| > | > | > | > | > | > | V_ARRAY(&parameter) = parameter_array;
| > | > | > | > | > | > |
| > | > | > | > | > | > | // start printing browser contents
| > | > | > | > | > | > |
| > | > | > | > | > | > | hr =
| > | > | > | > | > | > |
| > | > | > | > | > | >
| > | > | > | > | >
| > | > | > | >
| > | > | >
| > | >
| >
_Browser->ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,&parameter,NULL
| > | > | > | > | > | > );
| > | > | > | > | > | > |
| > | > | > | > | > | > |
| > | > | > | > | > | > |
| > | > | > | > | > | >
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | > |
| > | > | > | > | >
| > | > | > | > |
| > | > | > | > |
| > | > | > | > |
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top