home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Contrib / Dialer / dialer.c next >
C/C++ Source or Header  |  2003-11-12  |  1KB  |  60 lines

  1. #define WIN32_LEAN_AND_MEAN 
  2. #include <windows.h>
  3. #include <WinInet.h>
  4.  
  5. #include "../exdll/exdll.h"
  6.  
  7. #define NSISFunction(funcname) void __declspec(dllexport) funcname(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
  8.  
  9. HMODULE hWinInet;
  10.  
  11. BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
  12.     return TRUE;
  13. }
  14.  
  15. /*************\
  16.  * FUNCTIONS *
  17. \*************/
  18.  
  19. NSISFunction(AutodialOnline) {
  20.     EXDLL_INIT();
  21.     if (InternetAutodial(INTERNET_AUTODIAL_FORCE_ONLINE, 0))
  22.         pushstring("online");
  23.     else
  24.         pushstring("offline");
  25. }
  26.  
  27. NSISFunction(AutodialUnattended) {
  28.     EXDLL_INIT();
  29.     if (InternetAutodial(INTERNET_AUTODIAL_FORCE_UNATTENDED , 0))
  30.         pushstring("online");
  31.     else
  32.         pushstring("offline");
  33. }
  34.  
  35. NSISFunction(AttemptConnect) {
  36.     EXDLL_INIT();
  37.     if (InternetAttemptConnect(0) == ERROR_SUCCESS)
  38.         pushstring("online");
  39.     else
  40.         pushstring("offline");
  41. }
  42.  
  43. NSISFunction(GetConnectedState) {
  44.     DWORD dwState;
  45.     EXDLL_INIT();
  46.  
  47.     if (InternetGetConnectedState(&dwState, 0))
  48.         pushstring("online");
  49.     else
  50.         pushstring("offline");
  51. }
  52.  
  53. NSISFunction(AutodialHangup) {
  54.     EXDLL_INIT();
  55.     if (InternetAutodialHangup(0))
  56.         pushstring("success");
  57.     else
  58.         pushstring("failure");
  59.  
  60. }