小编fhn*_*eer的帖子

在windows Visual Studio上编译VLC源代码

VLC 是开源项目。我想编辑它的来源。我想在界面中做一些更改,例如更改标题窗口、图标等。但我很困惑如何做到这一点。我下载了包含头文件、cpp 文件、makefile 等的源代码。现在我陷入了下一步该做什么。\

我可以像 Windows 窗体应用程序一样在 Visual Studio 中打开源代码并进行拖放、更改等操作吗?

这个怎么做。

或者如何编辑代码并将其编译为源代码。我使用的是 Windows 7。我不了解安装 makeinstall。

所以我需要一步一步的演练。

open-source vlc visual-studio-2010

5
推荐指数
1
解决办法
2万
查看次数

idl和odl之间的区别

IDL和ODL的主要区别是什么.我有很多项目,其中一些有idl,其中一些有odl.我应该在哪里使用它们.什么是权衡.

c++ com idl

5
推荐指数
1
解决办法
2473
查看次数

WPF 中网格的隐式 RowDefinition

在 XAMl 中设计网格时,我们必须明确告知网格中将有多少行。

假设我们正在制作一个表单类型的应用程序。用户需要在其中填写其信息。有一个标签,然后有一个文本框。这会重复大约 10 次。

<Label Content="Name" />
<TextBox Text={Binding SomethingText"} />
Run Code Online (Sandbox Code Playgroud)

现在这又要重演了。现在我在这里定义一个网格。

1  <Grid>
2      <Grid.ColumnDefinitions>
3          <ColumnDefinition Width="60" />
4          <ColumnDefinition Width="*" />
5      </Grid.ColumnDefinitions>
6      <Grid.RowDefinitions>
7          <RowDefinition Height="Auto" />
8          <RowDefinition Height="Auto" />
9      </Grid.RowDefinitions>

10     <Label Grid.Row="0" Grid.Column="0" Content="Name" />
11     <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding SomethingText}" />

12     <Label Grid.Row="1" Grid.Column="0" Content="Address" />
13     <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SomeText}" />
14  </Grid>
Run Code Online (Sandbox Code Playgroud)

现在,如果我决定在网格中添加另一行。更改 Grid.Row="2" 将不起作用。它将与 Row1 重叠。为了做到这一点,我需要在 Grid.RowDefinitions 中添加一个 RowDefinition。所以每次我都需要添加RowDefinition。

