import time

import ctypes

import ctypes.wintypes

SEE_MASK_NOCLOSEPROCESS = 0x00000040

SEE_MASK_INVOKEIDLIST = 0x0000000C

class SHELLEXECUTEINFO(ctypes.Structure):

_fields_ = (

("cbSize",ctypes.wintypes.DWORD),

("fMask",ctypes.c_ulong),

("hwnd",ctypes.wintypes.HANDLE),

("lpVerb",ctypes.c_char_p),

("lpFile",ctypes.c_char_p),

("lpParameters",ctypes.c_char_p),

("lpDirectory",ctypes.c_char_p),

("nShow",ctypes.c_int),

("hInstApp",ctypes.wintypes.HINSTANCE),

("lpIDList",ctypes.c_void_p),

("lpClass",ctypes.c_char_p),

("hKeyClass",ctypes.wintypes.HKEY),

("dwHotKey",ctypes.wintypes.DWORD),

("hIconOrMonitor",ctypes.wintypes.HANDLE),

("hProcess",ctypes.wintypes.HANDLE),

)

ShellExecuteEx = ctypes.windll.shell32.ShellExecuteEx

ShellExecuteEx.restype = ctypes.wintypes.BOOL

sei = SHELLEXECUTEINFO()

sei.cbSize = ctypes.sizeof(sei)

sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_INVOKEIDLIST

sei.lpVerb = "properties"

sei.lpFile = "D:\\test.txt"

sei.nShow = 1

ShellExecuteEx(ctypes.byref(sei))

time.sleep(5)

python ctypes小例子的更多相关文章

  1. 感受python之美,python简单易懂的小例子

    前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 1 简洁之美 通过一行代码,体会Python语言简洁之美 2 Python ...

  2. python闭包小例子

    ------------------ 首先根据实例, 体会一下闭包的效果 ------------------ 定义闭包: def foo(x): a = [0] def bar(y): a[0] = ...

  3. [Python]Python 函数调用小例子

    函数定义: In [78]: def printme(str): ....: print str ....: return ....: 调用: In [79]: printme('This is Ji ...

  4. python subprocess 小例子

    #服务端import socketimport osimport subprocessphone = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...

  5. [Spark][Hive][Python][SQL]Spark 读取Hive表的小例子

    [Spark][Hive][Python][SQL]Spark 读取Hive表的小例子$ cat customers.txt 1 Ali us 2 Bsb ca 3 Carls mx $ hive h ...

  6. [Python]Python 使用 for 循环的小例子

    [Python]Python 使用 for 循环的小例子: In [7]: for i in range(5): ...: print "xxxx" ...: print &quo ...

  7. [python]python 遍历一个list 的小例子:

    [python]python 遍历一个list 的小例子: mlist=["aaa","bbb","ccc"]for ss in enume ...

  8. Python,while循环小例子--猜拳游戏(三局二胜)

    Python,while循环小例子--猜拳游戏(三局二胜) import random all_choice = ['石头', '剪刀', '布'] prompt = '''(0)石头 (1)剪刀 ( ...

  9. 这42个Python小例子,太走心

    告别枯燥,60秒学会一个Python小例子.奔着此出发点,我在过去1个月,将平时经常使用的代码段换为小例子,分享出来后受到大家的喜欢. 一.基本操作 1 链式比较 i = 3print(1 <  ...

随机推荐

  1. fetch策略

    @OneToMany(mappedBy="image",cascade=CascadeType.ALL,fetch=FetchType.EAGER) @Fetch(value=Fe ...

  2. 继承PictureBox显示GIF的自定义控件实现

    处理GIF部分 using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...

  3. [每日一题] OCP1z0-047 :2013-08-15 描述GROUPING 函数 .......................................43

    正确答案:C ,否则返回0. 官方解释:GROUPING distinguishes superaggregate rows fromregular grouped rows. GROUP BY ex ...

  4. [React Testing] The Redux Store - Multiple Actions

    When using Redux, we can test that our application state changes are working by testing that dispatc ...

  5. How To Make a Music Visualizer in iOS

     Xinrong Guo on June 4, 2013 Tweet Learn how to create your own music visualizer! In the mid-seventi ...

  6. Linux系统中C&Cpp程序开发(一)

    之前一直在Windows系统下进行程序的设计,近期开始学习使用Linux系统,因而打算将程序开发也转移到Linux系统下.今天先简单介绍一下该系统下的C程序开发步骤. 首先要预先安装vim和gcc工具 ...

  7. BitmapFactory 加载图片到内存

    Bitmap占用内存分析 Android的虚拟机是基于寄存器的Dalvik,它的最大堆(单个进程可用内存)大小一般是16M,当然不同设备是不一样的,可以查看/system/build.prop文件,[ ...

  8. iframe顶部跳转跨域问题

    $("#button").on("click", function () {                  //  top.location.locatio ...

  9. nagios配置

    接近两个星期的奋战,nagios的安装搭建以及监控服务自动报警功能终于基本得以实现,现在自己整理一份安装技术手册,方便自己以后查阅和回顾. 接近两个星期的奋战,nagios的安装搭建以及监控服务自动报 ...

  10. shell的string operator

    ${varname:-word} 如果varname存在并且不为nil,那么返回varname的值,否则返回word.这个常用来在varname未定义时返回默认值 ${varname:=word} 如 ...