fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / desktop / win32 / source / QuickStart / QuickStart.cxx
blob77ba5cf170c5eb5989b646841f99699a5b3ef6ee
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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.
23 #include "StdAfx.h"
24 #include "resource.h"
25 #include <systools/win32/uwinapi.h>
26 #include <systools/win32/qswin32.h>
27 #include <stdio.h>
29 bool SofficeRuns()
31 // check for soffice by searching the communication window
32 return ( FindWindowEx( NULL, NULL, QUICKSTART_CLASSNAME, NULL ) == NULL ) ? false : true;
35 bool launchSoffice( )
37 if ( !SofficeRuns() )
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, '\\' );
44 if ( !p )
45 return false;
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 );
55 if ( ret < 32 )
56 return false;
58 return true;
60 else
61 return true;
64 int APIENTRY WinMain(HINSTANCE /*hInstance*/,
65 HINSTANCE /*hPrevInstance*/,
66 LPSTR /*lpCmdLine*/,
67 int /*nCmdShow*/)
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 );
77 if ( hwndTray )
79 UINT uMsgKillTray = RegisterWindowMessage( SHUTDOWN_QUICKSTART_MESSAGE );
80 SendMessage( hwndTray, uMsgKillTray, 0, 0 );
83 return 0;
87 launchSoffice();
88 return 0;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */