Discussion:
ParseDisplayName problem.
(too old to reply)
JoDeGr8
2009-08-27 06:29:51 UTC
Permalink
I am using IShellFolder::SelectItem to select multiple items from a
folder. The following is the code i am using to get things done. The
problem is that ParseDisplayName is always failing. HRESULT says it is
because "a null reference pointer is passed into the stub". I am
getting proper value in *psf. Please tell me why is it happening so?


IShellFolder *psf;
if (SUCCEEDED(ppf2->QueryInterface
(IID_IShellFolder,
(void**)
&psf))) {



HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
}

Regards,
J
Igor Tandetnik
2009-08-27 12:38:38 UTC
Permalink
Post by JoDeGr8
I am using IShellFolder::SelectItem to select multiple items from a
folder. The following is the code i am using to get things done. The
problem is that ParseDisplayName is always failing. HRESULT says it is
because "a null reference pointer is passed into the stub". I am
getting proper value in *psf. Please tell me why is it happening so?
HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
Somehow, you are getting IShellFolder pointer from a wrong thread, and
ending up with a proxy. As an immediate workaround, try passing a valid
pointer for pchEaten parameter. But really, you should figure out why
you are getting a proxy and not a direct pointer, and fix that.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
JoDeGr8
2009-08-27 18:44:16 UTC
Permalink
Post by Igor Tandetnik
Post by JoDeGr8
I am using IShellFolder::SelectItem to select multiple items from a
folder. The following is the code i am using to get things done. The
problem is that ParseDisplayName is always failing. HRESULT says it is
because "a null reference pointer is passed into the stub". I am
getting proper value in *psf. Please tell me why is it happening so?
  HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
Somehow, you are getting IShellFolder pointer from a wrong thread, and
ending up with a proxy. As an immediate workaround, try passing a valid
pointer for pchEaten parameter. But really, you should figure out why
you are getting a proxy and not a direct pointer, and fix that.
--
With best wishes,
    Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Thanks for the reply....I tried hr =psf->GetDisplayNameOf(pidlItem,
SHGDN_INFOLDER,
&str);
with the same *psf....In this case hr says "S_OK";
Igor Tandetnik
2009-08-27 19:13:17 UTC
Permalink
Post by JoDeGr8
Post by Igor Tandetnik
Post by JoDeGr8
I am using IShellFolder::SelectItem to select multiple items from a
folder. The following is the code i am using to get things done. The
problem is that ParseDisplayName is always failing. HRESULT says it
is because "a null reference pointer is passed into the stub". I am
getting proper value in *psf. Please tell me why is it happening so?
HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
Somehow, you are getting IShellFolder pointer from a wrong thread,
and ending up with a proxy. As an immediate workaround, try passing
a valid pointer for pchEaten parameter. But really, you should
figure out why you are getting a proxy and not a direct pointer, and
fix that.
Thanks for the reply....I tried hr =psf->GetDisplayNameOf(pidlItem,
SHGDN_INFOLDER,
&str);
with the same *psf....In this case hr says "S_OK";
Is there a question in there somewhere?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
JoDeGr8
2009-08-28 03:26:18 UTC
Permalink
Post by Igor Tandetnik
Post by JoDeGr8
Post by Igor Tandetnik
Post by JoDeGr8
I am using IShellFolder::SelectItem to select multiple items from a
folder. The following is the code i am using to get things done. The
problem is that ParseDisplayName is always failing. HRESULT says it
is because "a null reference pointer is passed into the stub". I am
getting proper value in *psf. Please tell me why is it happening so?
HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
Somehow, you are getting IShellFolder pointer from a wrong thread,
and ending up with a proxy. As an immediate workaround, try passing
a valid pointer for pchEaten parameter. But really, you should
figure out why you are getting a proxy and not a direct pointer, and
fix that.
Thanks for the reply....I tried hr =psf->GetDisplayNameOf(pidlItem,
                                                   SHGDN_INFOLDER,
                                                   &str);
with the same *psf....In this case hr says "S_OK";
Is there a question in there somewhere?
--
With best wishes,
    Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
I mean why only ParseDisplayName fails?
Igor Tandetnik
2009-08-28 11:54:21 UTC
Permalink
Post by JoDeGr8
Post by Igor Tandetnik
Post by JoDeGr8
Post by Igor Tandetnik
Post by JoDeGr8
I am using IShellFolder::SelectItem to select multiple items from
a folder. The following is the code i am using to get things
done. The problem is that ParseDisplayName is always failing.
HRESULT says it is because "a null reference pointer is passed
into the stub". I am getting proper value in *psf. Please tell me
why is it happening so?
HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
Somehow, you are getting IShellFolder pointer from a wrong thread,
and ending up with a proxy. As an immediate workaround, try passing
a valid pointer for pchEaten parameter. But really, you should
figure out why you are getting a proxy and not a direct pointer,
and fix that.
Thanks for the reply....I tried hr =psf->GetDisplayNameOf(pidlItem,
SHGDN_INFOLDER,
&str);
with the same *psf....In this case hr says "S_OK";
Is there a question in there somewhere?
I mean why only ParseDisplayName fails?
I explained that in my first response.

Now, what you probably wanted to ask is why GetDisplayNameOf *doesn't*
fail. Recall the error message you are getting: "a null reference
pointer is passed into the stub". In your GetDisplayNameOf call, you are
not passing any NULL pointers. You are still calling through a proxy,
you just don't tickle it in a particular way that causes the problem to
manifest.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
JoDeGr8
2009-08-28 03:30:47 UTC
Permalink
Post by Igor Tandetnik
Post by JoDeGr8
Post by Igor Tandetnik
Post by JoDeGr8
I am using IShellFolder::SelectItem to select multiple items from a
folder. The following is the code i am using to get things done. The
problem is that ParseDisplayName is always failing. HRESULT says it
is because "a null reference pointer is passed into the stub". I am
getting proper value in *psf. Please tell me why is it happening so?
HRESULT hr = psf->ParseDisplayName
(NULL,NULL,g_szPath,NULL,pidlSelected,NULL);
Somehow, you are getting IShellFolder pointer from a wrong thread,
and ending up with a proxy. As an immediate workaround, try passing
a valid pointer for pchEaten parameter. But really, you should
figure out why you are getting a proxy and not a direct pointer, and
fix that.
Thanks for the reply....I tried hr =psf->GetDisplayNameOf(pidlItem,
                                                   SHGDN_INFOLDER,
                                                   &str);
with the same *psf....In this case hr says "S_OK";
Is there a question in there somewhere?
--
With best wishes,
    Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
I mean why only ParseDisplayName fails?
Loading...