chessgui has asked for the wisdom of the Perl Monks concerning the following question:

A standalone Windows application's main function looks something like this:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR + lpCmdLine, int nCmdShow)
In this call hInstance is a handle to the application's instance provided by the operation system.

Is it possible to get a hInstance handle in XS code? How to use structures and calls which require a hInstance parameter in XS code?

Replies are listed 'Best First'.
Re: Get hInstance handle in XS application?
by BrowserUk (Patriarch) on Feb 05, 2012 at 20:31 UTC

    Try: (HANDLE)-1


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Re: Get hInstance handle in XS application?
by kejohm (Hermit) on Feb 05, 2012 at 21:46 UTC

    Try the GetModuleHandle() function. Passing NULL as the parameter will get the handle to the file used to create the current process, eg.

    HINSTANCE hInstance = GetModuleHandle(NULL);