home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Examples / Plugin / exdll.c < prev    next >
Encoding:
C/C++ Source or Header  |  2009-02-04  |  978 b   |  39 lines

  1. #include <windows.h>
  2. #include <nsis/pluginapi.h> // nsis plugin
  3.  
  4. HINSTANCE g_hInstance;
  5.  
  6. HWND g_hwndParent;
  7.  
  8. void __declspec(dllexport) myFunction(HWND hwndParent, int string_size, 
  9.                                       char *variables, stack_t **stacktop,
  10.                                       extra_parameters *extra)
  11. {
  12.   g_hwndParent=hwndParent;
  13.  
  14.   EXDLL_INIT();
  15.  
  16.  
  17.   // note if you want parameters from the stack, pop them off in order.
  18.   // i.e. if you are called via exdll::myFunction file.dat poop.dat
  19.   // calling popstring() the first time would give you file.dat,
  20.   // and the second time would give you poop.dat. 
  21.   // you should empty the stack of your parameters, and ONLY your
  22.   // parameters.
  23.  
  24.   // do your stuff here
  25.   {
  26.     char buf[1024];
  27.     wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
  28.     MessageBox(g_hwndParent,buf,0,MB_OK);
  29.   }
  30. }
  31.  
  32.  
  33.  
  34. BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
  35. {
  36.   g_hInstance=hInst;
  37.     return TRUE;
  38. }
  39.