Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: when I should use delete , unassociate ?

44 views
Skip to first unread message

Gokmen Gok [MSFT]

unread,
Jun 19, 2009, 1:55:01 PM6/19/09
to

This is a query against the WSD category so whenever you execute this query
you will discover the WSD printer as long as it is online. THe fact that you
associated the printer does not affect the discoverability. When your printer
is associated though, if you discover the printer using this query again you
will see that PKEY_PNPX_Installed is set to VARIANT_TRUE in the property
store of the function instance you receive.

I work on pnpx, I am not an expert in printing but Delete method should also
delete the print port etc without a reboot. Make sure you call delete after
the printer/driver is completely installed.

Thanks
Gokmen [MSFT]

--
This posting is provided "AS IS" with no warranties, and confers no rights.
The use of any included script samples are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm

"WSD print" wrote:

> Ok , my program is used for discovering my WSD based printers in the network
> , So for the category and constraints , I used them like this :
>
> if( S_OK == hr )
> hr = m_pFunDisc->CreateInstanceCollectionQuery(
> FCTN_CATEGORY_WSDISCOVERY,
> NULL,
> TRUE,
> this,
> NULL,
> &pQuery);
>
> if( S_OK == hr )
> hr = pQuery->AddQueryConstraint(
> PROVIDERWSD_QUERYCONSTRAINT_TYPE ,
>
> L"http://schemas.microsoft.com/windows/2006/08/wdp/print/PrintDeviceType" );
>
> if( S_OK == hr )
> hr = pQuery->AddQueryConstraint(
> PNP_CONSTRAINTVALUE_NOTIFICATIONSONLY ,
> L"TRUE" );
>
> I have another question that , in Vista once I execute
> PnPXAssociation::Delete , the printer icon and the WSD print port can't be
> deleted immediatly , I have to reboot the PC for deleting them . So is it
> normal ? Can I manually delete them after execution of the method
> PnPXAssociation::Delete ?
>
> Thanks .
>
> "Gokmen Gok [MSFT]" wrote:
>
> > Can you briefly explain what your program does? What category you are
> > querying and constraint are you setting?
> >
> > Thanks
> > Gokmen [MSFT]
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > The use of any included script samples are subject to the terms specified
> > at http://www.microsoft.com/info/cpyright.htm
> >
> >
> >
> > "WSD print" wrote:
> >
> > > Hi , I mean that the Function Discovery found two times the same WSD device
> > > .And I have added a constraint for filrating the WSD printer . So is it
> > > normal ? i should add a flag for filrating them .
> > >
> > > "Gokmen Gok [MSFT]" wrote:
> > >
> > > > You should use the Delete method. Can you explain what you mean by "my
> > > > program detects one more time"?
> > > >
> > > > Thanks
> > > > Gokmen [MSFT]
> > > >
> > > > --
> > > > This posting is provided "AS IS" with no warranties, and confers no rights.
> > > > The use of any included script samples are subject to the terms specified
> > > > at http://www.microsoft.com/info/cpyright.htm
> > > >
> > > > "WSD print" wrote:
> > > >
> > > > > Hi , I'm trying to write my program to study the Function
> > > > > Discovery and IPNPXAssociation , but , I saw that in the MSDN's doc , There
> > > > > are two methods Delete and Unassocite , I dont know when I should use Delete
> > > > > and Unassociate ? And in my test's program , once I associated the WSD
> > > > > printer(install the driver , create the port ) , my program detects one more
> > > > > time , so it did the associate one more time . How can I avoid this ?
> > > > >
> > > > > Thanks in advance
> > > > >
> > > > >

Gokmen Gok [MSFT]

unread,
Jun 16, 2009, 1:22:01 PM6/16/09
to

Gokmen Gok [MSFT]

unread,
Jun 18, 2009, 4:46:04 PM6/18/09
to

Can you briefly explain what your program does? What category you are
querying and constraint are you setting?

Thanks
Gokmen [MSFT]

--
This posting is provided "AS IS" with no warranties, and confers no rights.
The use of any included script samples are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm

"WSD print" wrote:

> Hi , I mean that the Function Discovery found two times the same WSD device
> .And I have added a constraint for filrating the WSD printer . So is it
> normal ? i should add a flag for filrating them .
>
> "Gokmen Gok [MSFT]" wrote:
>

WSD print

unread,
Jun 19, 2009, 5:56:01 AM6/19/09
to

Ok , my program is used for discovering my WSD based printers in the network
, So for the category and constraints , I used them like this :

if( S_OK == hr )
hr = m_pFunDisc->CreateInstanceCollectionQuery(
FCTN_CATEGORY_WSDISCOVERY,
NULL,
TRUE,
this,
NULL,
&pQuery);

if( S_OK == hr )
hr = pQuery->AddQueryConstraint(
PROVIDERWSD_QUERYCONSTRAINT_TYPE ,

L"http://schemas.microsoft.com/windows/2006/08/wdp/print/PrintDeviceType" );

if( S_OK == hr )
hr = pQuery->AddQueryConstraint(
PNP_CONSTRAINTVALUE_NOTIFICATIONSONLY ,
L"TRUE" );

I have another question that , in Vista once I execute
PnPXAssociation::Delete , the printer icon and the WSD print port can't be
deleted immediatly , I have to reboot the PC for deleting them . So is it
normal ? Can I manually delete them after execution of the method
PnPXAssociation::Delete ?

Thanks .

WSD print

unread,
Jun 24, 2009, 9:37:01 AM6/24/09
to

Hi , thank you for your response . I have got to delete the printer with the
system function DeletePrinter , and the port immediately . But I got another
problem that was the PKEY_PNPX_Installed/PKEY_PNPX_Associated you talk about
. Once I have deleted my printer by using PNPXDeviceAssociation::Delete and
DeletePrinter , and then I relaunch my prog , I compare the
PKEY_PNPX_Installed/PKEY_PNPX_Associated , it always shows me true , but I
have already deleted printer in the section Device and Printer . So perhaps
there is always somewhere has not changed ? So I found in the section Network
, my printer icon that I have already deleted is always over there(I think
that it's normal because this is a network device) , but when I right click ,
it shows me Uninstall . And then after uninstalling , I can relaunch my prog
, and PKEY_PNPX_Installed becomes false . So I don't know how to resolve
this problem .It seems that the function PNPXDeviceAssociation::Delete
doesn't uninstall this .

Thank you

Gokmen Gok [MSFT]

unread,
Jun 24, 2009, 5:23:01 PM6/24/09
to

Hi,

Delete method is designed to delete the association which triggers the
uninstallation. Same method gets used when you click "Uninstall" in Network
Explorer. Note that for Delete Method to work you need to be calling it from
an elevated process (running as administrator). After your delete call, you
can take a look at HKLM/Software/Microsoft/Function Discovery/Registry
Store/Association DB and see if it really went through and removed the
association. There's an entry for under this key for each device that gets
associated.

WSD print

unread,
Jun 25, 2009, 4:53:01 AM6/25/09
to

Hi , I have look at the registers , when I executed associate , It didn't
create the entry , same for deleting ,it didn't delete the entry , it only
adddd/removed the printer in the section printer , I have executed the progm
by running as admin . So that's why I cant receive the good value for
PKEY_PNPX_Installed/PKEY_PNPX_Associated . In network explorer , when I
install/uninstall , the entry is created/deleted , but the printer in the
section printer was not be added/removed , is it normal? ...... how should I
resolve this problem ?
0 new messages