小编Flo*_*ian的帖子

Visual Studio 2012没有安装C-Header?

我已经安装了VisualStudio 2012并且使用它工作了大约2周.但现在我想开始一个C++项目(我通常是c#程序员),我写了一些简单的代码.之后,我想编译它,我有很多错误......没有标准的c-header文件.

我做了什么:创建了一个新的Win32项目(空项目)创建的代码包括:

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
Run Code Online (Sandbox Code Playgroud)

其余的不是Windows.h.有没有人有想法?我也看过IncludeDirectories:

$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSDK_IncludePath)
Run Code Online (Sandbox Code Playgroud)

就这样.有没有人有想法?

c++ visual-studio-2012

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

Windows服务的替代方案

我目前正在编写一个使用低级鼠标钩子的应用程序.因为我必须使用具有管理员权限的系统启动应用程序,所以我想创建一个服务(请参阅此处:这是服务的实际用途吗?).现在我刚刚发现服务无法使用钩子鼠标钩子.所以我需要一个新概念,但我真的不知道从哪里开始.我已经尝试过一个简单的过程,但我无法使用任务调度程序在系统启动时以管理员身份运行它.

那么建议使用什么?我还应该使用Windows服务来启动进程吗?这有点矫枉过正吗?

编辑:我刚刚尝试启动我的进程,从服务中执行钩子.该过程开始但看起来,它的行为与简单的服务行为相同.我可以安装钩子,但不会调用回调.我正在用这段代码开始这个过程:

STARTUPINFO info={sizeof(info)};
PROCESS_INFORMATION processInfo;
if (!CreateProcess(path, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
{
    std::wstring msg(L"Could not start \"");
    msg.append(path);
    msg.append(L"\". CreateProcess");
    WriteErrorLogEntry((PWSTR)msg.c_str());
    return;
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决我的问题?该过程必须以管理员权限运行,但需要另一个上下文?

windows service hook

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

将单个Windows应用程序当前音量输出级别视为在音频混音器中可视化

我正在尝试编写一个C#代码,用于从访问声音输出的每个窗口应用程序输出当前音频输出级别(如Volume混音器中不断变化的绿色条所示).

该程序将每10毫秒检查一次,并输出如下:Windows Media Player:30,Mozilla Firefox:0,Adobe Flash Player:35(根据图)

我正在使用Windows 7,并在C#中尝试它(因为Java无法实现这一点).

我已经找到了为正在运行的应用程序获取和设置主音量(对于Windows Media Player显示65%的句柄栏)的方法,有没有办法获得绿色波动的水平数据?

谢谢!

音频混音器

c# audio mixer wasapi cscore

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

eclipse mars/luna无法读取存储库

我不能使用eclipse火星的默认存储库.比如说http://download.eclipse.org/eclipse/updates/4.5/.代理没有问题.我可以http://download.eclipse.org/eclipse/updates/4.5/使用eclipse的内部Web浏览器.问题是它总是试图连接到http://download.eclipse.org/eclipse/updates/4.5/compositeContent.xml不存在的URL (在浏览器中打开404).我真的不知道为什么.

错误是:

Unable to connect to repository http://download.eclipse.org/eclipse/updates/4.5/compositeContent.xml
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.eclipse.ecf.provider.filetransfer.httpclient4.HttpClientFileSystemBrowser.runRequest(HttpClientFileSystemBrowser.java:259)
at org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser$DirectoryJob.run(AbstractFileSystemBrowser.java:69)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Run Code Online (Sandbox Code Playgroud)

编辑:尝试了Eclipse Luna,同样的问题.

eclipse repository

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

目标网络标准 2.1 预览

我们如何在 csproj 文件中将 netstandard 2.1 预览设置为目标框架?

以下不起作用:

<TargetFramework>netstandard2.1</TargetFramework>
Run Code Online (Sandbox Code Playgroud)

dotnet core 2.1 预览版 sdk 已安装。

.net-standard net-standard-2.1

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

WPF 文本框绑定百分比

我必须将 TextBox 绑定到 % 值。所以我在 Binding 上设置 StringFormat 属性,如下所示:

<TextBox Text="{Binding Path=BewertungsFaktore.Gewinn, StringFormat=P2, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxStyle}" HorizontalAlignment="Left"/>
Run Code Online (Sandbox Code Playgroud)

这似乎工作得很好。但是,如果我编辑该值,则会出现问题。例如,如果我输入值 1,则文本框应将其格式化为 1%。但主要问题是它格式化为 100.00%。另一个问题是,如果我使用的是德语系统,我是否必须输入“,”而不是“.”?

c# format wpf

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

Linq + Where + abstract method = LINQ to Entities无法识别方法

首先:我知道关于这个话题已经有很多问题了.但我真的找不到任何解决方案.我的问题是我使用抽象方法从dbset中进行选择.我的代码看起来像这样:

var dbe = (from i in dbEntities where IsEqualRecord(me, i) select i);
Run Code Online (Sandbox Code Playgroud)

这是我的抽象方法deklaration:

protected abstract bool IsEqualRecord(MEntity modelEntities, DEntity databaseEntity);
Run Code Online (Sandbox Code Playgroud)

MEntity并且DEntity是通用类型.我已经读过我的where语句无法转换为sql语句.但是我该如何解决这个问题呢?还有其他方法吗?

请不要投票结束这个问题.我已经看了几乎所有关于stackoverflow的类似问题,但我找不到解决方案.

c# linq entity-framework

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

调用Any或Count后,Entity Framework会抛出NotSupportedException

我有以下代码:

private void Import(DbSet<DBEntity> dbEntities, IEnumerable<ExcelEntity> entities, ClapEntities context)
{
    foreach (var me in entities)
    {
        try
        {
            var dbe = dbEntities.Where(IsEqualRecord(me, context));
            bool hasElement = dbe.Any(); //Line which throws the exception
        }
        catch (Exception ex)
        {
            //...
        }
    }
}

protected abstract Expression<Func<DBEntity, bool>> IsEqualRecord(ExcelEntity entity, ClapEntities context);
Run Code Online (Sandbox Code Playgroud)

Any()扩展抛出了NotSupportedException:

System.Exception:无法将实体映射到数据库.映射器:[CuttingToolImport]; Rownumber:[153] ---> System.NotSupportedException:方法'First'只能用作最终查询操作.请考虑在此实例中使用方法"FirstOrDefault".
at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.FirstTranslator.TranslateUnary(ExpressionConverter parent,DbExpression操作数,MethodCallExpression调用)
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter)母体,MethodCallExpression LINQ)
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(表达式LINQ)
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.EqualsTranslator.TypedTranslate(ExpressionConverter父,BinaryExpression LINQ)
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.BinaryTranslator.TypedTranslate(ExpressionConverter父,BinaryExpression LINQ)
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(表达式LINQ)
在System.Data. Entity.Core.Objects.ELinq.ExpressionConverter.TranslateLambda(LambdaExpression拉姆达,DbExpression输入)
在System.Data.Entity.Core.Objects.ELinq.ExpressionC
System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent,MethodCallExpression call)中的onverter.MethodCallTranslator.OneLambdaTranslator.Translate(ExpressionConverter parent,MethodCallExpression call,DbExpression&source,DbExpressionBinding&sourceBinding,DbExpression&lambda).
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.MethodCallTranslator.TypedTranslate(ExpressionConverter父,MethodCallExpression LINQ)
在System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.TranslateExpression(表达式LINQ) …

