Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

obj_get_text method freezes my PC !

Status
Not open for further replies.

starchen

Programmer
Jun 12, 2003
1
FR
Hi, i'm working on winrunner 7.01 and i use it on an app build from powerbuilder.
I need to get the content of an object (class object) but I didn't manage to use the obj_get_text method nor the edit_get_text method. It freezes my PC and I have to logout from windows XP to continue working.
Is there any other method to get text from objects?
 
Hi,
I have same problem. The obj_get_text() worked
on one PC but not another. Try out below code.
It did not work for me, but I think this problem is PC environment/OS related.
It might for you. Let me know.

Code:
#
#  I tried with below code. 
#  I wanted to get contents of a unix vt100 window.
#  I found text variable was initialised but empty.
#  Guy below has a site [URL unfurl="true"]http://www.recook.com/WinRunner/TSL_Solutions.htm[/URL]
#
text="No text retrieved";
set_window("Untitled - Reflection for UNIX and Digital", 1);

if (obj_exists ("r2Display") == E_OK)	
{     
   ObjGetTextWM("r2Display", text, 100);
   print(text);
}    
else
{
   print("Aha!!!! Unix window not found");
}   




################
# Retrieve text from an object by sending a Windows message. SOMETIMES works when obj_get_text() fails.
# 
# Requirements
# 	Module win32api must be available, in the search path. It is installed by default in the WinRunner\lib folder.
# 	Object must be in GUI map.
# 	Set the window before calling function.
# 
# Parameters
# 	object: logical name of the object
# 	output_text: variable that receives the captured text 
# 	max_chars (optional): maximum number of characters to retrieve. Use only if you need more than the default value of 512.
# 
# Return value
# 	rc >= 0: number of characters retrieved
# 	rc < 0: standard WinRunner return value 
# 
# Written by: Dr. Richard Cook
# Date: 2/22/2002
################ 

public function ObjGetTextWM(in object, out output_text, in max_chars)
{
	auto WM_GETTEXT, api_module, rc, handle;
			
	## Load the windows API module.
	api_module = "win32api";
	rc = load(api_module , 0, 1);
	if(rc != E_OK)
		return rc;
	
	## Define the message constant (in Windows format).
	WM_GETTEXT = 13;
	
	## Define the default maximum number of characters to retrieve.
	if( ! max_chars )
		max_chars = 512; 

	## Get the object's handle in the variable handle.
	rc = obj_get_info(object, "handle", handle);
	if(rc != E_OK)
		return rc;
	
	## Send message requesting the text.
	## Text is retrieved into the output_text variable.
	rc = SendMessageString(handle, WM_GETTEXT , max_chars, output_text);
	
	## Unload the module.
	unload(api_module);
	
	## Return code is the number of characters retrieved.
	return rc;

} # end ObjGetTextWM()
 
I am trying to connect to Oracle database thru Winrunner to execute some DB validations, but unable to figure out how to configure the Oracle db and where to give the user_id and password
Any help will be appreciated!!!

Thanks!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top