Skip to content

Commit 132bfa6

Browse files
author
Rocket Programmer
committed
discord-presence: Push
1 parent b19df8b commit 132bfa6

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

injector.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,18 @@ void Injector::on_actionQuit_triggered()
252252

253253
// Close the injector.
254254
QCoreApplication::quit();
255+
}
256+
void Injector::on_actionDiscord_Presence_triggered(bool checked)
257+
{
258+
if (checked) {
259+
// Run the Discord Presence executable.
260+
system("discord/DiscordPresence.exe");
261+
} else {
262+
// Close our running Discord Presence process.
263+
DWORD pid = NULL;
264+
HWND hWnd = FindWindow(NULL, QString("DiscordPresence.exe").toStdWString().c_str());
265+
GetWindowThreadProcessId(hWnd, &pid);
266+
HANDLE handle = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, TRUE, pid);
267+
TerminateProcess(handle, NULL);
268+
}
255269
}

injector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ private slots:
3838

3939
void on_actionQuit_triggered();
4040

41+
void on_actionDiscord_Presence_triggered(bool checked);
42+
4143
private:
4244
Ui::Injector *ui;
4345
};

injector.ui

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
<string>Misc</string>
105105
</property>
106106
<addaction name="actionAbout"/>
107+
<addaction name="actionDiscord_Presence"/>
107108
<addaction name="actionQuit"/>
108109
</widget>
109110
<addaction name="Scripts"/>
@@ -168,6 +169,14 @@
168169
<string>Quit</string>
169170
</property>
170171
</action>
172+
<action name="actionDiscord_Presence">
173+
<property name="checkable">
174+
<bool>true</bool>
175+
</property>
176+
<property name="text">
177+
<string>Discord Presence</string>
178+
</property>
179+
</action>
171180
</widget>
172181
<resources/>
173182
<connections/>

0 commit comments

Comments
 (0)