Function to Unload previous loaded DLL - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Function to Unload previous loaded DLL (/Thread-Function-to-Unload-previous-loaded-DLL) |
Function to Unload previous loaded DLL - prabhu656656 - 08-26-2009 Hi, Is a function in QTP that will unload the previously loaded DLL. Used Extern.Declare method to Load DLL. RE: Function to Unload previous loaded DLL - Saket - 08-27-2009 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? RE: Function to Unload previous loaded DLL - basanth27 - 08-27-2009 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 :-) RE: Function to Unload previous loaded DLL - prabhu656656 - 08-27-2009 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. RE: Function to Unload previous loaded DLL - Saket - 08-27-2009 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 RE: Function to Unload previous loaded DLL - prabhu656656 - 08-27-2009 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] 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. RE: Function to Unload previous loaded DLL - Saket - 08-27-2009 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? RE: Function to Unload previous loaded DLL - prabhu656656 - 08-27-2009 Code: Code: const DLL_PATH=getenv("M_ROOT") & "\\arch\\KILLDLL.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. RE: Function to Unload previous loaded DLL - Saket - 08-28-2009 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? |