难道你写使用.NET语言消费的桌面应用程序?如果是这样的类型?
我的印象是,大多数消费者桌面应用程序仍然是C,C++等本机编译的应用程序.
虽然.NET语言越来越受欢迎,但是这些新的应用程序是否会突破企业和Web领域,成为高街消费者应用程序?
例如,现在看看你的桌面?有多少应用程序是用.NET语言编写的,Firefox?微软办公软件?雷鸟?iTunes的?Microsoft Visual Studio?
我公司开发高端CAD/CAE应用程序,我们利用新技术,但我们的核心开发仍然使用C++完成.
在Delphi for Win32中,如何在没有BDE的情况下以本机方式读取和写入dbf文件?我知道网上有一些组件,但我从未使用过任何组件,所以我不知道如何选择(如果有的话).
我正在尝试使用Android添加联系人getContentResolver.首先我创建了一个ArrayList:
ArrayList<ContentProviderOperation> ops =
new ArrayList<ContentProviderOperation>();
Run Code Online (Sandbox Code Playgroud)
然后填充数组列表
int rawContactInsertIndex = ops.size();
ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME,accountName)
.build());
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID,rawContactInsertIndex)
.withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, name)
.build());
Run Code Online (Sandbox Code Playgroud)
最后是一个试块
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
Run Code Online (Sandbox Code Playgroud)
当我执行此操作时,我没有收到任何错误或异常.但该联系人不会出现在Android联系人中.当我检索隐形联系人时,我可以找到这个联系人.谁能弄清楚出了什么问题?
我这样做了吗?
我得到一个指向本机数组的指针,需要复制到托管数组.将memcpy()与pin_ptr一起使用.
unsigned char* pArray;
unsigned int arrayCount;
// get pArray & arrayCount (from a COM method)
ManagedClass->ByteArray = gcnew array<Byte,1>(arrayCount)
pin_ptr<System::Byte> pinPtrArray = &ManagedClass->ByteArray[0];
memcpy_s(pinPtrArray, arrayCount, pArray, arrayCount);
Run Code Online (Sandbox Code Playgroud)
arrayCount是pArray的实际长度,因此并不担心这个方面.查看代码并从向量中复制数组.所以我可以安全地设置托管数组大小.
我正在尝试在dart中为postgresql构建一个原生扩展.我已经在.o中编译了CC文件然后在.so(我猜的共享对象).它现在名为libpsql.so,我把它放在与我的.dart文件相同的目录中.dart文件的第一行是#import(dart-ext:libpsql); 但它一直告诉我资源不可用.
我的飞镖码
#library("psql");
#import("dart-ext:libpsql_dart");
class Database {
var mDb;
var mUser;
var mDbname;
var mPasswd;
var mHost;
var mPort;
var mTable;
//String toString() => "<PostgreSQL: $user@$_host:$_port/$_table>";
Database(host,user,passwd,dbname) : this.mUser = user, this.mHost = host, this.mPasswd = passwd, this.mDbname = dbname {
mDb = _connect(host,user,passwd,dbname);
}
}
_connect(host,user,passwd,dbname) native 'Connect';
Run Code Online (Sandbox Code Playgroud)
这是我的C++代码.
#include <string.h>
#include <stdio.h>
#include <libpq-fe.h>
#include "dart_api.h"
Dart_NativeFunction ResolveName(Dart_Handle name, int argc);
DART_EXPORT Dart_Handle psql_dart_Init(Dart_Handle parent_library) {
if (Dart_IsError(parent_library)) return parent_library;
Dart_Handle result_code =
Dart_SetNativeResolver(parent_library, ResolveName);
if (Dart_IsError(result_code)) …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建exe文件的图标,同时创建javafx打包的本机捆绑.我尝试将图标添加到pom.xml中,但直到它不会为我工作,因为它提供默认图标
使用Intellij IDEA IDE,其中包含一个Pom.xml创建一个包,command = mvn jfx:build-native
这是我的pom.xml:
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<mainClass>com.demoApp.testapp.testApplication</mainClass>
<!-- only required if signing the jar file -->
<keyStoreAlias>example-user</keyStoreAlias>
<keyStorePassword>example-password</keyStorePassword>
<permissions>
<permission>all-permissions</permission>
</permissions>
<icon>${basedir}/src/main/resources/images/logoIcon.ico</icon>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我已经在pom.xml $ {basedir} /src/main/resources/images/logoIcon.ico中添加了一个图标路径,它将在本机程序包执行时运行,但它对我不起作用
还有其他办法吗?请建议.
我使用ant在pom.xml中尝试了fx标签,这是我在pom.xml中的更改
<properties>
<javafx.tools.ant.jar>${env.JAVA_HOME}\lib\ant-javafx.jar</javafx.tools.ant.jar> </properties>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>create-launcher-jar</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target xmlns:fx="javafx:com.sun.javafx.tools.ant">
<taskdef
uri="javafx:com.sun.javafx.tools.ant"
resource="com/sun/javafx/tools/ant/antlib.xml"
classpath="${javafx.tools.ant.jar}"/>
<fx:application id="fxApp"
name="${project.name}"
mainClass="com.precisionhawk.flightplanner.FlightPlannerApp"/>
<fx:jar destfile="${project.build.directory}/${project.build.finalName}-launcher">
<fx:application refid="fxApp"/> …Run Code Online (Sandbox Code Playgroud) 我在使用COM包装器调用.NET dll(mclNET.dll)时遇到问题.这是我没有源代码的第三部分dll.基本上我想在我的纯本机C++应用程序中使用这个mclNET.dll,所以我正在开发一个C#包装器.MCLWrapper.dll,这使得在方法mclNET.dll可见.这是我做的:
在MCLWrapper.dll中,我添加了mclNET.dll作为参考,然后定义接口以使mclNET.dll方法可见.这是我的一些代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mclNET;
namespace MCLWrapper
{
public interface MCLControl
{
void MCLConnect(string SerialNumber);
void MCLSet_Switch(string SwitchName, int Val);
void MCLDisconnect();
};
public class MCLControlClass:MCLControl
{
private USB_RF_SwitchBox _sb = new USB_RF_SwitchBox();
public void MCLConnect(string SerialNumber)
{
_sb.Connect(ref SerialNumber);
}
public void MCLSet_Switch(string SwitchName, int Val)
{
_sb.Set_Switch(ref SwitchName, ref Val);
}
public void MCLDisconnect()
{
_sb.Disconnect(); …Run Code Online (Sandbox Code Playgroud) ArrayList<String> myArraylist;
public ArrayList<String> getData(){
myArraylist = new ArrayList<String>();
myArraylist.add("1267982563");
myArraylist.add("2345678");
myArraylist.add("5432789");
return myArraylist;
}
Run Code Online (Sandbox Code Playgroud)
如何从JNI端的上述方法获取每个项目,并推送到向量并从JNI返回到JNI层中的其他CPP调用.
我已设置测试设备窗台获取实时广告..
mAdView = (NativeExpressAdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("722378CE522E161F0EFAD13A658F5161")
.addTestDevice("048B0A7DC3863535720E0C21AC1C58FD")
.build();
mAdView.loadAd(adRequest);
Run Code Online (Sandbox Code Playgroud)
我的xml代码是:
<com.google.android.gms.ads.NativeExpressAdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_above="@+id/l2"
ads:adSize="360x80"
ads:adUnitId="@string/native_ads"
/>
Run Code Online (Sandbox Code Playgroud) 我使用libcoreclr.so制作类似于"corerun"的东西,并在我的应用程序中使用coreclr_initialize,coreclr_execute_assembly和coreclr_shutdown.
在我的环境中,标准输出和标准错误不可用.
当抛出未处理的异常时,corerun看起来打印出标准错误的异常.(我认为它可以通过AppDomain.UnhandledException工作)
我希望以原生方式捕获未处理的异常或更改异常消息输出的方式.
我尝试使用AppDomain.UnhnadledException进行coreclr_create_delegate,但Appdomain不是netcoreapp1.0中的公共API.
我如何捕获每个未处理的异常?