Skip to main content
GameDev.net gamedev.net
🔒 Locked

__value enum & bitwise Or

Started by edwinnie Dec 29, 2003 at 7:53 AM 3 replies 750+ views
Original Post
edwinnie
edwinnie
okok, i was fiddling with managed directinput (using managed c++) when i came across a weird error. 1)I need to call this method below but off course its erroreous if i do it like that below, keyboard->SetCooperativeLevel(owner, CooperativeLevelFlags::Foreground | CooperativeLevelFlags::NonExclusive | CooperativeLevelFlags::NoWindowsKey); //now first ignore "keyboard" & "owner" //next, the prototype is: public: void SetCooperativeLevel(Control* parent, CooperativeLevelFlags flags); //also, CooperativeLevelFlags is an __value enum. 2)the errors given are: ''Microsoft::DirectX::DirectInput::Device::SetCooperativeLevel'' : cannot convert parameter 2 from ''int'' to ''Microsoft::DirectX::DirectInput::CooperativeLevelFlags'' but isnt | a bitwise Or operator? why cant i just use it simply like that by "Or-ing" all the enumerator flags? need some helps... thx! Edwinz
Sir Valeq
Sir Valeq
And what happens if you use only one flag?

--------------
"We cannot all be masters." - William Shakespeare
--------------"We cannot all be masters." - William Shakespeare
rotos
rotos
Maybe try casting the result?


keyboard->SetCooperativeLevel(owner,
(CooperativeLevelFlags)
( CooperativeLevelFlags::Foreground |
CooperativeLevelFlags::NonExclusive |
CooperativeLevelFlags::NoWindowsKey)
);
edwinnie
edwinnie
yupz i tried one flag, which works fine.
i tink i''ll jus resort to casting it though, which is kinda weird though...

thx fer replying!
DrunkenHyena
DrunkenHyena
A flag on its own is an enum. An enum is simply a value, to operate on it, it must be converted to an int. That''s why you''re seeing this.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.