Home » Developer & Programmer » Forms » Software lock (forms, 6i, 9i)
Software lock [message #548749] Sun, 25 March 2012 20:57 Go to next message
shahzad-ul-hasan
Messages: 229
Registered: August 2002
Senior Member
Dear
i want to lock my software after one week time.i want to make it trial.i have written the following code in when_new_form_instance.
................................................
Begin
If :SYSTEM.CURRENT_DATETIME>='02-04-2012' THEN
Set_Menu_Item_Property(m,ENABLED,PROPERTY_FALSE);
MESSAGE('YOUR TRIAL PERIOD IS OVER. PLEASE CONTACT US...');
MESSAGE('YOUR TRIAL PERIOD IS OVER. PLEASE CONTACT US...');
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;
------------------------------------------------------------
First Error:
Cannot find the menu item. invalid id.
Software open. no locking is occure.
Second Error.
if the date is 30-Mar, 2012. it will also gives me message of your trial period is over.After that software is also opened.
....................................................
please help me to correct this solutions.
Re: Software lock [message #548752 is a reply to message #548749] Mon, 26 March 2012 00:36 Go to previous messageGo to next message
Littlefoot
Messages: 18826
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What is "m" in SET_MENU_ITEM_PROPERTY?

'02-04-2012' is not a date - it is a character string. You should ALWAYS use TO_DATE function in such cases:
... to_date('02-04-2012', 'dd-mm-yyyy')
Re: Software lock [message #548821 is a reply to message #548752] Mon, 26 March 2012 08:31 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
Have u solve your problem
Re: Software lock [message #548829 is a reply to message #548821] Mon, 26 March 2012 09:09 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 229
Registered: August 2002
Senior Member
not yet
Re: Software lock [message #548839 is a reply to message #548829] Mon, 26 March 2012 10:45 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
Dear its very very very easy just copy this and paste this code in when-new-form-instance

declare 
    cur_date date default sysdate;
    begin_date date default '12-apr-2012';
    dif number(2);
begin
   dif := cur_date - begin_date;
   if dif < 5 then
set_WINDOW_property(FORMS_MDI_WINDOW,WINDOW_STATE,MAXIMIZE);
set_window_property('WINDOW1',WINDOW_STATE,MAXIMIZE); 
    else
  EXIT_FORM; 
 message('YOUR TRIAL PERIOD IS OVER. PLEASE CONTACT US...');
 message('YOUR TRIAL PERIOD IS OVER. PLEASE CONTACT US...');

  end if;
end;



OR if u wanted to removed complete folder then use this

host ('deltree/y e:\saved');--- instead of "EXIT_FORM"





Hope your problem solved

[Updated on: Mon, 26 March 2012 10:51]

Report message to a moderator

Re: Software lock [message #548921 is a reply to message #548839] Tue, 27 March 2012 03:19 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 229
Registered: August 2002
Senior Member
solved thnks for help.
Re: Software lock [message #549262 is a reply to message #548921] Thu, 29 March 2012 04:37 Go to previous messageGo to next message
dude4084
Messages: 213
Registered: March 2005
Location: Mux
Senior Member
but what if one changes system date to some back date and then restart form?
Re: Software lock [message #549287 is a reply to message #549262] Thu, 29 March 2012 06:56 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 229
Registered: August 2002
Senior Member
you have to compare date in (MM-YYYY, MM-YYYY).
exaple: between '02-2010' and 04-2999'
Hope you will understand.
Re: Software lock [message #549333 is a reply to message #549287] Thu, 29 March 2012 10:23 Go to previous message
Littlefoot
Messages: 18826
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd be very happy with a trial period of almost 1000 years.

P.S. What I meant to say was: I don't understand you at all.

[Updated on: Thu, 29 March 2012 10:24]

Report message to a moderator

Previous Topic: sequence number to be diplayed in form
Next Topic: How to Hide a Button while Runtime
Goto Forum:
  


Current Time: Fri Apr 18 18:56:57 CDT 2014

Total time taken to generate the page: 0.10241 seconds