当我尝试从此键读取值时,不会返回此键的正确值,而是获得不同的键路径值?
import _winreg as wreg
key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
print(wreg.EnumValue(key, 0))
Run Code Online (Sandbox Code Playgroud)
并输出:
('SunJavaUpdateSched', u'"C:\\Program Files (x86)\\Common Files\\Java\\Java Update\\jusched.exe"', 1)
Run Code Online (Sandbox Code Playgroud)
但是这个值不是我用过的钥匙的一部分?这个值不在这个键上,我应该得到一个不同的值.我在RegEdit及其位于的位置搜索了值的位置
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
Run Code Online (Sandbox Code Playgroud)
当我使用命令提示符
REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Run Code Online (Sandbox Code Playgroud)
我得到了正确的输出......
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
IgfxTray REG_SZ "C:\Windows\system32\igfxtray.exe"
HotKeysCmds REG_SZ "C:\Windows\system32\hkcmd.exe"
Persistence REG_SZ "C:\Windows\system32\igfxpers.exe"
Run Code Online (Sandbox Code Playgroud)
然后我会尝试在python上使用os.popen ...
import os
buff = os.popen("REG QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
print(buff.read())
Run Code Online (Sandbox Code Playgroud)
和输出
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
SunJavaUpdateSched REG_SZ "C:\Program Files (x86)\Common Files\Java\Java Update\jusched.exe"
Run Code Online (Sandbox Code Playgroud)
为什么这些不同?如何使用正确的值_winreg?
我很惊讶地看到没有很多关于函数pythoncom.PumpMessages()或pythoncom模块的解释文档。
那么做什么pythoncom.PumpMessages()和pythoncom.PumpWaitingMessages()做什么以及如何做?我真正了解它用于从输入设备捕获事件。
常量定义为程序无法更改的固定值.例如,直接值1, 2, 3, 'a'和类似的定义常量#define CONSTANT 100
所以我正在阅读Null Pointer,
NULL指针是在几个标准库中定义的值为零的常量.
但是可以改变指针变量,证明:
#include <stdio.h>
int main()
{
int *a = NULL; /* Declaration\Definition of pointer and initialization of NULL */
int b; /* Regular Declaration\Definition of variable */
a = &b; /* pointer now stores memory address of b variable */
return 0;
}
Run Code Online (Sandbox Code Playgroud)
因此,如果Null指针是常量,那么为什么我编译它没有错误.
在此之前我读过.
如果您没有要分配的确切地址,最好将NULL值分配给指针变量
因此,如果Null指针是常量,那么当案例出现时我们可以获取我们想要的地址,你怎么能分配它,常量不能被改变.