Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP 11 on Win7 64B does not work with basic wintreeview
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
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.


Attached Files Image(s)
   
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
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
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
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!
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
It is good that work around is working!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Does QTP Recognize IBM Work place forms 2.7??? nit_naresh 0 2,340 09-04-2011, 10:43 AM
Last Post: nit_naresh
  Is QTP10 Supports Win7 64 Bit platform OS JyotiRanjan 6 7,310 08-23-2011, 07:54 AM
Last Post: Setsuna F. Seiei
  QTP11 and WIN7 64 bit applications madankumar.jayapal 0 7,179 01-20-2011, 05:04 PM
Last Post: madankumar.jayapal
  js errors with qtp 10 on win7 vs. IE8 yaniv mendelson 2 4,125 03-15-2010, 03:52 PM
Last Post: yaniv mendelson
  Basic concept of QTP shwetap 1 2,611 11-11-2009, 04:43 PM
Last Post: Tarik Sheth

Forum Jump:


Users browsing this thread: 1 Guest(s)