|
-
December 23rd, 2008, 08:07 PM
#1
Vista Explorer.exe problem
this works fine in any version of windows all the way up to XP..
It will not work in vista, is just opens the "users" folder and selects nothing.
Code:
//open and select the file in windows explorer
//more info about this at http://support.microsoft.com/default...;EN-US;q152457
CString sFile = "C:\\test.txt";
CString s;
s.Format("/select,\"%s\"",sFile);
ShellExecute(NULL,_T("Open"),_T("Explorer"),s,NULL,SW_SHOWDEFAULT);
Does anyone know how to make this work in vista?
I have looked through MSDN and found nothing
-
December 23rd, 2008, 09:10 PM
#2
Re: Vista Explorer.exe problem
Could be UAP getting invoked...try it with a target in the documents folder. (The average user should NOT have access to the root of the drive!)
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 23rd, 2008, 09:22 PM
#3
Re: Vista Explorer.exe problem
-
December 23rd, 2008, 09:24 PM
#4
Re: Vista Explorer.exe problem
Did you TRY a file in the Documents ddirectory?
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 23rd, 2008, 09:25 PM
#5
Re: Vista Explorer.exe problem
 Originally Posted by 12oclocker
I have UAP disabled
yes, but user permissions are still in effect. try saving in different folder, as suggested before.
by the way, I believe it is UAC (User Account Control)
-
December 23rd, 2008, 09:27 PM
#6
Re: Vista Explorer.exe problem
You are correct....is it UAC....I have just been making soo many posts about AUP (A totally different subject) that I had a case of happy fingers)
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 23rd, 2008, 09:34 PM
#7
Re: Vista Explorer.exe problem
lol, I knew what you ment about UAC, I disabled all the junk, lol
yes, it still will not work in the documents directory, it works fine when I try it from a command line.... It IS executing Explorer.exe, but its NOT passing the "lpParameters" I have defined.
I know the lpParameters are correct, because it works perfect in XP, and even in Vista from a command line.
For some reason it seems Vista is Ignoring ShellExecute's lpParameters
-
December 23rd, 2008, 10:10 PM
#8
Re: Vista Explorer.exe problem
so this is what I am forced to do right now, because vista I guess sucks....
Code:
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
::GetVersionEx(&osv);
if(osv.dwPlatformId == VER_PLATFORM_WIN32_NT && osv.dwMajorVersion >= 6)//Windows Vista
{
ShellExecute(NULL,_T("open"),GetParentDir(sFile),NULL,NULL,SW_SHOWDEFAULT);
}
else //WinXP, 2K, etc
{
CString s;
s.Format("/n,/select,%s",sFile);
ShellExecute(NULL,_T("open"),_T("explorer.exe"),s,_T("%SystemRoot%"),SW_SHOWDEFAULT);
}
So now I can open the folder with the file in it, BUT I cannot have the file selected as I can in windows XP, because VISTA is Ignoring my Params for "explorer.exe"
anyone have any ideas??
-
December 23rd, 2008, 10:18 PM
#9
Re: Vista Explorer.exe problem
Are you SURE it did not work, if you specify just "test.txt" (No PAth, just name, extension) and you have "Test.txt" in your Documents folder?????
That SHOULD work. (And a quick test on my machine did!)
One of the DOCUMENTED changes in explorer.exe is that it ALWAYS starts in your documents folder, and that there are restrictions.
If you want to change your default folder for Explorer.exe there are way such as: http://blogs.msdn.com/rextang/archiv...1/8347682.aspx
You will also note that the documentation for /select ONLY covers XP and does NOT mention Vista.... http://support.microsoft.com/default...4853#appliesto
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 23rd, 2008, 10:28 PM
#10
Re: Vista Explorer.exe problem
"/select" does work in vista (see example D)
http://www.vistax64.com/tutorials/71...t-opening.html
copy and paste this into your command line....
%SystemRoot%\explorer.exe /n, /select, C:\WINDOWS\system32\notepad.exe
once you execute that, vista will open a new explorer window, and select "notepad.exe" and scroll it into view. that is what I am trying to get my application to do.
it works perfect from the command line in vista, it wont work in ShellExecute, ShellExecuteEx, or WinExec, ect from my application.
I am currently log in as administrator, and my application has be launched under my administrative privilege level.
BUT I can call the explorer.exe process without any problems in my application, it just wont process any of the switches I send it via ShellExecute.
So I CAN open a folder to any drive, etc. I just cant select a file in the folder because VISTA is ignoring the switches I sent to Explorer.exe via my program.
I need my application to be able to do this no matter where the folder is located, even if it does work in the documents folder, it does not solve my problem.
Last edited by 12oclocker; December 23rd, 2008 at 10:32 PM.
-
December 23rd, 2008, 10:36 PM
#11
Re: Vista Explorer.exe problem
 Originally Posted by 12oclocker
I need my application to be able to do this no matter where the folder is located, even if it does work in the documents folder, it does not solve my problem.
The first step in solving any problem is to analyze the various permutations. By changing to just a filename and using the default location,it eliminates some conditions.
Another parallel test would be to ignore explorrer, and just attempt to get the parameters through to a simple "echo" type program that will display what is being passed to it.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 24th, 2008, 10:56 AM
#12
Re: Vista Explorer.exe problem
The /select option works for Vista. I would suggest you to:
- use "explore" the verb.
- Do not specify "Explorer.exe" as File-name to open.
- Try specifying other parameter for Explorer (other than /select).
- Use Null as verb.
Try the combinations, and get it solved!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|