Menu

Create Window

2006-12-28
2012-11-14
  • Nobody/Anonymous

    Hi,

    How can i create Window in plug in.
    i can not find HINSTANCE of Application, which is required to register Window Class.
    Or is there any other methods to create Window.
    Thanx in advance

    D.G. JAdeja

     
    • Don HO

      Don HO - 2006-12-28

      in Dllmain :
      BOOL APIENTRY DllMain( HANDLE hModule,
                             DWORD  reasonForCall,
                             LPVOID lpReserved )

      hModule is your hInstance.
      Just cast in HINSTANCE before using it.

      Don

       
    • John T.

      John T. - 2006-12-29

      Hey D.G. JAdeja,

      Don is right, the hModule is synonymous for the hInstance handle, but instead of using CreateWindow(Ex), I have found that using CreateDialog(Ex) is convenient also. Especially when you're making little pop-up input/output windows.

      I usually put a statement like this in a resource file
      IDD_DLGEXAMPLE DIALOG  10, 10, 400, 200
      STYLE WS_POPUP | WS_BORDER
      CAPTION "Example!"
      {

          LTEXT "Name:", IDC_LBLSTATIC, 10, 10, 50, 10
          EDITTEXT IDC_TXTNAME,         60, 10, 100, 10, ES_AUTOHSCROLL

      }

      and then instantiate it with
      DialogBox( hModule, MAKEINTRESOURCE( IDD_DLGEXAMPLE ), nppData._nppHandle, (DLGPROC)DlgExampleProc );

      Cordially,
      John

       
    • John T.

      John T. - 2006-12-29

      Woops...I meant DialogBox(Ex), and not CreateDialog(Ex).

      Cordially,
      John