FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CefSharp/CefSharp.Core.Runtime/NativeMethodWrapper.cpp at master · cefsharp/CefSharp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
cefsharp
/
CefSharp
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
2.9k
Star
10.2k
Code
Issues
61
Pull requests
13
Discussions
Actions
Wiki
Security and quality
9
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CefSharp
/
CefSharp.Core.Runtime
/
NativeMethodWrapper.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
82 lines (66 loc) · 2.69 KB
Breadcrumbs
CefSharp
/
CefSharp.Core.Runtime
/
NativeMethodWrapper.cpp
Copy path
File metadata and controls
82 lines (66 loc) · 2.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
Copyright © 2014 The CefSharp Authors. All rights reserved.
//
//
Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#
include
"
Stdafx.h
"
#
include
"
NativeMethodWrapper.h
"
namespace
CefSharp
{
namespace
Core
{
void
NativeMethodWrapper::MemoryCopy
(IntPtr dest, IntPtr src,
int
numberOfBytes)
{
RtlCopyMemory
(dest.
ToPointer
(), src.
ToPointer
(), numberOfBytes);
}
bool
NativeMethodWrapper::IsFocused
(IntPtr handle)
{
//
Ask Windows which control has the focus and then check if it's one of our children
auto
focusControl =
GetFocus
();
return
focusControl !=
0
&& (
IsChild
((
HWND
)handle.
ToPointer
(), focusControl) ==
1
);
}
void
NativeMethodWrapper::SetWindowPosition
(IntPtr handle,
int
x,
int
y,
int
width,
int
height)
{
HWND
browserHwnd =
static_cast
<
HWND
>(handle.
ToPointer
());
if
(browserHwnd)
{
if
(width ==
0
&& height ==
0
)
{
//
For windowed browsers when the frame window is minimized set the
//
browser window size to 0x0 to reduce resource usage.
SetWindowPos
(browserHwnd,
NULL
,
0
,
0
,
0
,
0
,
SWP_NOZORDER
|
SWP_NOMOVE
|
SWP_NOACTIVATE
);
}
else
{
SetWindowPos
(browserHwnd,
NULL
, x, y, width, height,
SWP_NOZORDER
);
}
}
}
void
NativeMethodWrapper::SetWindowParent
(IntPtr child, IntPtr newParent)
{
HWND
childHwnd =
static_cast
<
HWND
>(child.
ToPointer
());
HWND
newParentHwnd =
static_cast
<
HWND
>(newParent.
ToPointer
());
SetParent
(childHwnd, newParentHwnd);
}
void
NativeMethodWrapper::RemoveExNoActivateStyle
(IntPtr browserHwnd)
{
HWND
hwnd =
static_cast
<
HWND
>(browserHwnd.
ToPointer
());
auto
exStyle =
GetWindowLongPtr
(hwnd,
GWL_EXSTYLE
);
if
(exStyle &
WS_EX_NOACTIVATE
)
{
//
Remove WS_EX_NOACTIVATE
SetWindowLongPtr
(hwnd,
GWL_EXSTYLE
, exStyle & ~
WS_EX_NOACTIVATE
);
}
}
IntPtr
NativeMethodWrapper::LoadCursorFromLibCef
(
int
resourceIdentifier)
{
auto
moduleName =
L"
libcef.dll
"
;
HMODULE
hModule =
GetModuleHandle
(moduleName);
if
(hModule ==
nullptr
)
{
return
IntPtr::Zero;
}
auto
lpCursorName =
MAKEINTRESOURCE
(resourceIdentifier);
auto
cursor =
LoadCursor
(hModule, lpCursorName);
return
static_cast
<IntPtr>(cursor);
}
}
}
Back
|
FazBrowse Home
|
New Git URL