1一切的起点WinMain函数
对于Windows控制台,程序的入口是main函数
对于Windows窗口,程序的入口是WinMain函数
Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp
int32 WINAPI WinMain(_In_ HINSTANCE hInInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ char* pCmdLine, _In_ int32 nCmdShow)
{
int32 Result = LaunchWindowsStartup(hInInstance, hPrevInstance, pCmdLine, nCmdShow, nullptr);
LaunchWindowsShutdown();
return Result;
}
LAUNCH_API int32 LaunchWindowsStartup( HINSTANCE hInInstance, HINSTANCE hPrevInstance, char*, int32 nCmdShow, const TCHAR* CmdLine )
{
...
ErrorLevel = GuardedMain( CmdLine );
...
}
事件分发器
static void WinPumpMessages()
{
TRACE_CPUPROFILER_EVENT_SCOPE(WinPumpMessages);
{
MSG Msg;
while( PeekMessage(&Msg,NULL,0,0,PM_REMOVE) )
{
TranslateMessage( &Msg );
DispatchMessage( &Msg );
}
}
}
事件循环
UnrealEditor-Slate.dll!SWindowTitleBar::MinimizeButton_OnClicked() 行 646 C++
[内联框架] UnrealEditor-Slate.dll!Invoke(FReply(SWindowTitleBar::*)()) 行 66 C++
[内联框架] UnrealEditor-Slate.dll!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int>>::ApplyAfter(FReply(SWindowTitleBar::*)() &) 行 327 C++
UnrealEditor-Slate.dll!TBaseSPMethodDelegateInstance<0,SWindowTitleBar,1,FReply __cdecl(void),FDefaultDelegateUserPolicy>::Execute() 行 295 C++
[内联框架] UnrealEditor-Slate.dll!TDelegate<FReply __cdecl(void),FDefaultDelegateUserPolicy>::Execute() 行 620 C++
UnrealEditor-Slate.dll!SButton::ExecuteOnClick() 行 465 C++
UnrealEditor-Slate.dll!SButton::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent) 行 390 C++
UnrealEditor-Slate.dll!FSlateApplication::RoutePointerUpEvent::__l8::<lambda>(const FArrangedWidget & TargetWidget, const FPointerEvent & Event) 行 5046 C++
UnrealEditor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,FReply <lambda>(const FArrangedWidget &, const FPointerEvent &)>(FSlateApplication * ThisApplication, FEventRouter::FToLeafmostPolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerUpEvent::__l8::FReply <lambda>(const FArrangedWidget &, const FPointerEvent &) & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) 行 412 C++
UnrealEditor-Slate.dll!FSlateApplication::RoutePointerUpEvent(const FWidgetPath & WidgetsUnderPointer, const FPointerEvent & PointerEvent) 行 5032 C++
UnrealEditor-Slate.dll!FSlateApplication::ProcessMouseButtonUpEvent(const FPointerEvent & MouseEvent) 行 5601 C++
UnrealEditor-Slate.dll!FSlateApplication::OnMouseUp(const EMouseButtons::Type Button, const UE::Math::TVector2<double> CursorPos) 行 5566 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) 行 2219 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,1> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) 行 2726 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) 行 1895 C++
[内联框架] UnrealEditor-ApplicationCore.dll!WindowsApplication_WndProc(HWND__ *) 行 919 C++
UnrealEditor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) 行 925 C++
[外部代码]
[内联框架] UnrealEditor-ApplicationCore.dll!WinPumpMessages() 行 113 C++
> UnrealEditor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) 行 142 C++
UnrealEditor.exe!FEngineLoop::Tick() 行 5293 C++
[内联框架] UnrealEditor.exe!EngineTick() 行 66 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) 行 202 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) 行 233 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) 行 282 C++
[外部代码]
标签:__,const,UnrealEditor,C++,dll,剖析,源码,UE5,Slate
From: https://blog.51cto.com/fengyuzaitu/6614416