计算机关机代码集锦看了不后悔.docx

上传人:b****6 文档编号:3623111 上传时间:2022-11-24 格式:DOCX 页数:15 大小:58.94KB
下载 相关 举报
计算机关机代码集锦看了不后悔.docx_第1页
第1页 / 共15页
计算机关机代码集锦看了不后悔.docx_第2页
第2页 / 共15页
计算机关机代码集锦看了不后悔.docx_第3页
第3页 / 共15页
计算机关机代码集锦看了不后悔.docx_第4页
第4页 / 共15页
计算机关机代码集锦看了不后悔.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

计算机关机代码集锦看了不后悔.docx

《计算机关机代码集锦看了不后悔.docx》由会员分享,可在线阅读,更多相关《计算机关机代码集锦看了不后悔.docx(15页珍藏版)》请在冰豆网上搜索。

计算机关机代码集锦看了不后悔.docx

计算机关机代码集锦看了不后悔

您还未登录!

|登录|注册|帮助

∙CSDN首页

∙资讯

∙论坛

∙博客

∙下载

∙搜索

∙更多

oCTO俱乐部

o学生大本营

o培训充电

o移动开发

o软件研发

o云计算

o程序员

oTUP

CSDN-CSDN社区-.NET技术-C#

∙管理菜单

o

o生成帖子

o置顶

o推荐

o取消推荐

o锁定

o解锁

o移动

o编辑

o删除

o帖子加分

o帖子高亮

o取消高亮

∙结帖

∙发帖

∙回复

收藏

C#关机的代码怎样?

[问题点数:

5分,结帖人:

chjlcn]

∙chjlcn

∙()

∙等 级:

∙结帖率:

100.00%

楼主发表于:

2006-02-2509:

01:

10

C#关机的代码怎样?

∙对我有用[0]

∙丢个板砖[0]

∙引用

∙举报

∙管理

∙TOP

回复次数:

8

∙napsoft

∙(乡下人)

∙等 级:

#1楼得分:

1回复于:

2006-02-2509:

04:

25

OptionExplicitOn

OptionStrictOn

ImportsSystem

ImportsSystem.Text

ImportsSystem.Diagnostics

ImportsSystem.Runtime.InteropServices

NamespaceTimeShutDown

'///

'///Specifiesthetypeofrestartoptionsthatanapplicationcanuse.

'///

PublicEnumRestartOptions

'///

'///注销

'///

LogOff=0

'///

'///关机

'///

PowerOff=8

'///

'///重起

'///

Reboot=2

'///

'///安全关机模式

'///

ShutDown=1

'///

'///Suspendsthesystem.休眠

'///

Suspend=-1

'///

'///Hibernatesthesystem.待机

'///

Hibernate=-2

EndEnum

'///

'///AnLUIDisa64-bitvalueguaranteedtobeuniqueonlyonthesystemonwhichitwasgenerated.Theuniquenessofalocallyuniqueidentifier(LUID)isguaranteedonlyuntilthesystemisrestarted.

'///

=1)>_

FriendStructureLUID

'///

'///Theloworderpartofthe64bitvalue.

'///

PublicLowPartAsInteger

'///

'///Thehighorderpartofthe64bitvalue.

'///

PublicHighPartAsInteger

EndStructure

'///

'///TheLUID_AND_ATTRIBUTESstructurerepresentsalocallyuniqueidentifier(LUID)anditsattributes.

'///

=1)>_

FriendStructureLUID_AND_ATTRIBUTES

'///

'///SpecifiesanLUIDvalue.

'///

PublicpLuidAsLUID

'///

'///SpecifiesattributesoftheLUID.Thisvaluecontainsupto32one-bitflags.ItsmeaningisdependentonthedefinitionanduseoftheLUID.

'///

PublicAttributesAsInteger

EndStructure

'///

'///TheTOKEN_PRIVILEGESstructurecontainsinformationaboutasetofprivilegesforanaccesstoken.

'///

∙对我有用[0]

∙丢个板砖[0]

∙引用

∙举报

∙管理

∙TOP

精华推荐:

别说我闲,nothing啊,nothing......

∙napsoft

∙(乡下人)

∙等 级:

#2楼得分:

0回复于:

2006-02-2509:

06:

44

=1)>_

FriendStructureTOKEN_PRIVILEGES

'///

'///SpecifiesthenumberofentriesinthePrivilegesarray.

'///

PublicPrivilegeCountAsInteger

'///

'///SpecifiesanarrayofLUID_AND_ATTRIBUTESstructures.EachstructurecontainstheLUIDandattributesofaprivilege.

'///

PublicPrivilegesAsLUID_AND_ATTRIBUTES

EndStructure

'///

'///ImplementsmethodstoexitWindows.

'///

PublicClassWindowsController

'///

Requiredtoenableordisabletheprivilegesinanaccesstoken.

PrivateConstTOKEN_ADJUST_PRIVILEGESAsInteger=&H20

'///

Requiredtoqueryanaccesstoken.

PrivateConstTOKEN_QUERYAsInteger=&H8

'///

Theprivilegeisenabled.

PrivateConstSE_PRIVILEGE_ENABLEDAsInteger=&H2

'///

Specifiesthatthefunctionshouldsearchthesystemmessage-tableresource(s)fortherequestedmessage.

PrivateConstFORMAT_MESSAGE_FROM_SYSTEMAsInteger=&H1000

'///

Forcesprocessestoterminate.Whenthisflagisset,thesystemdoesnotsendtheWM_QUERYENDSESSIONandWM_ENDSESSIONmessages.Thiscancausetheapplicationstolosedata.Therefore,youshouldonlyusethisflaginanemergency.

PrivateConstEWX_FORCEAsInteger=4

'///

