Professional IronPython



Download 20,35 Mb.
Pdf ko'rish
bet205/453
Sana01.07.2022
Hajmi20,35 Mb.
#723045
1   ...   201   202   203   204   205   206   207   208   ...   453
LISTINg 9-3: 
 Working with Shell objects
# We only need the System assembly for this example.
from System import Activator, Type 
# Import the time module to help with a pause.
import time
548592c09.indd 186
2/24/10 12:48:23 PM
www.finebook.ir


Performing Late Binding Using Activator.CreateInstance()
 

 
187
# Constants used for Shell settings.
from ShellSettings import *
# Create the Shell object.
ShObj = Activator.CreateInstance(Type.GetTypeFromProgID(‘Shell.Application’))
# Toggle the Desktop. 
raw_input(‘Press Enter to show and then hide the Desktop’)
ShObj.ToggleDesktop() 
time.sleep(2)
ShObj.ToggleDesktop()
# Show some of the settings. 
print ‘\nThe user wants to show file extensions:’, 
print ShObj.GetSetting(SSF_SHOWEXTENSIONS) 
print ‘The user wants to see system files:’, 
print ShObj.GetSetting(SSF_SHOWSYSFILES) 
print ‘The user also wants to see operating system files:’,
print ShObj.GetSetting(SSF_SHOWSUPERHIDDEN)
# Check Explorer policies. 
print ‘\nThe NoDriveTypeAutoRun policies are:’
# Obtain the bit values. These values are: 
# 0 Unknown drives 
# 1 No root directory 
# 2 Removable drives (Floppy, ZIP) 
# 3 Hard disk drives 
# 4 Network drives 
# 5 CD-ROM drives 
# 6 RAM disk drives 
# 7 Reserved 
MyBits = ShObj.ExplorerPolicy(‘NoDriveTypeAutoRun’)
# Display the results. 
if MyBits.__and__(0x01) == 0x01:
print(‘\tAutorun Disabled for Unknown Drives’)
else:
print(‘\tAutorun Enabled for Unknown Drives’)
if MyBits.__and__(0x02) == 0x02:
print(‘\tAutorun Disabled for No Root Directory’)
else:
print(‘\tAutorun Enabled for No Root Drives’)
if MyBits.__and__(0x04) == 0x04:
print(‘\tAutorun Disabled for Removable (Floppy/ZIP) Drives’)
else:
print(‘\tAutorun Enabled for Removable (Floppy/ZIP) Drives’)
if MyBits.__and__(0x08) == 0x08:
print(‘\tAutorun Disabled for Hard Disk Drives’)
else:
print(‘\tAutorun Enabled for Hard Disk Drives’)
if MyBits.__and__(0x10) == 0x10:
print(‘\tAutorun Disabled for Network Drives’)
else:
print(‘\tAutorun Enabled for Network Drives’)
continues
548592c09.indd 187
2/24/10 12:48:23 PM
www.finebook.ir



Download 20,35 Mb.

Do'stlaringiz bilan baham:
1   ...   201   202   203   204   205   206   207   208   ...   453




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish