强制布尔值(15)

T

terry_zhou82

Unregistered / Unconfirmed
GUEST, unregistred user!
比如说有个变量,TEXT,我想让他始终等于FALSE,改怎么弄?TEXT:=NOT TEXT?
 
Z

zbdzjx

Unregistered / Unconfirmed
GUEST, unregistred user!
那就定义成常量啊!!!!
 
T

terry_zhou82

Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下://希望WIN7始终不是静音。procedure TForm1.Timer1Timer(Sender: TObject);const bMute=False;var deviceEnumerator: IMMDeviceEnumerator
defaultDevice: IMMDevice
endpointVolume: IAudioEndpointVolume;begin CoCreateInstance(CLASS_IMMDeviceEnumerator, nil, CLSCTX_INPROC_SERVER, IID_IMMDeviceEnumerator, deviceEnumerator)
deviceEnumerator.GetDefaultAudioEndpoint(eRender, eConsole, defaultDevice)
defaultDevice.Activate(IID_IAudioEndpointVolume, CLSCTX_INPROC_SERVER, nil, endpointVolume)
endpointVolume.GetMute(bmute);end;end.哪里错了啊,总是显示“[DCC Error] Unit1.pas(38): E2033 Types of actual and formal var parameters must be identical”
 
G

GodIsWrong

Unregistered / Unconfirmed
GUEST, unregistred user!
endpointVolume.GetMute(bmute)
估计里面的变量是可修改的var类型,你传进去的是不可修改的const类型,不一致
 
T

terry_zhou82

Unregistered / Unconfirmed
GUEST, unregistred user!
我看了MSDN.发现可以用SetMute函数,但里面有个参数叫PGUID,我就傻了。这个是什么类型啊
 
Top Bottom