/[winpt]/trunk/Src/wptW32API.cpp
ViewVC logotype

Diff of /trunk/Src/wptW32API.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 137 by twoaday, Mon Jan 9 14:01:51 2006 UTC revision 190 by twoaday, Mon Mar 27 10:05:14 2006 UTC
# Line 119  get_filename_dlg (HWND hwnd, int id, con Line 119  get_filename_dlg (HWND hwnd, int id, con
119      else      else
120          memset (file, 0, sizeof (file));          memset (file, 0, sizeof (file));
121      if (!filter)      if (!filter)
122          filter = _("All Files (*.*)\0*.*\0\0");          filter = "All Files (*.*)\0*.*\0\0";
123      /* XXX: problem with gettext because of the 'artificial'      /* XXX: problem with gettext because of the 'artificial'
124              double string termination!. */              double string termination!. */
125      memset (&open, 0, sizeof (open));      memset (&open, 0, sizeof (open));
# Line 246  set_clip_text (HWND hwnd, const char *te Line 246  set_clip_text (HWND hwnd, const char *te
246            
247      GlobalUnlock (clipmem);      GlobalUnlock (clipmem);
248      SetClipboardData (CF_TEXT, clipmem);      SetClipboardData (CF_TEXT, clipmem);
249        GlobalFree (clipmem);
250            
251  leave:  leave:
252      CloseClipboard ();      CloseClipboard ();
253      return rc;      return rc;
254  } /* set_clip_text */  }
255    
256    
257  /* Append or prepend some text to the clipboard contents.  /* Append or prepend some text to the clipboard contents.
# Line 309  make_filename (const char *path, const c Line 310  make_filename (const char *path, const c
310  }  }
311    
312    
313    /* Generate a file name from a special dirctory. */
314    char*
315    make_special_filename (int folder, const char *file, const char *ext)
316    {
317        BOOL ec;
318        char path[MAX_PATH], *p;
319        size_t n=0;
320    
321        /* MSDN: buf must be at least MAX_PATH=256 bytes */
322        ec = SHGetSpecialFolderPath (HWND_DESKTOP, path, folder, TRUE);
323        if (ec != 1) {
324            log_debug ("SHGetSpecialFolderPath() failed\r\n", (int)GetLastError ());
325            return NULL;
326        }
327    
328        n = strlen (path)+1;
329        if (file)
330            n += strlen (file)+1;
331        if (ext)
332            n += strlen (ext)+1;
333        p = new char[n+2];
334        if (!p)
335            BUG (0);
336        memset (p, 0, n+2);
337        strcpy (p, path);    
338        if (file) {
339            strcat (p, "\\");
340            strcat (p, file);
341        }
342        if (ext)
343            strcat (p, ext);
344        return p;
345    }
346    
347    
348  /* return 0 if the file @fname exists, otherwise >0. */  /* return 0 if the file @fname exists, otherwise >0. */
349  int  int
350  file_exist_check (const char *fname)  file_exist_check (const char *fname)
# Line 507  get_locale_date (long tm_t, char *buf, D Line 543  get_locale_date (long tm_t, char *buf, D
543  }  }
544    
545    
546    /* Generate a temporary file name by using the users
547       temp path and optionally a name @name provided by the caller.
548       Return value: 0 on success. */
549    int
550    get_temp_name (char *buf, DWORD buflen, const char *name)
551    {
552        char tmp[32];
553    
554        if (!name) {
555            sprintf (tmp, "%08lX", GetTickCount ());
556            name = tmp;
557        }
558    
559        /* in the mobile mode we use a local temp folder
560           with the fixed name 'temp'. */
561        if (mobile_mode_active) {
562            _snprintf (buf, buflen-1, "temp\\%s", name);
563            return 0;
564        }
565    
566        if (!GetTempPath (buflen - strlen (name) -2, buf)) {
567            log_debug ("GetTempPath() failed ec=%d\n", (int)GetLastError ());
568            return -1;
569        }
570        strcat (buf, name);
571        return 0;
572    }
573    
574    
575  struct reminder_hd_s {  struct reminder_hd_s {
576      int msecs;      int msecs;
577      HWND dlg;      HWND dlg;

Legend:
Removed from v.137  
changed lines
  Added in v.190

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26