Home » Developer & Programmer » Forms » How Do I find out "in code" what type of operating system a user is running ( XP or 2000 )  () 1 Vote
How Do I find out "in code" what type of operating system a user is running ( XP or 2000 ) [message #166500] Thu, 06 April 2006 12:23 Go to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
I am using Oracle6i with a button that calls MS Word.

I have a user that has upgraded from 2000 to XP and now Word will not load when they click the button. Word has a different path now. How do I write in code to check if a user has the 2000 operating system use this path - or if a user has XP operating system use this path.

Any help is appreciated.

[Updated on: Thu, 06 April 2006 12:32]

Report message to a moderator

Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #166548 is a reply to message #166500] Thu, 06 April 2006 21:37 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Try the 'Get_application_Property' command with 'OPERATING_SYSTEM' and then 'USER_INTERFACE'. Please reply with your results.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #167632 is a reply to message #166548] Fri, 14 April 2006 16:25 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
I do not understand?

Please explain how.
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #167908 is a reply to message #167632] Mon, 17 April 2006 21:44 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do you have Forms installed on your PC?

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #168092 is a reply to message #167908] Tue, 18 April 2006 14:27 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
Yes I do have oracle forms builder 6i installed on my PC.

- Thank you for the assistance.
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #168111 is a reply to message #168092] Tue, 18 April 2006 20:09 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Create a dummy form, on the form's canvas create a button with a When-Button-Pressed trigger, in the trigger place code like
declare
  l_var varchar2(40);
begin
  l_var := Get_Application_Property(OPERATING_SYSTEM);
  message(l_var); pause;
  l_var := Get_Application_Property(USER_INTERFACE);
  message(l_var); pause;
end;
Compile, generate, run, read.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #168313 is a reply to message #168111] Wed, 19 April 2006 14:15 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
I sure do appreciate your help in this matter,

when I ran the statement on a trigger of a button, I recieved the same result on both a XP machine and Windows 2000 machine.

Both have Oracle 6i Forms builder installed.

Message 1 = WIN32COMMON

Message2 = MSWINDOWS32

- so it looks as though I am back to square 1.

Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #168379 is a reply to message #168313] Thu, 20 April 2006 02:33 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay ... thanks for trying ... they were the easier ones. Now try the d2kwutil facility and its various win_api functions. More specifically WIN_API_ENVIRONMENT.Get_Windows_Version

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #169194 is a reply to message #168379] Tue, 25 April 2006 13:07 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
O-k so I tried the dk2wutil.dll for the GET_WINDOWS_VERSION and it returned both "windows2000" on the XP machine as well as the 2000 machine.

Below is the actual infomation of the function that is displayed when running the function in builder.

/*

Get Windows Version returns the current version of windows as a string. One of the following values (note the case) will be returned:
Windows95
Windows98
WindowsNT
Windows2000

Arguments:
(NONE)
Returns: String containing the Windows Version in the format above

*/

I am thinking that the D2KWUTIL is not yet able to recognize XP yet.

So basically i am lost, again.

Thanks for the help

Tom.
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #169289 is a reply to message #169194] Wed, 26 April 2006 02:37 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
This 'sux'! Have you looked at all the other WIN_API_ENVIRONMENT functions?

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #169442 is a reply to message #169289] Wed, 26 April 2006 19:44 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I discussed your problem with a colleague and as well as using the 'registry' read facility to get your information, they suggested you could use 'ora_ffi' and the Windows API which gives the system information. The information we are referring to is that which is associated with the 'properties' right-mouse menu item of 'My Computer'. You will have to search a Windows forum or web site to get the name of that API. You may be able to deduce it by searching the 'win' or 'win/system32' directory.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #169613 is a reply to message #169442] Thu, 27 April 2006 14:38 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
Wow, thanx alot .... you really helped me learn alot in these past few posts.

I really got lost with this situation...I am a very novice programmer just hired out of college with a state agency here in Phoenix, Arizona U.S.A. All of your assistance has helped me grow as a programmer / analyst. Keep up the good work.

- oh I will look into your last suggestion, and will get back to you later.

- TOM.


-by the way the "START WORD" code that I currently have is below:

IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN

MESSAGE('Application is already running.');

ELSE
appl_name := 'C:\Program Files\Microsoft Office\Office\WINWORD.EXE';
:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);

END IF;


- MY QUESTION IS IT POSSIBLE TO JUST HAVE LIKE AN ELSIF STATEMENT OR SOMETHING TO THAT AFFECT TO SAY TAKE THE ABOVE PATH AND IF 'WINWORD.EXE' ISN'T THERE GO TO
'C:\Program Files\Microsoft Office\Office11\WINWORD.EXE' .... JUST A THOUGHT. PLEASE ADVISE.

