Micro Focus QTP (UFT) Forums
QTP 11 on Win7 64B does not work with basic wintreeview - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: QTP 11 on Win7 64B does not work with basic wintreeview (/Thread-QTP-11-on-Win7-64B-does-not-work-with-basic-wintreeview)



QTP 11 on Win7 64B does not work with basic wintreeview - qupi - 11-16-2012

QTP 11.
Window 7 64B.

I have a basic wintreeview ("Browse for Folder" dialog)
I scripts are working well on window XP even with QTP 10.
But the scripts will be failed on Win7 64B even i tried with QTP 11.

The treeview is recognized by Object Spy but QTP running will not found it.

Code: (Not only Expand action but also other)
Window("main").Window("dlgAddFolder").Dialog("dlgBrowseForFolder").WinTreeView("treeView").Expand "Desktop;Computer;Local Disk (CSmile"

P/S: You can see enclosed photo for the dialog.


RE: QTP 11 on Win7 64B does not work with basic wintreeview - ManualTester - 11-16-2012

Hi there,

If you wan to just select a folder from the Browse for folder dialog. Try the code mentioned below. It should work.



Code:
Option Explicit
On Error Resume Next
Dim FolderPath  'Path to the folder to be searched for files
Dim objFSO   'The fileSystemObject
Dim objFolder  'The folder object
Dim colFiles  'Collection of files from files method
Dim objFile   'individual file object
Dim strOUT    'Single output variable
subCheckWscript 'Ensures script is running under wscript
subGetFolder  'Calls the browseForFOlder method
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FolderPath)
Set colFiles = objFolder.Files
For Each objFile in colFiles
   strOUT = strOUT & objFile.Name & vbTab & objFile.Size _
   & " bytes" & VbCrLf
Next
WScript.Echo strOUT

' ****** subs below ******
Code:
Sub subCheckWscript
If UCase(Right(WScript.FullName, 11)) = "CSCRIPT.EXE" Then
    WScript.Echo "This script must be run under WScript."
    WScript.Quit
End If
End Sub
Sub subGetFolder
Dim objShell, objFOlder, objFolderItem
Const windowHandle = 0
Const folderOnly = 0
const folderAndFiles = &H4000&
Set objShell = CreateObject("Shell.Application")      
Set objFolder = objShell.BrowseForFolder(windowHandle,  "Select a folder:", folderOnly)      
Set objFolderItem = objFolder.Self  
FolderPath = objFolderItem.Path
End Sub



RE: QTP 11 on Win7 64B does not work with basic wintreeview - qupi - 11-19-2012

Dear ManualTester,

Thank you so much for your codes,

Your code will launch Browse For Folder dialog, wait and capture selecting folder, rite?
It works as you said but my need is automatically select the Tree item on such dialog (the dialog is called by an AUT, not by our script)

On window XP, I simply use this following code to Expand and Select the specified folder:
Code:
Window("main").Window("dlgAddFolder").Dialog("dlgBrowseForFolder").WinTreeView("treeView").Expand "Desktop;Computer;Local Disk (C: )"
Window("main").Window("dlgAddFolder").Dialog("dlgBrowseForFolder").WinTreeView("treeView").Select"Desktop;Computer;Local Disk (C: )"

It is a problem on Win7 Sad
QTP can recognize the Tree object (object.exist -> true) but cann't perform anything on it Sad


RE: QTP 11 on Win7 64B does not work with basic wintreeview - ManualTester - 11-19-2012

Hi,

Let go back two steps and see what we want to achieve, instead of how we want achieve it. Can you please tell me exactly what you want in detail.


Thanks,
Manual


RE: QTP 11 on Win7 64B does not work with basic wintreeview - qupi - 11-20-2012

ManualTester,

Thank you so much for your supporting,

I just want to click on my specified folder which is displayed in the Treeview list.
It is now wokring, I'm not what wrong is!

P/S: I'm using QTP 11 + patch 00699

Whatever, I will post some information if it happen again!


RE: QTP 11 on Win7 64B does not work with basic wintreeview - ManualTester - 11-20-2012

It is good that work around is working!!