'///TheLoadLibraryfunctionmapsthespecifiedexecutablemoduleintotheaddressspaceofthecallingprocess.

'///

'///Pointertoanull-terminatedstringthatnamestheexecutablemodule(eithera.dllor.exefile).Thenamespecifiedisthefilenameofthemoduleandisnotrelatedtothenamestoredinthelibrarymoduleitself,asspecifiedbytheLIBRARYkeywordinthemodule-definition(.def)file.

'///Ifthefunctionsucceeds,thereturnvalueisahandletothemodule.


Ifthefunctionfails,thereturnvalueisNULL.Togetextendederrorinformation,callMarshal.GetLastWin32Error.

PrivateDeclareAnsiFunctionLoadLibraryLib"kernel32"Alias"LoadLibraryA"(ByVallpLibFileNameAsString)AsIntPtr

'///

'///TheFreeLibraryfunctiondecrementsthereferencecountoftheloadeddynamic-linklibrary(DLL).Whenthereferencecountreacheszero,themoduleisunmappedfromtheaddressspaceofthecallingprocessandthehandleisnolongervalid.

'///

'///HandletotheloadedDLLmodule.TheLoadLibraryorGetModuleHandlefunctionreturnsthishandle.

'///Ifthefunctionsucceeds,thereturnvalueisnonzero.


Ifthefunctionfails,thereturnvalueiszero.Togetextendederrorinformation,callMarshal.GetLastWin32Error.

PrivateDeclareAnsiFunctionFreeLibraryLib"kernel32"(ByValhLibModuleAsIntPtr)AsInteger

'///

'///TheGetProcAddressfunctionretrievestheaddressofanexportedfunctionorvariablefromthespecifieddynamic-linklibrary(DLL).

'///

'///HandletotheDLLmodulethatcontainsthefunctionorvariable.TheLoadLibraryorGetModuleHandlefunctionreturnsthishandle.

'///Pointertoanull-terminatedstringcontainingthefunctionorvariablename,orthefunction'sordinalvalue.Ifthisparameterisanordinalvalue,itmustbeinthelow-orderword;thehigh-orderwordmustbezero.

'///Ifthefunctionsucceeds,thereturnvalueistheaddressoftheexportedfunctionorvariable.


Ifthefunctionfails,thereturnvalueisNULL.Togetextendederrorinformation,callMarshal.GetLastWin32Error.

PrivateDeclareAnsiFunctionGetProcAddressLib"kernel32"(ByValhModuleAsIntPtr,ByVallpProcNameAsString)AsIntPtr

'///

'///TheSetSuspendStatefunctionsuspendsthesystembyshuttingpowerdown.DependingontheHibernateparameter,thesystemeitherentersasuspend(sleep)stateorhibernation(S4).IftheForceFlagparameterisTRUE,thesystemsuspendsoperationimmediately;ifitisFALSE,thesystemrequestspermissionfromallapplicationsanddevicedriversbeforedoingso.

'///

'///Specifiesthestateofthesystem.IfTRUE,thesystemhibernates.IfFALSE,thesystemissuspended.

'///Forcedsuspension.IfTRUE,thefunctionbroadcastsaPBT_APMSUSPENDeventtoeachapplicationanddriver,thenimmediatelysuspendsoperation.IfFALSE,thefunctionbroadcastsaPBT_APMQUERYSUSPENDeventtoeachapplicationtorequestpermissiontosuspendoperation.

'///IfTRUE,thesystemdisablesallwakeevents.IfFALSE,anysystemwakeeventsremainenabled.

'///Ifthefunctionsucceeds,thereturnvalueisnonzero.


Ifthefunctionfails,thereturnvalueiszero.Togetextendederrorinformation,callMarshal.GetLastWin32Error.

PrivateDeclareAnsiFunctionSetSuspendStateLib"powrprof"(ByValHibernateAsInteger,ByValForceCriticalAsInteger,ByValDisableWakeEventAsInteger)AsInteger

'///

'///TheOpenProcessTokenfunctionopenstheaccesstokenassociatedwithaprocess.

'///

'///Handletotheprocesswhoseaccesstokenisopened.

'///Specifiesanaccessmaskthatspecifiestherequestedtypesofaccesstotheaccesstoken.Theserequestedaccesstypesarecomparedwiththetoken'sdiscretionaryaccess-controllist(DACL)todeterminewhichaccessesaregrantedordenied.

'///Pointertoahandleidentifyingthenewly-openedaccesstokenwhenthefunctionreturns.

'///Ifthefunctionsucceeds,thereturnvalueisnonzero.


Ifthefunctionfails,thereturnvalueiszero.Togetextendederrorinformation,callMarshal.GetLastWin32Error.

PrivateDeclareAnsiFunctionOpenProcessTokenLib"advapi32"(ByValProcessHandleAsIntPtr,ByValDesiredAccessAsInteger,ByRefTokenHandleAsIntPtr)AsInteger

'///

'///TheLookupPrivilegeValuefunctionretrievesthelocallyuniqueidentifier(LUID)usedonaspecifiedsystemtolocallyrepresentthespecifiedprivilegename.

'///

'///Pointertoanull-terminatedstringspecifyingthenameofthesystemonwhichtheprivilegenameislookedup.Ifanullstringisspecified,thefunctionattemptstofindtheprivilegenameonthelocalsystem.

'///Pointertoanull-terminatedstringthatspecifiesthenameoftheprivilege,asdefinedintheWinnt.hheaderfile.Forexample,thisparametercouldspecifytheconstantSE_SECURITY_NAME,oritscorrespondingstring,"SeSecurityPrivilege".

'///Pointertoavariablethatreceivesthelocallyuniqueidentifierbywhichtheprivilegeisknownonthesystem,sp

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 工作计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1