mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
[windows] Support Startup hook
This commit is contained in:
parent
df32393215
commit
4acb3f83bf
2 changed files with 18 additions and 1 deletions
|
|
@ -69,6 +69,9 @@ struct Application *NewApplication(const char *title, int width, int height, int
|
|||
// Capture Main Thread
|
||||
mainThread = GetCurrentThreadId();
|
||||
|
||||
// Startup url
|
||||
result->startupURL = nullptr;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +91,12 @@ void SetBindings(struct Application *app, const char *bindings) {
|
|||
memcpy(app->bindings, temp.c_str(), temp.length()+1);
|
||||
}
|
||||
|
||||
void performShutdown(struct Application *app) {
|
||||
if( app->startupURL != nullptr ) {
|
||||
delete[] app->startupURL;
|
||||
}
|
||||
messageFromWindowCallback("WC");
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
|
|
@ -207,6 +216,13 @@ void loadAssets(struct Application* app) {
|
|||
void completed(struct Application* app) {
|
||||
delete[] app->initialCode;
|
||||
app->initialCode = nullptr;
|
||||
|
||||
if( app->startupURL == nullptr ) {
|
||||
messageFromWindowCallback("SS");
|
||||
return;
|
||||
}
|
||||
std::string readyMessage = std::string("SS") + std::string(app->startupURL);
|
||||
messageFromWindowCallback(readyMessage.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -341,7 +357,7 @@ void Run(struct Application* app, int argc, char **argv) {
|
|||
(*f)();
|
||||
delete(f);
|
||||
} else if (msg.message == WM_QUIT) {
|
||||
messageFromWindowCallback("Q");
|
||||
performShutdown(app);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ struct Application{
|
|||
LONG maxWidth;
|
||||
LONG maxHeight;
|
||||
int frame;
|
||||
char *startupURL;
|
||||
|
||||
// placeholders
|
||||
char* bindings;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue