1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 // QuickStart.cpp : Defines the entry point for the application.
25 #include <systools/win32/uwinapi.h>
26 #include <systools/win32/qswin32.h>
31 // check for soffice by searching the communication window
32 return ( FindWindowEx( NULL
, NULL
, QUICKSTART_CLASSNAME
, NULL
) == NULL
) ? false : true;
39 char filename
[_MAX_PATH
+ 1];
41 filename
[_MAX_PATH
] = 0;
42 GetModuleFileName( NULL
, filename
, _MAX_PATH
); // soffice resides in the same dir
43 char *p
= strrchr( filename
, '\\' );
47 strncpy( p
+1, "soffice.exe", _MAX_PATH
- (p
+1 - filename
) );
49 char imagename
[_MAX_PATH
+ 1];
51 imagename
[_MAX_PATH
] = 0;
52 _snprintf(imagename
, _MAX_PATH
, "\"%s\" --quickstart", filename
);
54 UINT ret
= WinExec( imagename
, SW_SHOW
);
64 int APIENTRY
WinMain(HINSTANCE
/*hInstance*/,
65 HINSTANCE
/*hPrevInstance*/,
69 // Look for --killtray argument
71 for ( int i
= 1; i
< __argc
; i
++ )
73 if ( 0 == strcmp( __argv
[i
], "--killtray" ) )
75 HWND hwndTray
= FindWindow( QUICKSTART_CLASSNAME
, NULL
);
79 UINT uMsgKillTray
= RegisterWindowMessage( SHUTDOWN_QUICKSTART_MESSAGE
);
80 SendMessage( hwndTray
, uMsgKillTray
, 0, 0 );
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */