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

Why does code work on a computer with Windows 2000 but not on a computer with Windows XP?

1 view
Skip to first unread message

Gary

unread,
Jul 31, 2003, 1:10:58 PM7/31/03
to
Hello,

I have a Visual Basic 6 program that runs perfectly on my
Windows 2000 computer. After running the package and deployemnt wizard
to create the setup files, and installing the program on a Windows XP
computer, the program does not run as expected. The block of code that
runs in the click event of a button, that is causing a problem is:


'Please note that the file system object is not being used because it
doesn't have any properties to return the extended properties such as
author, title, keyword, comment, 'source, etc.

'This solution does work on my computer, just not on a computer with
Windows XP.

Dim oShell As Shell
Dim oFolder As Folder
Dim oFolderItem As FolderItem
Dim sDir as string

sDir = "C:\" 禅his is the root directory and set to the C
drive as a test
Set oShell = CreateObject("Shell.Application")

Set oFolder = oShell.NameSpace(sDir)
'File1 is the name of a listbox control and File1.filename is
the name of the selected file
If (Not oFolder Is Nothing) Then
Set oFolderItem = oFolder.ParseName(File1.FileName)
If (Not oFolderItem Is Nothing) Then
'FileInfo!txtname.text is a text box on another form
that is previously loaded into memory
FileInfo!txtName.Text = oFolderItem.ExtendedProperty("Title")
'retreive the author
'FileInfo!txtpublisher.text is a text box on another form that is
previously loaded into memory
FileInfo!txtPublisher.Text =
oFolderItem.ExtendedProperty("Author")
Else
MsgBox "Cannot retreive file properties"
End If
End If
On Error Resume Next 'continue forward even if the file type
is wrong
Set oShell = Nothing
Set oFolder = Nothing
Set oFolderItem = Nothing

The main problem that I noticed is that the return value of my object
variable named oFolder is blank when the program is run on a Windows
XP computer. The oFolder is a variable of the folder datatype (in the
shell library) and it is in my test case pointing to the root
directory on the C Drive, or in other words, the folder would be C:\.
However, when the code is run on the Windows XP computer, the oFolder
is set to nothing which is not expected.

I have explicitly provided a datatype for each of the variable,
believing that may be the problem, but that didn't help.

For some unknown reason, the oFolder object (Folder type) is not being
set and instead is pointing to nothing. Do you know why this occurs on
computers with Windows XP and not on my development computer with
Windows 2000?

In all cases, the statement "If (not oFolder is nothing) then" should
always evaluate to true because oFolder should be pointing to the C:\.


File1.filename represents a selected file in a file list box control
that I have. File1.filename isn't the problem.

One final note. I have set a reference to the Microsoft Shell Controls
and Automation in the Visual Basic Project
(C:\Winnt\System32\show32.dll) with Project |References. This library
contains the folder, folderitem, and shell objects.

One other thing which may or may not account for the reason.

On my Windows 2000 computer:
shell32.dll version is 5.0.3502.6144
Size 2.24 MB (2,354,448 bytes)

On the Windows XP computer:
shell32.dll version is 6.0.2800.1233
Size 7.85 MB (8,240,640 bytes)


As you can see the two shell32.dll files have different sizes and are
different versions. Could this account for the reason why it doesn't
work on the Windows XP computer? I made the setup files on the Windows
2000 computer that also has Visual Basic 6. The Windows XP computer
does not have Visual Basic 6 installed and is the test target
computer.


I would think that the shell32.dll version 6.0.2800.1233 would be
backward compatible with version 5.0.3502.6144. Am I wrong? Or in
other words, both files would be okay. What should I do to solve this
problem?

If this code doesn't work on a Windows XP but does on a Windows 2000,
does anyone know how to solve this so that it will work? Am I missing
something? I did copy the code from the MSDN, but renamed objFolder to
oFolder and modified the code as necessary to meet my needs. Here is
the Url for the code I copied:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/folder/parsename.asp

Then, click on the link labeled Visual Basic example.

Anyway, any help is most appreciated and I thank you all in advance.
Thanks so much again.

Hans H.

unread,
Jul 31, 2003, 1:13:32 PM7/31/03
to
I had a similar problem with another dll. After installing VB6 on windows XP
and conducting a new compilation, the problem had gone.
Maybe it also works for You.


--
Hans Heezemans
h...@iservi.com
www.iservi.com


"Gary" <ga...@globalipgroup.com> schreef in bericht
news:87390280.03073...@posting.google.com...


> Hello,
>
> I have a Visual Basic 6 program that runs perfectly on my
> Windows 2000 computer. After running the package and deployemnt wizard
> to create the setup files, and installing the program on a Windows XP
> computer, the program does not run as expected. The block of code that
> runs in the click event of a button, that is causing a problem is:
>
>
> 'Please note that the file system object is not being used because it
> doesn't have any properties to return the extended properties such as
> author, title, keyword, comment, 'source, etc.
>
> 'This solution does work on my computer, just not on a computer with
> Windows XP.
>
> Dim oShell As Shell
> Dim oFolder As Folder
> Dim oFolderItem As FolderItem
> Dim sDir as string
>

> sDir = "C:\" 'This is the root directory and set to the C

Gary

unread,
Jul 31, 2003, 5:18:25 PM7/31/03
to
Hello, Thanks for the help. I appreciate it.

I think I am going to have to compile the program and make a new setup
on the computer with Windows XP to see if it will work. Then I plan to
take the setup program and run it on another Windows XP PC to see if
it installs okay and then run the program. From what you are telling
me, this should fix the problem. I should know fairly shortly.

Now a new problem may occur. What if I run the new setup program on my
computer that has Windows 2000 or any other PC with Windows 2000 that
doesn't have VB 6? Will the application work? I am just not sure. I
guess I won't know for sure, unless I actually try it.

I will get back to you with my results.

0 new messages