如何防止GetOpenFileName()激活防火墙?

时间:2019-03-30 17:46:58

标签: c++ windows winapi

我试图使用GetOpenFileName()选择一个文件,然后重命名它,但是当我运行GetOpenFileName()时,诺顿安全公司说“已检测到可疑网络活动”。我不想禁用Norton,我只想知道如何阻止GetOpenFileName()访问网络。另外,为什么打开文件对话框仍然可以访问网络?

当我设置OFN_MULTISELECT和NOT时,Norton不会弹出! OFN_EXPLORER,但旧样式对话框无法访问名称中带有空格的文件夹或文件。

import React, { Component } from 'react';
import Logo from './Logo'
import logo from '../images/transparent.png';
import MenuItem from "./MenuItem";
import MenuItemBurger from "./MenuItemBurger";

class Header extends Component {

    constructor(props) {
        super(props);

        this.headerStyle = {
            height: 'auto',
            padding: 10,
            display: 'flex',
            justifyContent: 'space-between',
            zIndex: 10,
            backgroundColor: 'white'
        };

        this.burgerMenuIconStyle = {
            color: '#757c8b',
        };

        this.mobileMenuStyle = {
            zIndex: 20,
            justifyContent: 'center',
            alignItems: 'center'
        };

        this.state = {
            windowWidth: window.innerWidth,
            mobileNavVisible: false,
            navItems : [
                {text: 'Home', selected: true, id:'home'},
                {text: 'Our Services', selected: false, id: 'services'},
                {text: 'Contact Us', selected: false, id: 'contact'}
            ]
        };
    }

    handleResize() {
        this.setState({windowWidth: window.innerWidth});
    }

    componentDidMount() {
        window.addEventListener('resize', this.handleResize.bind(this));
    }

    componentWillUnmount() {
        window.removeEventListener('resize', this.handleResize.bind(this));
    }

    toggleMenuOnClick() {
        if (this.state.mobileNavVisible) {
            this.setState({...this.state, mobileNavVisible: false});
        }
        else {
            this.setState({...this.state, mobileNavVisible: true});
        }
    }

    renderMobileHeader() {
        const navItemsMappedBurger = this.state.navItems.map(item => <MenuItemBurger text={item.text} id={item.id} onClick={() => this.toggleMenuOnClick()}/>);

        if (this.state.mobileNavVisible) {
            return (
                <div className="mobileHeader">
                    <div style={this.headerStyle}>
                        <Logo logo={logo}/>
                        <i className="fa fa-bars fa-2x" onClick={() => this.toggleMenuOnClick()} style={this.burgerMenuIconStyle}></i>
                    </div>
                    <hr></hr>
                    <div className="navItems" style={this.mobileMenuStyle}> {navItemsMappedBurger} </div>
                </div>
            )
        }

        return (
            <div className="mobileHeader">
                <div style={this.headerStyle}>
                    <Logo logo={logo}/>
                    <i className="fa fa-bars fa-2x" onClick={() => this.toggleMenuOnClick()} style={this.burgerMenuIconStyle}></i>
                </div>
            </div>
        )
    }

    renderWideHeader() {
        const navItemsMapped = this.state.navItems.map(item => <MenuItem text={item.text} id={item.id}/>);
        return (
            <div className="wideHeader" style={this.headerStyle}>
                <Logo logo={logo}/>
                <div className="navItems">{navItemsMapped}</div>
            </div>
        )
    }

    render() {
        if (this.state.windowWidth < 1000) {
            return (
                this.renderMobileHeader()
            )
        }
        return (
            this.renderWideHeader()
        );
    }

};

export default Header;

请不要告诉我要对诺顿做任何事情,除非那是解决问题的唯一方法。如果有人可以提供帮助,则非常感谢。

编辑:OFN_NONETWORKBUTTON似乎不起作用。

0 个答案:

没有答案