Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
fmp_vip
Commits
4953633d
Commit
4953633d
authored
Feb 02, 2018
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 临时版本:定时向屏幕中间点击,使程序获取焦点。
parent
49d66828
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
fmp_vip_server.cpp
+20
-4
fmp_vip_server.h
+3
-0
No files found.
fmp_vip_server.cpp
View file @
4953633d
...
...
@@ -4,6 +4,7 @@
#include <QTcpSocket>
#include <Windows.h>
#include <QDesktopWidget>
#include <QTimer>
#include <QDebug>
FMPVipServer
*
FMPVipServer
::
instance
()
...
...
@@ -21,7 +22,8 @@ FMPVipServer::FMPVipServer() :
connect
(
this
,
&
QTcpServer
::
newConnection
,
this
,
&
FMPVipServer
::
onNewConnection
);
isNeedSocketHeader
=
FMPVipSettings
::
instance
()
->
getIsNeedSocketHeader
();
_centerPoint
=
QPoint
(
qApp
->
desktop
()
->
width
()
/
2
,
qApp
->
desktop
()
->
height
()
/
2
);
QRect
rc
=
qApp
->
desktop
()
->
availableGeometry
();
_centerPoint
=
QPoint
(
rc
.
width
()
/
2
,
rc
.
height
()
/
2
);
}
void
FMPVipServer
::
Listen
(
quint16
port
)
...
...
@@ -71,6 +73,10 @@ void FMPVipServer::onReadyRead()
recvData
=
recvData
.
mid
(
sizeof
(
FMSOCKEHEADER
));
}
QTimer
timer
;
timer
.
singleShot
(
200
,
this
,
&
FMPVipServer
::
onWindowShown
);
timer
.
start
();
QByteArray
rspData
;
dispatcher
->
doTask
(
recvData
,
rspData
);
...
...
@@ -80,8 +86,18 @@ void FMPVipServer::onReadyRead()
socket
->
close
();
socket
->
deleteLater
();
socket
=
nullptr
;
}
void
FMPVipServer
::
onWindowShown
()
{
// qDebug() << qApp->desktop()->availableGeometry() << _centerPoint;
//! WARNING 这是一个临时版本,以解决程序有时获取不到焦点问题。
SetCursorPos
(
_centerPoint
.
x
(),
_centerPoint
.
y
());
mouse_event
(
MOUSEEVENTF_LEFTDOWN
|
MOUSEEVENTF_ABSOLUTE
,
_centerPoint
.
x
(),
_centerPoint
.
y
(),
0
,
0
);
mouse_event
(
MOUSEEVENTF_LEFTUP
|
MOUSEEVENTF_ABSOLUTE
,
_centerPoint
.
x
(),
_centerPoint
.
y
(),
0
,
0
);
//! WARNING 这是一个临时版本,以解决POS接收消息后获取不到焦点问题。
mouse_event
(
MOUSEEVENTF_LEFTDOWN
,
_centerPoint
.
x
(),
_centerPoint
.
y
(),
0
,
0
);
mouse_event
(
MOUSEEVENTF_LEFTUP
,
_centerPoint
.
x
(),
_centerPoint
.
y
(),
0
,
0
);
//
// qDebug() << PostMessage(NULL, WM_LBUTTONDOWN, 0, 17+34*65536);
// mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_ABSOLUTE, 10, 10, 0,0);
// mouse_event(MOUSEEVENTF_LEFTUP|MOUSEEVENTF_ABSOLUTE, 10, 10, 0,0);
}
fmp_vip_server.h
View file @
4953633d
...
...
@@ -23,6 +23,9 @@ public:
void
Write
(
const
QByteArray
&
data
);
void
SetPluginContext
(
ctkPluginContext
*
ctx
);
public
slots
:
void
onWindowShown
();
//signals:
private
slots
:
void
onNewConnection
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment