Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function to Unload previous loaded DLL
#1
Not Solved
Hi,

Is a function in QTP that will unload the previously loaded DLL.

Used Extern.Declare method to Load DLL.
Reply
#2
Not Solved
I dont think there is any method to unload the previously loaded dll.
You can unload the DLL in QTP by opening a new test. BTW what is the case when you need this, can you please explain?

Reply
#3
Not Solved
Saket is correct. There is no syntax/command to unload a DLL. If your intention is to re-compile your DLL then you may need to open a different test and navigate back to the same test.

Save the blemish...this is the way mercury choose QTP to work :-)
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Not Solved
Saket - FYI:

We have a DLL by the name KLLDLL32 which handles all the open sessions of the AUT when called.
This DLL is called after each test/script so that it can handle/close all the sessions of the application (several tests are run in the Batch mode).
So before each new test begins, DLL is called and it kills the application and then it is supposed to be unload and then a fresh Test begins.

Let me know incase you need more information w.r.t the same.
Reply
#5
Not Solved
Question -
1. how do you call each test? and when do you kill your application through dll.
2. why do you need a dll to kill your application, is this the way the AUT works? or any workaround?

If I am getting it right, You can have two options,
1. If it really requires to kill your test at the end of each test, You should open the AUT at the beginning of each test.
2. Do not call the dll after each test let all test finish then you may call the dll

Reply
#6
Not Solved
Hi Saket,

We use a Driver Scripts to call all our Test Cases.

And it is not only at the end of each test we use the KILLDLL but we also use it at other places to exit from the application.....
Ex: Lets assume we are logging into the Application... and incorrect credentials are entered then system veries userid and then handles the screen.
Below AppKill = Yes.. set the Flag.

Code:
        #Login would happen only if the current user id is different from the previous userid  - [i]Comments[/i]
if (( ( userid != previousUserId ) && ( userid != "" )) || (AppKill = "Yes"))
   {
  #logout the application and Re-Login - [i]Comments[/i]
      if(win_exists("garwin",3) == E_OK)
      {
       call "\\..\\lib\\Kill_Application"();
      }

Mentioned above was just an of our scenarios where DLL was used to handle the odds. Then test case fails and the driver scripts pushs the code to start with the next Test Scripts as mentioned in the driver file - Data Sheet.
So in a similiar way.. where ever necessary we have used this DLL to close the applciation.
Hope this helped. Please let me know if you need more information w.r.t the same.
Kill_Application is the Scripts that calls the DLL and then the DLL does the necessary.
Reply
#7
Not Solved
Hi Prabhu,

can you please post some lines of code from Kill_Application. I beleive there must be some function or object which is being called and closes application. if this is the case then it will be easy to manipulate.
Is there any issue that you can not re-open the AUT once killed?

Reply
#8
Not Solved
Code:

Code:
const DLL_PATH=getenv("M_ROOT") & "\\arch\\KILLDLL.dll";

public function init_dll()
{
    load_dll (DLL_PATH);
    generator_add_category("DLL functions");
    generator_add_function( "dll_kill","Kill the App",1,"arg1","type_edit","",2,"arg2","type_edit","");
    generator_add_function_to_category("DLL functions","dll_kill");
}
public function close_dll()
{
    unload_dll (DLL_PATH);
}

extern int dll_kill(in string,in string);    

init_dll();

#Kill Application
dll_kill("App Identifier","");

AppKill = "Yes";

if(ErrFlag == "Yes")
{
    updateResultFile( )    
}

close_dll();

generator_add_category function is used exclusively with the Function Generator. When new functions are created and the user wishes to place them into a new category, a new category is added to the utility using this function....adds a category to the Function Generator.

generator_add_function function is used exclusively with the Function Generator. It adds a function to the list of those that can be programmed with the Function Generator... adds a TSL function to the Function Generator.

generator_add_function_to_category function is used exclusively with the Function Generator. It adds a function which is already in the function table to a previously defined category. This function is useful when adding a new function to the Function Generator.

getenv function reads the current value of an environment variable.
Reply
#9
Not Solved
I guess you are trying to implement this particular script in QTP, in which you have Close_DLL function and you are not able to do that. Am I right?
in that case I can say dont bother for unloading the dll. once you open a new test QTP unloads the dll itself.
you can use the dll in your script wherever you need to kill the application, using Extern.Declare or createobject (whatever applicable)
Now whenever you need to Kill the application just call your function dll_Kill.
once your application is killed, You will have to reopen your Application to proceed further, for this check your application is open or not each time your test case begins and if not open it.
does this help?

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 5,897 06-26-2015, 12:31 AM
Last Post: babu123
Exclamation How to verify whether pdf is completely loaded or not in webpage nmakkena 1 2,474 08-27-2014, 04:09 PM
Last Post: vinod123
  How to call testscript after executing previous one. upadhyay40 3 3,539 04-27-2014, 10:14 PM
Last Post: Wigi
  Using QTP with dynamically loaded swf QDev 0 1,792 01-18-2013, 08:37 PM
Last Post: QDev
  Verify images get properly loaded or not(Broken Images) in respective pages nilanjans 4 3,810 01-17-2013, 10:51 AM
Last Post: nilanjans

Forum Jump:


Users browsing this thread: 1 Guest(s)