C 實現常見系統控制

2021-10-10 19:43:22 字數 3789 閱讀 2373

1 實現電腦休眠

2 實現禁止關機

3 登出計算機

4 實現計算機關機

5 實現計算機重啟

6 開啟滑鼠設定

7 開啟桌面設定

8 開啟網路連線

9 程式在工作列隱藏

10 實現螢幕保護

11 呼叫exe檔案

12 關閉右鍵功能

13 實現截圖功能

14 實現程式只能執行一次

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.linq;

using system.text;

using system.threading.tasks;

using system.windows.forms;

using system.runtime.interopservices;

namespace 系統控制應用

private

void

button1_click

(object sender,

eventargs e)

int isclose =0;

const

int close_cmd =

0x0011

;//系統傳送的關機命令

protected

override

void

wndproc

(ref

message m)

//重寫windos訊息處理

}private

void

button2_click

(object sender,

eventargs e)

else}[

dllimport

("user32.dll"

, entrypoint =

"exitwindow***"

, charset = charset.ansi)

]private

static

extern

intexitwindow***

(int uflags,

int dwreserved)

;private

void

button3_click

(object sender,

eventargs e)

private

void

button4_click

(object sender,

eventargs e)

//執行關機

private

void

button5_click

(object sender,

eventargs e)

//重啟計算機

private

void

button6_click

(object sender,

eventargs e)

private

void

button7_click

(object sender,

eventargs e)

private

void

button8_click

(object sender,

eventargs e)

private

void

button9_click

(object sender,

eventargs e)

private

void

button10_click

(object sender,

eventargs e)

private

const

int wm_cmd =

0x0112

;private

const

int sc_screen =

0xf140;[

dllimport

("user32.dll")]

private

static

extern

bool

sendmessage

(intptr hwnd,

int wmsg,

int wpararm,

int lparam)

;private

void

button11_click

(object sender,

eventargs e)

private

void

textbox1_keyup

(object sender,

keyeventargs e)

private

void

textbox2_keyup

(object sender,

keyeventargs e)

private

void

button13_click

(object sender,

eventargs e)

private

void

textbox3_mousedown

(object sender,

mouseeventargs e)

[dllimport

("user32.dll"

, entrypoint =

"getsystemmetrics")]

private

static

extern

intgetsystemmetrics

(int mval);[

dllimport

("user32.dll"

, entrypoint =

"copyicon")]

private

static

extern

intcopyicon

(intptr hicon)

;///

/// 不用滑鼠截全屏

///

///

private

bitmap

capturenocursor()

return sourse;

}//private bitmap capturedesktop()

//// }

//}//private bitmap capturecursor(ref _cx,ref _cy)

////

private

void

button14_click

(object sender,

eventargs e)

private

void

button15_click

(object sender,

eventargs e)

private

void

form1_locationchanged

(object sender,

eventargs e)

private

void

form1_load

(object sender,

eventargs e)

else}}

}

公路收費系統(控制台c )

fee.h ifndef my h define my h class fee endif fee.cpp include fee.h include using namespace std fee fee long int car,long int car fee,long int truck,l...

c 實現通訊錄管理系統(控制台版)

此專案適合c 初學者,針對前面c 基礎知識,涉及到變數 結構體定義使用 陣列定義使用 指標定義使用等。執行之後的結果如下 define max 1000 定義通訊錄最大容量為1000 聯絡人結構體 struct person 通訊錄結構體 struct contact 操作選單 void showm...

(三)採用pinctrl控制系統控制GPIO

管理系統中所有的可以控制的pin,在系統初始化的時候,列舉所有可以控制的pin,並標識這些pin,主要是獲取到pinctrl系統中gpio對應的編號,然後呼叫gpio 的操作函式進行操作。在對應的裝置樹pinctrl節點上新增驅動的gpio資訊。pinctrl led ledgrp 之後在根 下面新...