tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / setup_native / source / win32 / customactions / shellextensions / startmenuicon.cxx
blob6e95c6e1e69b2ec0c4600588076cd6c8d27346df
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 #include "shlxtmsi.hxx"
22 #include <malloc.h>
25 Called during installation to customize the start menu folder icon.
26 See: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/custom.asp
28 extern "C" __declspec(dllexport) UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
30 std::wstring sOfficeMenuFolder = GetMsiPropertyW( handle, L"OfficeMenuFolder" );
31 std::wstring sDesktopFile = sOfficeMenuFolder + L"Desktop.ini";
33 // at the moment there exists no Vista Icon, so we use the default folder icon.
34 // add the icon into desktop/util/verinfo.rc
36 // The value '0' is to avoid a message like "You Are Deleting a System Folder" warning when deleting or moving the folder.
37 WritePrivateProfileStringW(
38 L".ShellClassInfo",
39 L"ConfirmFileOp",
40 L"0",
41 sDesktopFile.c_str() );
43 SetFileAttributesW( sDesktopFile.c_str(), FILE_ATTRIBUTE_HIDDEN );
44 SetFileAttributesW( sOfficeMenuFolder.c_str(), FILE_ATTRIBUTE_SYSTEM );
47 return ERROR_SUCCESS;
50 extern "C" __declspec(dllexport) UINT __stdcall DeinstallStartmenuFolderIcon(MSIHANDLE handle)
52 std::wstring sOfficeMenuFolder = GetMsiPropertyW( handle, L"OfficeMenuFolder" );
53 std::wstring sDesktopFile = sOfficeMenuFolder + L"Desktop.ini";
55 SetFileAttributesW( sDesktopFile.c_str(), FILE_ATTRIBUTE_NORMAL );
56 DeleteFileW( sDesktopFile.c_str() );
58 SetFileAttributesW( sOfficeMenuFolder.c_str(), FILE_ATTRIBUTE_NORMAL );
60 return ERROR_SUCCESS;
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */