## Miscellaneous functions

wxEXPLICIT
wxLL
wxLongLongFmtSpec
::wxNewId
::wxRegisterId
::wxDDECleanUp
::wxDDEInitialize
::wxEnableTopLevelWindows
::wxFindMenuItemId
::wxFindWindowByLabel
::wxFindWindowByName
::wxFindWindowAtPoint
::wxFindWindowAtPointer
::wxGetActiveWindow
::wxGetDisplayName
::wxGetMousePosition
::wxGetResource
::wxGetTopLevelParent
::wxLoadUserResource
::wxPostDelete
::wxPostEvent
::wxSetDisplayName
::wxStripMenuCodes
::wxWriteResource

### wxEXPLICIT

`wxEXPLICIT` is a macro which expands to the C++ `explicit` keyword if the compiler supports it or nothing otherwise. Thus, it can be used even in the code which might have to be compiled with an old compiler without support for this language feature but still take advantage of it when it is available.

### wxLL

wxLongLong_t wxLL(number)

This macro is defined for the platforms with a native 64 bit integer type and allows to define 64 bit compile time constants:

        #ifdef wxLongLong_t
            wxLongLong_t ll = wxLL(0x1234567890abcdef);
        #endif

Include files

<wx/longlong.h>

### wxLongLongFmtSpec

This macro is defined to contain the `printf()` format specifier using which 64 bit integer numbers (i.e. those of type `wxLongLong_t`) can be printed. Example of using it:

        #ifdef wxLongLong_t
            wxLongLong_t ll = wxLL(0x1234567890abcdef);
            printf("Long long = %" wxLongLongFmtSpec "x\n", ll);
        #endif

See also

wxLL

Include files

<wx/longlong.h>

### ::wxNewId

long wxNewId()

Generates an integer identifier unique to this run of the program.

Include files

<wx/utils.h>

### ::wxRegisterId

void wxRegisterId(long id)

Ensures that ids subsequently generated by NewId do not clash with the given id.

Include files

<wx/utils.h>

### ::wxDDECleanUp

void wxDDECleanUp()

Called when wxWindows exits, to clean up the DDE system. This no longer needs to be called by the application.

See also wxDDEInitialize.

Include files

<wx/dde.h>

### ::wxDDEInitialize

void wxDDEInitialize()

Initializes the DDE system. May be called multiple times without harm.

This no longer needs to be called by the application: it will be called by wxWindows if necessary.

See also wxDDEServer, wxDDEClient, wxDDEConnection, wxDDECleanUp.

Include files

<wx/dde.h>

### ::wxEnableTopLevelWindows

void wxEnableTopLevelWindow(bool enable = TRUE)

This function enables or disables all top level windows. It is used by ::wxSafeYield.

Include files

<wx/utils.h>

### ::wxFindMenuItemId

int wxFindMenuItemId(wxFrame *frame, const wxString& menuString, const wxString& itemString)

Find a menu item identifier associated with the given frame's menu bar.

Include files

<wx/utils.h>

### ::wxFindWindowByLabel

wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL)

NB: This function is obsolete, please use wxWindow::FindWindowByLabel instead.

Find a window by its label. Depending on the type of window, the label may be a window title or panel item label. If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.

Include files

<wx/utils.h>

### ::wxFindWindowByName

wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL)

NB: This function is obsolete, please use wxWindow::FindWindowByName instead.

Find a window by its name (as given in a window constructor or Create function call). If parent is NULL, the search will start from all top-level frames and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy. The search is recursive in both cases.

If no such named window is found, wxFindWindowByLabel is called.

Include files

<wx/utils.h>

### ::wxFindWindowAtPoint

wxWindow * wxFindWindowAtPoint(const wxPoint& pt)

Find the deepest window at the given mouse position in screen coordinates, returning the window if found, or NULL if not.

### ::wxFindWindowAtPointer

wxWindow * wxFindWindowAtPointer(wxPoint& pt)

Find the deepest window at the mouse pointer position, returning the window and current pointer position in screen coordinates.

### ::wxGetActiveWindow

wxWindow * wxGetActiveWindow()

Gets the currently active window (Windows only).

Include files

<wx/windows.h>

### ::wxGetDisplayName

wxString wxGetDisplayName()

Under X only, returns the current display name. See also wxSetDisplayName.

Include files

<wx/utils.h>

### ::wxGetMousePosition

wxPoint wxGetMousePosition()

Returns the mouse position in screen coordinates.

Include files

<wx/utils.h>

### ::wxGetResource

bool wxGetResource(const wxString& section, const wxString& entry, const wxString& *value, const wxString& file = NULL)

bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file = NULL)

bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file = NULL)

bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file = NULL)

Gets a resource value from the resource database (for example, WIN.INI, or .Xdefaults). If file is NULL, WIN.INI or .Xdefaults is used, otherwise the specified file is used.

Under X, if an application class (wxApp::GetClassName) has been defined, it is appended to the string /usr/lib/X11/app-defaults/ to try to find an applications default file when merging all resource databases.

The reason for passing the result in an argument is that it can be convenient to define a default value, which gets overridden if the value exists in the resource file. It saves a separate test for that resource's existence, and it also allows the overloading of the function for different types.

See also wxWriteResource, wxConfigBase.

Include files

<wx/utils.h>

### ::wxGetTopLevelParent

wxWindow * wxGetTopLevelParent(wxWindow *win)

Returns the first top level parent of the given window, or in other words, the frame or dialog containing it, or `NULL`.

Include files

<wx/window.h>

### ::wxLoadUserResource

wxString wxLoadUserResource(const wxString& resourceName, const wxString& resourceType="TEXT")

Loads a user-defined Windows resource as a string. If the resource is found, the function creates a new character array and copies the data into it. A pointer to this data is returned. If unsuccessful, NULL is returned.

The resource must be defined in the `.rc` file using the following syntax:

    myResource TEXT file.ext

where `file.ext` is a file that the resource compiler can find.

One use of this is to store `.wxr` files instead of including the data in the C++ file; some compilers cannot cope with the long strings in a `.wxr` file. The resource data can then be parsed using wxResourceParseString.

This function is available under Windows only.

Include files

<wx/utils.h>

### ::wxPostDelete

void wxPostDelete(wxObject *object)

Tells the system to delete the specified object when all other events have been processed. In some environments, it is necessary to use this instead of deleting a frame directly with the delete operator, because some GUIs will still send events to a deleted window.

Now obsolete: use wxWindow::Close instead.

Include files

<wx/utils.h>

### ::wxPostEvent

void wxPostEvent(wxEvtHandler *dest, wxEvent& event)

In a GUI application, this function posts event to the specified dest object using wxEvtHandler::AddPendingEvent. Otherwise, it dispatches event immediately using wxEvtHandler::ProcessEvent. See the respective documentation for details (and caveats).

Include files

<wx/app.h>

### ::wxSetDisplayName

void wxSetDisplayName(const wxString& displayName)

Under X only, sets the current display name. This is the X host and display name such as "colonsay:0.0", and the function indicates which display should be used for creating windows from this point on. Setting the display within an application allows multiple displays to be used.

See also wxGetDisplayName.

Include files

<wx/utils.h>

### ::wxStripMenuCodes

wxString wxStripMenuCodes(const wxString& in)

void wxStripMenuCodes(char *in, char *out)

NB: This function is obsolete, please use wxMenuItem::GetLabelFromText instead.

Strips any menu codes from in and places the result in out (or returns the new string, in the first form).

Menu codes include & (mark the next character with an underline as a keyboard shortkey in Windows and Motif) and \t (tab in Windows).

Include files

<wx/utils.h>

### ::wxWriteResource

bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file = NULL)

bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file = NULL)

bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file = NULL)

bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file = NULL)

Writes a resource value into the resource database (for example, WIN.INI, or .Xdefaults). If file is NULL, WIN.INI or .Xdefaults is used, otherwise the specified file is used.

Under X, the resource databases are cached until the internal function wxFlushResources is called automatically on exit, when all updated resource databases are written to their files.

Note that it is considered bad manners to write to the .Xdefaults file under Unix, although the WIN.INI file is fair game under Windows.

See also wxGetResource, wxConfigBase.

Include files

<wx/utils.h>