c# sql entity-framework

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

反转枚举标志

可以说我有以下标志:

[Flags]
public enum Foo
{
    None = 0,
    Foo1 = 1,
    Foo2 = 2,
    Foo4 = 4,
    Foo8 = 8
}
Run Code Online (Sandbox Code Playgroud)

现在我有一个变量foo:

var foo = Foo.Foo1 | Foo.Foo4;
Run Code Online (Sandbox Code Playgroud)

我想要得到的是以下倒置的旗帜foo.这意味着这样的事情:

Foo.Foo2 | Foo.Foo8
Run Code Online (Sandbox Code Playgroud)

我试过〜运算符.但由于我的枚举是一个int32值,它反转所有32位.但实际上我只需要反转我使用的位Foo enum.

编辑:Foo1 | Foo4将等于以下位掩码:

00000000 00000000 00000000 00000101
Run Code Online (Sandbox Code Playgroud)

如果使用〜运算符反转该位掩码,则会得到以下结果:

11111111 11111111 11111111 11111010
Run Code Online (Sandbox Code Playgroud)

我希望得到的结果是:

00000000 00000000 00000000 00001010
Run Code Online (Sandbox Code Playgroud)

如你看到的.我只是想通过Foo枚举反转USED位.不是整个32整数值的所有位.

c# enums flags bit-manipulation

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

ef core - 两个一对一的主键

得到以下数据模型:

class EntityA
{
    Guid Id { get; set; }

    //Property1 and Property2 will never be the same
    EntityB Property1 { get; set; }
    EntityB Property2 { get; set; }
}

class EntityB
{
    int Id { get; set; }

    EntityA EntityAProperty { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

但我无法配置关系。EntityA 引用了两个不同的 EntityB。请给我一些关于如何配置它的建议。

尝试过类似的东西(对于 property1 和 property2):

e.HasOne(x => x.Property1)
                    .WithOne()
                    .HasForeignKey<EntityB>(x => x.Property1Id)
                    .IsRequired(false);
Run Code Online (Sandbox Code Playgroud)

或者

e.HasOne(x => x.Property1)
                    .WithOne(x => x.EntityB)
                    .HasForeignKey<EntityB>(x => x.Property1Id)
                    .IsRequired(false);
Run Code Online (Sandbox Code Playgroud)

第一个告诉我

外键属性 {'Id' : int} 的最佳匹配与主键 {'Id' …

entity-relationship entity-framework

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