Thread: Microsoft::Win32::RegistryKey::GetValue()

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    3

    Microsoft::Win32::RegistryKey::GetValue()

    Hey i am using microsofts visual c++ 2005 express edition beta
    and i keep getting this dum error with this function i try to compile:
    Code:
    System::Void  SetRadioValues()
    	{
    		System::String^ val = Microsoft::Win32::RegistryKey::GetValue("HKCU\\Software\\Policies\\Microsoft\\Windows\\System\\DisableCMD");
    		
    	}
    the line "System::String^ val = Microsoft::Win32::RegistryKey::GetValue("HKCU\\Sof tware\\Policies\\Microsoft\\Windows\\System\\Disab leCMD");"

    is what gives me the trouble, i get this error:
    error C2352: 'Microsoft::Win32::RegistryKey::GetValue' : illegal call of non-static member function
    c:\windows\microsoft.net\framework\v2.0.50215\msco rlib.dll : see declaration of 'Microsoft::Win32::RegistryKey::GetValue'

    so am i not setting it up right or something if some one could plz show me how to set this up right so i can get the value of that key that be great thx.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    The GetValue function is not static. You need an instance of type Microsoft::Win32::RegistryKey to call this function.

    Microsoft::Win32::RegistryKey* key = Microsoft::Win32::Registry::CurrentUser.OpenSubKey ( "Software\\Policies\\Microsoft\\Windows\\Syst em\\DisableCMD" );

    System::Object* result = key->GetValue( "keyname" );

    The key does not exist on my machine, so I cannot tell what the keyname should be.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    you seem to be using alot of '::'s which means youre referring to class that has been made in a class that has been made in a class and that has been made be a class. how would this be correct?

    edit: object*
    New Function!!!!

    glAddIdol(C+noob);

    The feeling of rusty spoons against my salad fingers is almost ORGASMIC

  4. #4
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    like this:
    Code:
    #include<iostream>
    
    namespace look
    {
            namespace at
            {
                    namespace how
                    {
                            namespace you
                            {
                                    namespace can
                                    {
                                            namespace nest
                                            {
                                                    char*things;
                                            }
                                    }
                            }
                    }
            }
    }
    
    int main()
    {
            look::at::how::you::can::nest::things="hehe";
            std::cout<<look::at::how::you::can::nest::things<<std::endl;
            return 0;
    }
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  5. #5
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Code:
    namespace more
    {
    	class fun
    	{
    		public:
    			static void even()
    			{
    			}
    	};
    }
    
    int main()
    {
    	more::fun::even();
        return 0;
    }
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Quote Originally Posted by major_small
    like this:
    Code:
    #include<iostream>
    
    namespace look
    {
            namespace at
            {
                    namespace how
                    {
                            namespace you
                            {
                                    namespace can
                                    {
                                            namespace nest
                                            {
                                                    char*things;
                                            }
                                    }
                            }
                    }
            }
    }
    
    int main()
    {
            look::at::how::you::can::nest::things="hehe";
            std::cout<<look::at::how::you::can::nest::things<<std::endl;
            return 0;
    }
    Look at how you can assign a text string as a pointer's address and not have the compiler give you an error.
    Last edited by golfinguy4; 07-13-2005 at 11:02 AM.

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    it didn't... and I didn't assign it as an address
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed