/[winpt]/trunk/Include/wptW32API.h
ViewVC logotype

Diff of /trunk/Include/wptW32API.h

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

revision 2 by twoaday, Mon Jan 31 11:02:21 2005 UTC revision 195 by twoaday, Mon Apr 3 17:10:47 2006 UTC
# Line 1  Line 1 
 /* wptW32API.h - Common API interface  
  *      Copyright (C) 2001-2005 Timo Schulz  
  *  
  * This file is part of WinPT.  
  *  
  * WinPT is free software; you can redistribute it and/or  
  * modify it under the terms of the GNU General Public License  
  * as published by the Free Software Foundation; either version 2  
  * of the License, or (at your option) any later version.  
  *    
  * WinPT is distributed in the hope that it will be useful,  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  
  * General Public License for more details.  
  *  
  * You should have received a copy of the GNU General Public License  
  * along with WinPT; if not, write to the Free Software Foundation,  
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
  */  
   
 #ifndef WPT_W32_API_H  
 #define WPT_W32_API_H  
   
 enum {  
     FILE_OPEN = 0,  
     FILE_SAVE = 1  
 };  
   
 enum {  
     WIPE_MODE_SIMPLE    = 0,  
     WIPE_MODE_DOD       = 1,  
     WIPE_MODE_GUTMANN   = 2,  
     WIPE_MODE_FAST      = 3,  
 };  
   
 #ifdef __cplusplus  
 extern "C" {  
 #endif  
   
 extern "C" char * strsep (char * *,char const *);  
 const char *memistr (const char *buf, size_t buflen, const char *sub);  
 int gpg_md_hash_file (int mdalgo, const char *file, byte *digest, size_t *nlen);  
 int gpg_md_selftest (void);  
   
 #ifdef __cplusplus  
 }  
 #endif  
   
   
 #define stristr(buf, sub) memistr ((buf), strlen ((buf)), (sub))  
   
 struct reminder_ctx_s {  
     int msecs;  
 };  
   
 struct curr_wnd_ctx {  
     HWND main;  
     HWND focus;  
 };  
   
 struct LOCK {  
     char *file;  
     int size;  
     HANDLE fh;  
 };  
   
   
 /*-- mapi --*/  
 int mapi_init (void);  
 int mapi_send_pubkey (const char * keyid, char * keyfile);  
 int mapi_send_ascfile (char * ascfile);  
 void mapi_deinit (void);  
   
 char* make_filename( const char *path, const char *file, const char *ext );  
 int init_file_lock( LOCK *ctx, const char *file );  
 void release_file_lock( LOCK *ctx );  
 int file_exist_check( const char *fname );  
 int dir_exist_check( const char *dir );  
 size_t get_file_size( const char *fname );  
   
 int get_window_contents( HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey );  
 int set_window_contents( HWND old_hwnd, curr_wnd_ctx *ctx );  
   
 void center_window (HWND hwnd);  
 void center_window2 (HWND hwndChild, HWND style);  
 HANDLE window_reminder (struct reminder_ctx_s * ctx);  
 void set_active_window (HWND dlg);  
 void reset_active_window (void);  
   
 void set_menu_text( HMENU menu, int m_uid, const char *text );  
 void set_menu_state( HMENU menu, int m_uid, int state );  
 char* get_clip_text( HWND hwnd );  
 int set_clip_text (HWND hwnd, const char *text, int nbytes);  
 int set_clip_text2 (HWND hwnd, const char *text, int nbytes, int head_foot);  
 int dialog_box_param( HINSTANCE hinst, LPCTSTR name, HWND parent, DLGPROC fnc,  
                      LPARAM param, LPCTSTR title, int title_id );  
 int msg_box( HWND hwnd, const char *text, const char *title, int mode );  
 int check_date( SYSTEMTIME *st );  
 const char * get_filename_dlg( HWND hwnd, int id, const char * title,  
                                const char * filter, const char * name );  
 const char * get_folder_dlg( HWND hwnd, const char * title, const char * name );  
 char * m_strdup( const char *str );  
 const char * strtimestamp (long timestamp);  
   
 int rename_unlink (const char *path);  
 int secure_unlink (const char *path, const int mode);  
 void secure_unlink_set_cb (void (*cb)(void *, const char *, int, unsigned, unsigned),  
                            void *cb_value);  
 int wipe_freespace (const char * drive, HANDLE *r_fd,  
                     void (*cb)(void *, unsigned __int64, unsigned __int64),  
                     void * cb_value);  
   
 #define listbox_add_string(lb, string) \  
     SendMessage( (lb), LB_ADDSTRING, 0, (LPARAM)(LPCSTR)(string) )  
   
 #define listbox_get_cursel(lb) \  
     SendMessage( (lb), LB_GETCURSEL, 0, 0 )  
   
 #define combox_add_string(cb, string) \  
     SendMessage( (cb), CB_ADDSTRING, 0, (LPARAM)(LPCSTR)(string) )  
   
 #define item_get_text_length(dlg, itm) \  
         SendDlgItemMessage ((dlg), (itm), WM_GETTEXTLENGTH, 0, 0)  
   
 #endif /* WPT_W32_API_H */  
1    /* wptW32API.h - Common API interface
2     *      Copyright (C) 2001-2006 Timo Schulz
3     *
4     * This file is part of WinPT.
5     *
6     * WinPT is free software; you can redistribute it and/or
7     * modify it under the terms of the GNU General Public License
8     * as published by the Free Software Foundation; either version 2
9     * of the License, or (at your option) any later version.
10     *  
11     * WinPT is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14     * General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with WinPT; if not, write to the Free Software Foundation,
18     * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21    #ifndef WPT_W32_API_H
22    #define WPT_W32_API_H
23    
24    /* Macros to change the cursor */
25    #define op_begin()  SetCursor (LoadCursor (NULL, IDC_WAIT))
26    #define op_end()    SetCursor (LoadCursor (NULL, IDC_ARROW))
27    
28    #include "wptCrypto.h"
29    #include "wptUtil.h"
30    
31    struct curr_wnd_ctx {
32        HWND main;
33        HWND focus;
34    };
35    
36    /*-- wptMAPI.cpp --*/
37    int mapi_init (void);
38    int mapi_send_pubkey (const char *keyid, char *keyfile);
39    int mapi_send_ascfile (char *ascfile);
40    void mapi_deinit (void);
41    
42    /*-- wptSafeEditCtrl.cpp --*/
43    UINT SafeGetDlgItemText (HWND dlg, int id, char *buf, int buflen);
44    void safe_edit_control_init (HWND dlg, int ctlid);
45    void safe_edit_control_free (HWND dlg, int ctlid);
46    
47    /*-- wptW32API.cpp --*/
48    char* make_filename (const char *path, const char *file, const char *ext);
49    char* make_special_filename (int folder, const char *file, const char *ext);
50    int file_exist_check (const char *fname);
51    int dir_exist_check (const char *dir);
52    DWORD get_file_size (const char *fname);
53    int get_file_version (const char *fname, WORD *major, WORD *minor,
54                          WORD *patch1, WORD *patch2);
55    
56    int get_window_contents( HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey );
57    int set_window_contents( HWND old_hwnd, curr_wnd_ctx *ctx );
58    
59    void center_window (HWND hwndChild, HWND hwndParent);
60    void center_window2 (HWND hwndChild, HWND parent, HWND style);
61    void force_foreground_window (HWND dlg, int msecs);
62    
63    void insert_menu_item (HMENU hm, int by_pos, UINT m_id, const char *text);
64    void set_menu_text (HMENU menu, UINT m_uid, const char *text);
65    void set_menu_text_bypos (HMENU menu, UINT pos, const char *text);
66    void set_menu_state (HMENU menu, UINT m_uid, UINT state);
67    UINT get_menu_state (HMENU menu, UINT m_uid);
68    
69    char* get_clip_text (HWND hwnd);
70    int set_clip_text (HWND hwnd, const char *text, int nbytes);
71    int set_clip_text2 (HWND hwnd, const char *text, int nbytes, int as_footer);
72    int dialog_box_param( HINSTANCE hinst, LPCTSTR name, HWND parent, DLGPROC fnc,
73                         LPARAM param, LPCTSTR title, int title_id );
74    int msg_box( HWND hwnd, const char *text, const char *title, int mode );
75    int check_date( SYSTEMTIME *st );
76    const char* get_filesave_dlg (HWND hwnd, const char *title,
77                                  const char *filter, const char *name);
78    const char* get_fileopen_dlg (HWND hwnd, const char *title,
79                                  const char *filter, const char *name);
80    const char * get_folder_dlg( HWND hwnd, const char * title, const char * name );
81    char * m_strdup (const char *str);
82    const char * strtimestamp (long timestamp);
83    const char* get_locale_date (long tm_t, char *buf, DWORD buflen);
84    int get_temp_name (char *buf, DWORD buflen, const char *name);
85    
86    #define listbox_add_string(lb, string) \
87        SendMessage( (lb), LB_ADDSTRING, 0, (LPARAM)(LPCSTR)(string) )
88    
89    #define listbox_get_cursel(lb) \
90        SendMessage( (lb), LB_GETCURSEL, 0, 0 )
91    
92    #define combox_add_string(cb, string) \
93        SendMessage( (cb), CB_ADDSTRING, 0, (LPARAM)(LPCSTR)(string) )
94    
95    #define item_get_text_length(dlg, itm) \
96            SendDlgItemMessage ((dlg), (itm), WM_GETTEXTLENGTH, 0, 0)
97    
98    #ifdef _MSC_VER
99    #include <htmlhelp.h>
100    
101    #define html_help_init(cookie) \
102        HtmlHelp (NULL, NULL, HH_INITIALIZE, (DWORD)(cookie))
103    
104    #define html_help_deinit(cookie) \
105        HtmlHelp (NULL, NULL, HH_UNINITIALIZE, (DWORD)(cookie))
106    
107    #define html_help_dispatch(param, file, helparr) do { \
108        HELPINFO *inf; \
109        inf = (HELPINFO *)param; \
110        if (inf->iContextType == HELPINFO_WINDOW) \
111            HtmlHelp ((HWND)inf->hItemHandle, file, \
112                       HH_TP_HELP_CONTEXTMENU, (DWORD)helparr); \
113        } while (0)
114    #else
115    #define html_help_init(cookie) do {} while (0)
116    #define html_help_deinit(cookie) do { (cookie) = 0; } while (0)
117    #define html_help_dispatch(param, file, helparr) do {} while (0)
118    #endif
119    
120    #endif /* WPT_W32_API_H */

Legend:
Removed from v.2  
changed lines
  Added in v.195

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26