-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlashContainer.cpp
More file actions
96 lines (73 loc) · 2.43 KB
/
FlashContainer.cpp
File metadata and controls
96 lines (73 loc) · 2.43 KB
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
#import "C:\Windows\System32\Macromed\Flash\Flash.ocx" rename_namespace("Flash")
#include <atlbase.h>
#include <atlwin.h>
#include <WinInet.h>
#include <string.h>
#include <Windows.h>
#pragma comment(lib, "wininet")
#define WIN_W 600
#define WIN_H 550
CComModule _ccm;
HINSTANCE ghInst;
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) {
static Flash::IShockwaveFlash* flash_o;
static HWND hWndAX;
static RECT rc;
switch (uMessage) {
case WM_CREATE:
GetClientRect(hWnd, &rc);
hWndAX = CreateWindowEx(0, CAxWindow2::GetWndClassName(), NULL, WS_CHILD | WS_VISIBLE, 0, 0, WIN_W, WIN_H,
hWnd, NULL, ghInst, NULL);
if (FAILED(CoCreateInstance(__uuidof(Flash::ShockwaveFlash), NULL, CLSCTX_ALL,
__uuidof(Flash::IShockwaveFlash), (void**)& flash_o)))
return -1;
if (FAILED(AtlAxAttachControl(flash_o, hWndAX, NULL))) {
flash_o->Release();
return -1;
}
InternetSetCookie(TEXT("https://{server}.darkorbit.com/"), NULL, TEXT("dosid = sid"));
flash_o->Base = "https://darkorbit-22.bpsecure.com/";
flash_o->FlashVars = "params";
flash_o->Movie = "preloader";
GetWindowRect(hWnd, &rc);
SetWindowPos(hWnd, nullptr, (GetSystemMetrics(SM_CXSCREEN) - rc.right) / 2,
(GetSystemMetrics(SM_CYSCREEN) - rc.bottom) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
return 0;
case WM_COMMAND:
return 0;
case WM_SIZE:
MoveWindow(hWndAX, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
return 0;
case WM_CLOSE:
DestroyWindow(hWndAX);
DestroyWindow(hWnd);
return 0;
case WM_DESTROY:
flash_o->Release();
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASS wc = { 0 };
ghInst = hInstance;
CoInitialize(NULL);
AtlAxWinInit();
wc.lpszClassName = L"Dark";
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpfnWndProc = WndProc;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
if (!RegisterClass(&wc))return MessageBox(HWND_DESKTOP, L"RegisterClass", L"Error", MB_ICONERROR | MB_OK);
HWND hWnd = CreateWindow(wc.lpszClassName, L"Dark", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, WIN_W, WIN_H, NULL, NULL, hInstance, NULL);
if (!hWnd)
return MessageBox(HWND_DESKTOP, L"CreateWindow", L"Error", MB_ICONERROR | MB_OK);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}