Where is registry.h?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
katuday
Earned some good credits
Earned some good credits
Posts: 134
Joined: Fri Aug 17, 2012 2:22 am

Where is registry.h?

Post by katuday »

wxMSW 3.1.2
I cannot find this header file "wx/msw/registry.h"
documented here https://docs.wxwidgets.org/trunk/classwx_reg_key.html
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Where is registry.h?

Post by PB »

But it is there
https://github.com/wxWidgets/wxWidgets/ ... registry.h

BTW, if usually works either way, but AFAIK one is supposed to include the header files not in the source tree with angle brackets (as shown in the docs you referred) instead of quotation marks.

This simple code shows that wxRegKey is properly working in the user code

Code: Select all

#include <wx/wx.h>
#include <wx/msw/registry.h>

class MyFrame : public wxFrame
{
public:
    MyFrame() : wxFrame(nullptr, wxID_ANY, "Test")
    {
        wxTextCtrl* logCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
            wxTE_MULTILINE | wxTE_RICH2 | wxTE_READONLY);
        wxLog::SetActiveTarget(new wxLogTextCtrl(logCtrl));
        wxLog::DisableTimestamp();
        
        wxRegKey key(wxRegKey::HKCU, "Software");
    
        if ( key.Exists() )
        {        
            wxString keyName;            
            long index = 0;
            
            if ( key.GetFirstKey(keyName, index) )
            {
                do 
                {
                    wxLogMessage(keyName);
                } 
                while ( key.GetNextKey(keyName, index) );                        
            }
        }
    } 
};

class MyApp : public wxApp
{
public:
    bool OnInit() override
    {
        (new MyFrame())->Show();        
        return true;
    }
}; wxIMPLEMENT_APP(MyApp);
Post Reply