-
Notifications
You must be signed in to change notification settings - Fork 131
/
transparent_wnd.h
149 lines (145 loc) · 4.43 KB
/
transparent_wnd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef _TRANSPARENT_WND_H
#define _TRANSPARENT_WND_H
#include <stdio.h>
#include <string>
#include "cefclient/cefclient.h"
#include "my_handler.h"
#include "cefclient/resource.h"
#include <shellapi.h>
#include <fstream>
#include "SFMMem.h"
#include "AmfStream.h"
#include "P2P.h"
#include <map> //包含头文件
using namespace std;
void InitCallback();
class TransparentWnd
{
private:
CRITICAL_SECTION cs; //临界段
CefString url;
HINSTANCE hinst;
public:
string lastMessage;
string lastResponse;
map<string, string> messageMap;
/* 定义map类型的变量 */
CefRefPtr<MyHandler> g_handler;
HWND hWnd;
HWND renderWindow;
int x;
int y;
int dragX;
int dragY;
int width;
int height;
POINT startPoint;
bool isDrag;
UINT renderTimer;
bool isEnableDrag;
BYTE *m_buffer;
bool isTransparent;
TransparentWnd(void);
~TransparentWnd(void);
void Move(int x, int y);
void SetSize(int w, int h);
void SetUrl(CefString url);
void response(CefString response, LPVOID pParam);
void cancelResponse(LPVOID pParam);
void agentRequest(char* header, char* content, LPVOID pParam);
void agentResponse(char* request, char* header, char* content, LPVOID pParam);
void replaceRequest(CefString request, LPVOID pParam);
void replaceResponse(CefString response, LPVOID pProxyParam);
void cancelReplaceResponse(LPVOID pProxyParam);
void agentRequest(BYTE* request);
void replaceResponse(BYTE* response);
CefString GetUrl();
void Render(const void* buffer=NULL);
void SetTopMost();
void SetToolWindow();
void SetWindowStyle(UINT dwNewExStyle);
void SetHinst(HINSTANCE hinst);
void CreateBrowserWindow(CefString url, UINT ex_style=0, bool isTransparent=false);
void EnableTransparent(UINT ex_style=0);
void CreateBrowser(CefString url, CefString param="");
void Browse(CefString& url);
string getMessage(string guid);
string getLastMessage();
HWND GetHwnd();
HWND GetRenderHwnd();
void RunApp(CefString appName, CefString param="", CefString baseUrl="");
void RunAppIn(CefString appName, CefString param="", CefString baseUrl="");
void MoveHandler(int x, int y);
void GetSize(int& w, int& h);
void SizeHandler();
void CloseHandler();
void TaskMouseHandler(UINT type);
void FocusHandler();
void DropHandler(HDROP hDrop);
void ActiveHandler();
void BringToTop();
void Drag();
void EnableDrag();
void StartDrag();
void SetAsChild(TransparentWnd *parent);
void ReloadIgnoreCache();
void Reload();
void Focus();
void Max();
void Mini();
void Hide();
void Restore();
void LeaveHandler();
bool enableResize;
CefString GetSaveName(CefString fileName);
CefString GetOpenName(CefString fileName);
CefString GetOpenNames(CefString fileName);
void ExecJS(CefString s);
void Ready();
HICON GetIcon(CefString path);
void SetReadyHandler(CefString s);
void SetTitle(CefString title);
CefString TransparentWnd::ReadFile(CefString path);
bool TransparentWnd::WriteFile(CefString path, const char* s);
void CreateBrowserWindowBase(CefString path, UINT ex_style=0, bool isTransparent=true);
CefString readyHandler;
CefRefPtr<CefDownloadHandler> downloadHandler;
ATOM RegisterClass(HINSTANCE hInstance);
ATOM RegisterTransparentClass(HINSTANCE hInstance);
static LRESULT CALLBACK TransparentWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static VOID CALLBACK OnTimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime) ;
static int count;
void ToImage(CefString path);
void ToImageEx(CefString path, int x, int y, int width, int height);
void SetTaskIcon(int id, CefString iconPath, CefString title);
void DelTaskIcon(int id);
CefString TranslatePath(CefString path);
CSFMServer* CreateMemory(CefString name, CefString fileName, int size);
void DeleteMemory(CSFMServer* mem);
AmfStream* CreateStream(CSFMServer* mem);
void SaveImageFromStream(CefString path,AmfStream* pStream,int width,int height);
void DeleteStream(AmfStream* pStream);
CefString GetFolder();
HICON hIcon;
CSFMClient* pClient;
AmfStream* pStream;
HBITMAP hBitMap;
bool enableRefresh;
bool enableDevelop;
bool isMini;
bool isHide;
CefString GetCurrentDirectory();
void RecieveMessage(int type, const char* message, char* ip, unsigned short port);
void ShowTip(CefString& text);
void *pTipWin;
void Download(CefString url,CefString filename);
static CSFMServer* pSever;
P2P p2p;
CefString folder;
int restoreX;
int restoreY;
void GetUsers();
static string makeGUID();
};
#endif