Skip to content

Commit

Permalink
支持刷新窗口大小
Browse files Browse the repository at this point in the history
  • Loading branch information
LoveBeforT committed Nov 19, 2021
1 parent 9c81618 commit 7168865
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 4 deletions.
6 changes: 4 additions & 2 deletions WarcraftHelper/WarcraftHelper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,24 @@
<ClCompile Include="..\ThirdParty\Detours\detours.cpp" />
<ClCompile Include="..\ThirdParty\Detours\disasm.cpp" />
<ClCompile Include="..\ThirdParty\Detours\modules.cpp" />
<ClCompile Include="CrashFixer.cpp" />
<ClCompile Include="crashfixer.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="helper.cpp" />
<ClCompile Include="hook.cpp" />
<ClCompile Include="sizebypass.cpp" />
<ClCompile Include="unlockfps.cpp" />
<ClCompile Include="windowfixer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CrashFixer.h" />
<ClInclude Include="crashfixer.h" />
<ClInclude Include="helper.h" />
<ClInclude Include="hook.h" />
<ClInclude Include="sizebypass.h" />
<ClInclude Include="unlockfps.h" />
<ClInclude Include="version.h" />
<ClCompile Include="widescreen.cpp" />
<ClInclude Include="widescreen.h" />
<ClInclude Include="windowfixer.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
10 changes: 8 additions & 2 deletions WarcraftHelper/WarcraftHelper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
<ClCompile Include="..\ThirdParty\Detours\disasm.cpp">
<Filter>Detours</Filter>
</ClCompile>
<ClCompile Include="CrashFixer.cpp">
<ClCompile Include="windowfixer.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="crashfixer.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
Expand All @@ -68,7 +71,10 @@
<ClInclude Include="hook.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="CrashFixer.h">
<ClInclude Include="crashfixer.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="windowfixer.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions WarcraftHelper/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Helper::Helper() {
this->m_WideScreen = &WideScreen();
this->m_UnlockFPS = &UnlockFPS();
this->m_CrashFixer = &CrashFixer();
this->m_WindowFixer = &WindowFixer();
}

void Helper::Start() {
Expand All @@ -41,6 +42,7 @@ void Helper::Start() {
this->m_WideScreen->Start(this->m_GamedllBase, this->m_War3Version);
this->m_UnlockFPS->Start(this->m_GamedllBase, this->m_War3Version);
this->m_CrashFixer->Start(this->m_GamedllBase, this->m_War3Version);
this->m_WindowFixer->Start();
}

void Helper::Stop() {
Expand All @@ -51,6 +53,7 @@ void Helper::Stop() {
this->m_WideScreen->Stop();
this->m_UnlockFPS->Stop();
this->m_CrashFixer->Stop();
this->m_WindowFixer->Stop();
}

bool Helper::IsWar3() {
Expand Down
2 changes: 2 additions & 0 deletions WarcraftHelper/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "unlockfps.h"
#include "widescreen.h"
#include "CrashFixer.h"
#include "windowfixer.h"

class Helper {
public:
Expand All @@ -19,6 +20,7 @@ class Helper {
WideScreen *m_WideScreen;
UnlockFPS *m_UnlockFPS;
CrashFixer *m_CrashFixer;
WindowFixer *m_WindowFixer;

bool IsWar3();
};
Expand Down
37 changes: 37 additions & 0 deletions WarcraftHelper/windowfixer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "windowfixer.h"

bool WindowFixer_Hooked = false;
extern HWND g_hWnd;

#define IsKeyDown(VK_NAME) ((GetAsyncKeyState(VK_NAME) & 0x8000) ? true:false)

DWORD __stdcall Listen(LPVOID lpThreadParameter) {
POINT point; // 鼠标所在位置
HWND target; // 目标窗口句柄
while (1)
{
if IsKeyDown(VK_F7)
{
GetCursorPos(&point);
target = WindowFromPoint(point);
if (target != NULL && target == g_hWnd) {
RECT rect;
GetWindowRect(target, &rect);
// 重新设置窗口大小
MoveWindow(target, rect.left, rect.top, rect.right - rect.left-1, rect.bottom - rect.top, true);
// 恢复窗口大小
MoveWindow(target, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, true);
}
}
Sleep(200);
}
return 0;
}

void WindowFixer::Start() {
CreateThread(NULL, NULL, Listen, NULL, NULL, NULL);
}

void WindowFixer::Stop() {

}
10 changes: 10 additions & 0 deletions WarcraftHelper/windowfixer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "hook.h"

class WindowFixer {
public:
void Start();
void Stop();
};

2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

魔兽辅助插件,解除地图大小限制,宽屏支持,解锁FPS

如果你的显示器大于1080p,产生了字体重叠问题,游戏内使用F7键可以刷新窗口。

支持版本:1.20e、1.24e和1.27a

使用方法:直接放到魔兽目录下。
Expand Down

0 comments on commit 7168865

Please sign in to comment.