现在我的问题是,无论如何我都不需要明确告诉 RowDefinitions。WPF 自动使用最后一个 RowDefinition(第 …

c# wpf xaml wpfdatagrid

5
推荐指数
1
解决办法
3864
查看次数

使用 C# 和 WPF 防止 Windows 上的屏幕捕获

我尝试阻止像 Microsoft Office 一样对 WPF 窗口进行屏幕截图。

我尝试使用 SetWindowDisplayAffinity 但它总是返回 false 并且我真的不知道在哪里调用这个方法。

应用程序.xaml:

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetWindowDisplayAffinity(IntPtr hwnd, DisplayAffinity affinity);

protected override void OnStartup(StartupEventArgs e)
{
    var mainView = new MainWindow();
    var ok = SetWindowDisplayAffinity(Process.GetCurrentProcess().MainWindowHandle, DisplayAffinity.Monitor);
    mainView.Show();
}
Run Code Online (Sandbox Code Playgroud)

但 SetWindowDisplayAffinity 方法始终返回 false。我发现了另一个问题,但它没有说明这个方法应该在哪里。

c# wpf

5
推荐指数
1
解决办法
2899
查看次数

_bstr_t内存泄漏

我有一个c ++代码.但它没有正确释放内存.告诉我我错在哪里,这是我的代码

1 void MyClass::MyFunction(void)
2 {
3    for (int i=0; i<count; i++)
4    {
5        _bstr_t xml = GetXML(i);
6        // some work
7        SysFreeString(xml);
8    }
9 }
Run Code Online (Sandbox Code Playgroud)

GetXML(第5行)给我一个BSTR.在这个程序的记忆增加.但是在SysFreeString(第7行)内存没有释放之后.我在这做错了什么?

c++ memory-leaks memory-management bstr

4
推荐指数
1
解决办法
4391
查看次数

InvokeHelper 正在调用哪个函数

在我的代码中有一个对 InvokeHelper 的函数调用。我在网上找到的是InvokeHelper是通过dwDispID来调用函数的。

这就是电话。

InvokeHelper(0xd, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms, Name);
Run Code Online (Sandbox Code Playgroud)

现在我想在里面调试。但我不知道会调用哪个函数。0xd 指向哪个函数?项目中也有odl文件。这会调用来自该 odl 的某些调用吗?什么功能?

编辑:

我在 cpp 文件的顶部找到了这些行。

// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++

// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten.
Run Code Online (Sandbox Code Playgroud)

所以看起来这个类是包装类。但是哪个类的包装器呢?

c++ com invoke

4
推荐指数
1
解决办法
7698
查看次数

泛型或多个类

现在我们有两个结构代表2d点.

public struct Point2D
{
    public double X { get; set; }
    public double Y { get; set; }
}

public struct Point2DF
{
    public float X { get; set; }
    public float Y { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

现在我们需要创建另一个结构来代表整数的2d点.

public struct Point2DI
{
    public int X { get; set; }
    public int Y { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是我应该在这里使用泛型吗?如果我使用泛型,我会有一个结构而不是三个.

public struct Point<T>
{
    public T X { get; set; }
    public T Y { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

但是消费者可以将T设置为字符串或某些类/结构.我该怎么办?有什么方法可以强制T为double/int/float吗?

c# generics

4
推荐指数
1
解决办法
114
查看次数

ng new给出dryRunSink.(...).concat不是函数错误

我正在尝试创建一个新的角度项目.我按照本网站提到的步骤进行操作.https://github.com/angular/angular-cli

当我尝试使用ng new命令创建一个新项目时,我收到错误.

E:\Code\> ng new some-name
Error: dryRunSink.commit(...).ignoreElements(...).concat is not a function
dryRunSink.commit(...).ignoreElements(...).concat is not a function
Run Code Online (Sandbox Code Playgroud)

这是结果 ng serve

Angular CLI: 1.6.4
Node: 6.11.4
OS: win32 x64
Run Code Online (Sandbox Code Playgroud)

编辑:看起来每个人都收到此错误.https://github.com/angular/angular-cli/issues/9194

angular-cli angular

4
推荐指数
1
解决办法
3654
查看次数

TabControls包含使用MVVM的不同用户控件

我正在按照MVVM制作一个WPF应用程序.在我的应用程序中我想要的是有一个视图,其中包含一些常见的按钮和文本框和一个TabControl.TabControl基本上会托管不同的UserControls.所以每个UserControl我都有一个单独ViewViewModel准备好了.

所以我的应用程序的结构看起来像这样.

MainWindow.Xaml
    EntryView.Xaml
        Button1
        Button2
        TabControl
            UserControl1 (View)
            UserControl2 (View)
            UserControl3 (View)
Run Code Online (Sandbox Code Playgroud)

我的EntryView中的儿子我有选项卡控件.现在我需要绑定它.

这就是我所做的.

EntryView.Xaml

<TabControl ItemsSource="{Binding Tabs}" SelectedItem="{Binding SelectedTab}">
    <TabControl.ContentTemplate>
        <DataTemplate DataType="{x:Type vm:UserControl1ViewModel}">
            <v:UserControl1View/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:UserControl2ViewModel}">
            <v:UserControl2View/>
        </DataTemplate>
    </TabControl.ContentTemplate>
    <TabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="Header"/>
        </DataTemplate>
    </TabControl.ItemTemplate>
</TabControl>
Run Code Online (Sandbox Code Playgroud)

EntryViewModel.cs

private ObservableCollection<BaseViewModel> _tabs;
public ObservableCollection<BaseViewModel> Tabs
{
    get
    {
        if (_tabs == null)
        {
            _tabs = new ObservableCollection<BaseViewModel>();
            _tabs.Add(new UserControl1ViewModel());
            _tabs.Add(new UserControl2ViewModel());
        }
        return _tabs;
    }
}
Run Code Online (Sandbox Code Playgroud)

但现在当我运行我的应用程序时,就会发生这种情况.TabControl为空.我在视图模型中将断点放在Tabs中,但它没有被击中.所以问题是我做得对吗?如果没有那么我该怎么办?

c# wpf xaml user-controls mvvm

3
推荐指数
1
解决办法
2829
查看次数

分配子对象的基础对象

我有一个基类和一个子类.基类包含一些变量,子包含一些变量.

我需要做的是,当我创建子类的对象时,我在其构造函数中传递基类对象,该构造函数将设置子对象的基类变量.

码:

public class BaseClass
{
    public int BaseInteger;
    public double BaseDouble;
    public bool BaseBool;
}

public class ChildClass : BaseClass
{
    public ChildClass(BaseClass baseClass)
    {
        this.base = baseClass;     // I am trying to do this.
    }

    public int ChildInteger;
    public string ChildString;
}
Run Code Online (Sandbox Code Playgroud)

那么我在这里尝试做什么是可能的.怎么样?当我尝试这段代码时,我遇到了这个错误.

Use of keyword 'base' is not valid in this context
Run Code Online (Sandbox Code Playgroud)

c# inheritance

3
推荐指数
1
解决办法
845
查看次数