[Updated on: Thu, 27 April 2006 15:49]

Report message to a moderator

Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #169938 is a reply to message #169613] Sun, 30 April 2006 21:26 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I haven't looked at the 'DDE' package lately, but do you get a return code from the 'APP_BEGIN'? If so, then test it. Alternatively, if each machine has only one of the two directories then start BOTH. One will work and one will fail. Whichever way the user gets ONE word session. How 'dirty' the solutions is, is not really relevant.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170242 is a reply to message #169938] Tue, 02 May 2006 17:35 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
David, Sorry again, but I am completely feeling stupid.

How do I start both directories.

this is the original code I have to start the WINDOWS 2000 directory.



IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN
MESSAGE('Application is already running.');


ELSE
appl_name := 'C:\Program Files\MicrosoftOffice\Office\WINWORD.EXE';
:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);


END IF;


Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170248 is a reply to message #170242] Tue, 02 May 2006 19:05 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN
  MESSAGE('Application is already running.');
ELSE
  -- one
  appl_name := 'C:\Program Files\MicrosoftOffice\Office\WINWORD.EXE';
  :GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);
  -- two
  appl_name := 'C:\Program Files\Microsoft Office\Office11\WINWORD.EXE';
  :GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);
END IF;
What result do you get in the 'GLOBAL.application_id' when it exists and what do you get in the 'GLOBAL.application_id' when it does not exist.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170568 is a reply to message #170248] Thu, 04 May 2006 06:42 Go to previous messageGo to next message
Mohannad
Messages: 47
Registered: January 2006
Location: palestine
Member

is it work in oracle 9i or what ?
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170570 is a reply to message #170568] Thu, 04 May 2006 06:45 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Mohannad,

If you have Forms 9 and Word available why don't you try it and then tell us. I don't.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170685 is a reply to message #170248] Thu, 04 May 2006 16:17 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
Ok, so I tried the following to start one of the directories:

IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN
MESSAGE('Application is already running.');
ELSE

-- one
appl_name := 'C:\Program Files\Microsoft Office\Office\WINWORD.EXE';
:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);

-- two
appl_name := 'C:\Program Files\Microsoft Office\Office11\WINWORD.EXE';
:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);

END IF;

= The XP machine has the "Office11" directory and the code above runs on the XP machine. When trying to run the above on the 2000 machine with the basic "office" directory on top it does not get run. Nothing happens. - But if I switch the directories on the 2000 machine to have the "office" for the second "appl_name" it runs.

= So basically which ever one is called last and is on the machine with the directory specified, gets ran.

= Man O Man am I so clueless on this one. Thanks for all the help. It sure is appreciated. - Dude were damn near starting to write a book here.
Quote:


[Updated on: Thu, 04 May 2006 16:22]

Report message to a moderator

Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170702 is a reply to message #170685] Thu, 04 May 2006 18:56 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Some things are non-trivial. Some just need perservance. There are MANY threads way, WAY longer than this one.

I would still like to know what is returned in ':GLOBAL.application_id' after a successful, and after an unsuccessful call to DDE.

David
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170860 is a reply to message #170685] Fri, 05 May 2006 09:51 Go to previous messageGo to next message
Mohannad
Messages: 47
Registered: January 2006
Location: palestine
Member

can u write the code well with her begin and end in .
thanks .
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170892 is a reply to message #170860] Fri, 05 May 2006 16:54 Go to previous messageGo to next message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
BEGIN
	
DECLARE

	appl_name		  		varchar2(255);
	appl_name2		  		varchar2(255);
	docid         				pls_integer;
	ws_current_date				varchar2(60);
	ws_current_day_year                     varchar2(20);
	ws_current_month                        varchar2(20);
	hold_city				varchar2(20);
	hold_st					varchar2(02);
	hold_zipcode				varchar2(10);
	hold_street				varchar2(100);
	hold_lab_dir_firstname		        varchar2(25);
	hold_lab_dir_lastname			varchar2(25);
	hold_lab_dir_salutation		        varchar2(15);
	ws_city_st_zip				varchar2(50);
	ws_lab_dir_name         	        varchar2(75);
	ws_lab_dir_salutation   	        varchar2(75);
	ws_user_name	   			varchar2(20);
	ws_password_name			varchar2(20);
	ws_connect_string_name                  varchar2(20);
	
	
BEGIN
	ws_user_name := get_application_property(username);
	ws_password_name := get_application_property(password);
	ws_connect_string_name := get_application_property(connect_string);

	select 
		mailcity, 
		mailst, 
		mailzip, 
		mailstreet, 
		lab_dir_firstname, 
		lab_dir_lastname, 
		lab_dir_salutation
		
	into 
		hold_city, 
		hold_st, 
		hold_zipcode, 
		hold_street, 
		hold_lab_dir_firstname, 
		hold_lab_dir_lastname, 
		hold_lab_dir_salutation
		
	from h64laboratory_details
	where :h64laboratory_details.azlicense = azlicense;
	
	ws_city_st_zip  := hold_city||', '||hold_st||' '||hold_zipcode;
		
	If substr(hold_lab_dir_lastname,1,2) = 'Mc' or
		 substr(hold_lab_dir_lastname,1,2) = 'MC'	then
		 
		 	If substr(hold_lab_dir_salutation,1,3) = 'Dr.'		then
		 		ws_lab_dir_name := hold_lab_dir_firstname||' '||substr(hold_lab_dir_lastname,1,2)||
		 											 substr(hold_lab_dir_lastname,3,23)||', Ph.D';
		 	Else
		 		ws_lab_dir_name := hold_lab_dir_salutation||' '||hold_lab_dir_firstname||' '||
		 											 substr(hold_lab_dir_lastname,1,2)||substr(hold_lab_dir_lastname,3,23);
		 	End if;
		 	
		 	
		 	ws_lab_dir_salutation := hold_lab_dir_salutation||' '||
		 	                         substr(hold_lab_dir_lastname,1,2)||
		 	                         substr(hold_lab_dir_lastname,3,23)||':';
		 	                         
		 	                         
 	ELSE
		
		 	If substr(hold_lab_dir_salutation,1,3) = 'Dr.'		then
		 		ws_lab_dir_name := hold_lab_dir_firstname||' '||hold_lab_dir_lastname||', Ph.D';
		 	Else
		 		ws_lab_dir_name := hold_lab_dir_salutation||' '||hold_lab_dir_firstname||' '||
		 											 hold_lab_dir_lastname;
		 	End if;
		 	ws_lab_dir_salutation := hold_lab_dir_salutation||' '||hold_lab_dir_lastname||':';
			 	
  End if;
	
	
	
	
-- START WORD



IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN
  MESSAGE('Application is already running.');
ELSE
  
  -- FIST DIRECTORY ON WINDOWS 2000 	
  appl_name := 'C:\Program Files\Microsoft Office\Office\WINWORD.EXE';
  :GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);
  

  -- SECOND DIRECTORY ON WINDOWS XP
  appl_name := 'C:\Program Files\Microsoft Office\Office11\WINWORD.EXE';
  :GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);
  
END IF;





