0

I have my own NSIS Plugin DLL I have made. The dll has one function which takes a hwnd id number as a parameter and then creates a edit box window with that hwnd as the editboxes parent hwnd.

My Problem: I am having trouble passing a HWND to my NSIS Plugin DLL. I can retrieve the hwnd id and then identify the actual hwnd(I think) but when I create my editbox its never shown on the hwnd?

What am I doing wrong. How do I correctly find the hwnd passed as parameter?

    extern "C" void __declspec(dllexport) __cdecl CreateEditbox(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
    {
        g_hwndParent=hwndParent;
        EXDLL_INIT();

        {
            int hwndID = popint();
            HWND hwnd  = GetDlgItem(hwndParent, hwndID);
            HWND a = CreateWindowEx(WS_EX_TRANSPARENT, TEXT("Edit"), text, WS_VISIBLE|WS_CHILD, 20, 20, 100, 20,
            hwnd, NULL, GetModuleHandle(NULL), NULL);
        }
    }

My NSIS code:

    Page custom Start

    Function Start
        nsDialogs::Create 1018
        Pop $0

        tbox::CreateEditbox $0

        nsDialogs::Show
    FunctionEnd
sazr
  • 24,984
  • 66
  • 194
  • 362

1 Answers1

0

nsDialogs::Create returns the HWND (not ID) of the inner dialog.

nsDialogs can already create edit boxes so your current code is pointless...

Community
  • 1
  • 1
Anders
  • 97,548
  • 12
  • 110
  • 164
  • I know nsDialogs can create edit boxes. This is just an example, I am creating a Transparent Checkbox, which nsDialogs cant. Its the same concept, I have to give the editbox/checkbox a valid parent hwnd. Is it possible to pass a hwnd as a parameter or do I have to pass a hwnd id? – sazr Jul 12 '12 at 02:51
  • got it: its just HWND hwnd = (HWND)popint(); – sazr Jul 12 '12 at 03:02
  • There are some known bugs in controls transparency. The best way is to subclass your control and handle WM_PAINT message. – Slappy Jul 13 '12 at 04:30