-- Establishing a DDE communication channel (between Form Builder & a topic in the application server.
If :GLOBAL.channel_id IS NOT NULL THEN
   MESSAGE('Communication channel already established.');

ELSIF 
   :GLOBAL.application_id IS NULL THEN
   MESSAGE('Application must be launched first.');


ELSE

-- INITIATE CONVERSATION WITH WORD 
   :GLOBAL.channel_id := DDE.INITIATE('WINWORD','SYSTEM');

-- OPEN WORD TEMPLATE
    If 
	  	 ws_user_name = 'H64ELBIS' or
	  	 ws_user_name = 'H31SECURITY' then
		 DDE.EXECUTE(:GLOBAL.channel_id,'[FileOpen "F:\ELBIS\LETTERS\ACCEPTANCE_LETTER.DOC"]',10000);
    Else

      DDE.EXECUTE(:GLOBAL.channel_id,'[FileOpen "G:\Env\LETTERS\ACCEPTANCE_LETTER.DOC"]',10000);

    End if;	


--INITIATE CONVERSATION WITH WORD TEMPLATE
    If   	 ws_user_name = 'H64ELBIS' or
	  	 ws_user_name = 'H31SECURITY' then
                 DOCID := DDE.INITIATE('WINWORD','F:\ELBIS\LETTERS\ACCEPTANCE_LETTER.DOC');
    Else

    	         DOCID := DDE.INITIATE('WINWORD','G:\Env\LETTERS\ACCEPTANCE_LETTER.DOC');

    End if;

END IF;
	
	
--BEGIN TRANSFER TO WORD
	select to_char(sysdate, 'Month') into ws_current_month from dual;
	ws_current_month := rtrim(ws_current_month);
	select to_char(sysdate, 'DD, YYYY') into ws_current_day_year from dual;
	ws_current_date := ws_current_month||' '||ws_current_day_year;
	DDE.POKE(DOCID,'TODAYS_DATE',ws_current_date,DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'LAB_DIRECTOR_NAME',nvl(ws_lab_dir_name, ' '),DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'LAB_NAME',:h64laboratory_details.labname,DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'STREET_ADDRESS',nvl(hold_street, ' '),DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'CITY_STATE_ZIP',nvl(ws_city_st_zip, ' '),DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'LICENSE_NUMBER',rtrim(:h64laboratory_details.azlicense),DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'SALUTATION',nvl(ws_lab_dir_salutation, ' '),DDE.CF_TEXT,10000);
	DDE.POKE(DOCID,'LAB_NAME2',:h64laboratory_details.labname,DDE.CF_TEXT,10000);
  

--SAVE THE TEMPLATE
--	DDE.EXECUTE(DOCID,'[FileSaveAs "F:\ELBIS\LETTERS\ACCEPTANCE_LETTER.DOC"]',10000);
	
--END TRANSFER TO WORD
	DDE.TERMINATE(:GLOBAL.channel_id);
	:GLOBAL.channel_id := null;
	:GLOBAL.application_id 	:= null;	
	
--HANDLE EXCEPTIONS	
	EXCEPTION
		WHEN DDE.DDE_APP_FAILURE THEN
			MESSAGE('Word for Windows cannot start.');
			RAISE FORM_TRIGGER_FAILURE;
		WHEN DDE.DDE_PARAM_ERR THEN
			MESSAGE('A Null value was passed to DDE');
			RAISE FORM_TRIGGER_FAILURE;
		WHEN DDE.DDE_INIT_FAILED THEN
			MESSAGE('Could not initialize DDE communication channel.');
			RAISE FORM_TRIGGER_FAILURE;
		WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
			MESSAGE('Could not establish DDE communication channel.');
			RAISE FORM_TRIGGER_FAILURE;
		WHEN DDE.DMLERR_NOTPROCESSED THEN
			MESSAGE('A Transaction Failed.');
			RAISE FORM_TRIGGER_FAILURE;
		WHEN OTHERS THEN
			MESSAGE('Error: '||TO_CHAR(SQLCODE)||' '||SQLERRM);
			RAISE FORM_TRIGGER_FAILURE;	
			
	END;
END;
Upd-mod: Added 'code' tags.

[Updated on: Sat, 06 May 2006 00:34] by Moderator

Report message to a moderator

Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #170938 is a reply to message #170892] Sat, 06 May 2006 09:16 Go to previous messageGo to next message
Mohannad
Messages: 47
Registered: January 2006
Location: palestine
Member

thanks but it is work on oracle 9i
thanks
note :when u past any code write near it in which developer it work
Re: How Do I find out "in code" what type of operating system a user is running ( XP or 20 [message #171837 is a reply to message #170938] Thu, 11 May 2006 13:04 Go to previous message
keedn
Messages: 12
Registered: April 2006
Location: Phoenix, AZ United States
Junior Member
I FINALLY FIGURED IT OUT:

WITHIN THE ACTUAL FORM MODULE I ADDED AN ADDITIONAL PROGRAM UNIT OF FUNCTION AN ATTATCHED IT : ( the function is named HelloFile and uses a BOOLEAN return type with the TEXT_IO to test if it can actually open the file.


FUNCTION HelloFile (p_filename VARCHAR2) RETURN BOOLEAN IS 

-- p_filename variable will hold the value of the directory specified in the trigger IF statement


fileID TEXT_IO.FILE_TYPE;

BEGIN

fileID := TEXT_IO.FOPEN(p_filename, 'r');

TEXT_IO.FCLOSE(fileID);

	

RETURN TRUE;


EXCEPTION
 
 WHEN others THEN
 
RETURN FALSE;
	
END HelloFile;






- THE FUNCTION ABOVE GETS CALLED FROM A BUTTON TRIGGER THAT USES THE IF STATEMENT OF:


-- START WORD


IF :GLOBAL.APPLICATION_ID IS NOT NULL THEN
	
		MESSAGE('Application is already running.');

	ELSE
	
		IF HelloFile('C:\Program Files\Microsoft Office\Office\WINWORD.EXE') THEN

                             -- the above directory is then stored in the (p_filename) of the function HelloFile
                             -- to see if it can be opened, IF SO then open the directory as below
                             -- IF NOT then go to the else statement and process the next directory to open word. 

				appl_name := 'C:\Program Files\Microsoft Office\Office\WINWORD.EXE';
				:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);

		ELSE

				appl_name := 'C:\Program Files\Microsoft Office\Office11\WINWORD.EXE';
				:GLOBAL.application_id := DDE.APP_BEGIN(appl_name, DDE.APP_MODE_MAXIMIZED);
				
		END IF;


		
END IF;	


[Updated on: Thu, 11 May 2006 13:06]

Report message to a moderator

Previous Topic: Enable Win_API in forms 6i
Next Topic: How do I look at a directory to see if a file exists
Goto Forum:
  


Current Time: Fri Sep 20 09:40:53 CDT 2024