native

Gradient Brush in Native C++?

梦想的初衷 提交于 2020-01-04 17:32:11
问题 In c#, you can use drawing2d.lineargradientbrush, but in c++ right now I only found the CreateSolidBrush function. Is there a function in the native gdi dll to create a gradient brush? I couldn't find anything like this at msdn. Thanks 回答1: To draw a vertical gradient: void VerticalGradient(HDC hDC, const RECT& GradientFill, COLORREF rgbTop, COLORREF rgbBottom) { GRADIENT_RECT gradientRect = { 0, 1 }; TRIVERTEX triVertext[ 2 ] = { GradientFill.left - 1, GradientFill.top - 1, GetRValue(rgbTop)

How to solve “fatal: relocations remain against allocatable but non-writable sections” while using Java native interface?

為{幸葍}努か 提交于 2020-01-04 12:48:31
问题 I'm trying to call a C function inside a Java code. I have this hava code. public class JavaToC { public native void helloC(); static { System.loadLibrary("HelloWorld"); } public static void main(String[] args) { new JavaToC().helloC(); } } . I compiled it and then created header file. Then make the following HelloWorld.c file. #include <stdio.h> #include <jni.h> #include "JavaToC.h" JNIEXPORT void JNICALL Java_JavaToC_helloC(JNIEnv *env, jobject javaobj) { printf("Hello World: From C");

How to solve “fatal: relocations remain against allocatable but non-writable sections” while using Java native interface?

眉间皱痕 提交于 2020-01-04 12:47:11
问题 I'm trying to call a C function inside a Java code. I have this hava code. public class JavaToC { public native void helloC(); static { System.loadLibrary("HelloWorld"); } public static void main(String[] args) { new JavaToC().helloC(); } } . I compiled it and then created header file. Then make the following HelloWorld.c file. #include <stdio.h> #include <jni.h> #include "JavaToC.h" JNIEXPORT void JNICALL Java_JavaToC_helloC(JNIEnv *env, jobject javaobj) { printf("Hello World: From C");

How To Execute Native Commands In Java?

眉间皱痕 提交于 2020-01-04 09:14:12
问题 I know very well how to execute commands via Runtime.getRuntime().exec(command) and handle the output, but this is VERY limited. Take Windows for example (Vista specifically but that shouldn't matter). How can I execute commands like 'echo', 'cd', 'md', 'rd', and any other command rooted inside of the cmd.exe through ProcessBuilder (or whatever class) in Java? 回答1: You just call cmd /c dir rather than just dir in Runtime.exec or ProcessBuilder or some other way to run external applications in

Button click in sendmessage API

北慕城南 提交于 2020-01-04 05:16:14
问题 How can I simulate a button click in the sendmessage API in C#? 回答1: C code: #include <Windows.h> //... SendMessage(hWndButton, BM_CLICK, 0, 0); C# code: [DllImport("user32.dll")] static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); ... Button myButton = ...; const int BM_CLICK = 0x00F5; SendMessage(myButton.Handle, BM_CLICK, IntPtr.Zero, IntPtr.Zero); But be aware that, in C#, you can just as easily do: myButton.PerformClick(); 来源: https://stackoverflow.com

Hiding the navigation bar in pure android native

蓝咒 提交于 2020-01-04 04:26:08
问题 I've seen articles and articles on hiding the navigation bar for android application through java. However, what I would like to know, is how do I remove the navigation bar through a pure android c++ native-activity application for a full-screen application(game)(NO JAVA AT ALL!) . Full-screen from the android manifest works at hiding the top bar, but the navigation bar stays visible. This is the Navigation Bar that I wish to remove. I've searched through books with no luck, there's is no

javah not able to find android classes

本秂侑毒 提交于 2020-01-04 01:52:22
问题 When calling javah on a .java file in my android project, javah was unable to find the android classes (specifically android.graphics.Bitmap). here's the terminal output: thomas@THOMASDESKLINUX:~$ javah -classpath .:/home/thomas/Documents/LinuxProgramming/EclipseWorkspace/RenderScene/bin org.me.renderscene.Billboard javadoc: error - In doclet class com.sun.tools.javah.MainDoclet, method start has thrown an exception java.lang.reflect.InvocationTargetException com.sun.tools.javac.code.Symbol

Trying to use jawt on 64-bit WIndows 7 OS

ぃ、小莉子 提交于 2020-01-03 03:27:24
问题 I created a Java chat application several years ago on my 32-bit system and am using native code to achieve a window flash when a message is received and the window is minimized. I recompiled the C++ code that does the flashing with a 64-bit compiler and I have the 64-bit JRE version. However, when attempting to run the flash, I get an exception. Below is the C++ code and below that is the output of the log file. Thanks for any insight. #include "FlashWindow.h" #include <jawt_md.h> #include

Binding iOS embedded Framework for Xamarin END UP give exception?

独自空忆成欢 提交于 2020-01-03 03:04:08
问题 Please help my last step. Thanks. I'm testing binding iOS native framework to Xamarin library. I created iOS framework and added MyView.h, MyView.m MyView.m (instancetype)initWithFrame:(CGRect)frame { id p = [super initWithFrame:frame]; self.backgroundColor = [UIColor greenColor]; return p; } MyView.h @interface MyView : UIView @end very simple framework. add that MyView.h into Public Header and Made universal framework for any architecture. This framework now has firstfile.h, MyView.h two

JAVA中native方法调用

可紊 提交于 2020-01-03 02:42:48
在 Java 中native是关键字。它一般在本地声明,异地用C和C++来实现。它的声明有几点要注意:1)native与访问控制符前后的关系不受限制。2)必须在返回类型之前。3)它一般为非抽象类方法。4)native方法在异地实现,象抽象方法一样,所以没有方法体,以分号结束。如下列5种声明: native public void f(); 正确。 private native void f(); 正确。 protected int native f(); 错误,返回类型位置不对,返回类型必须在native之后。 public abstract native void f(); native必然不是abstract的。 native int f(){} 错误,因为存在方法体{} public static native f(); 正确。static与native方法位置随意。 下例是比较典型的native的使用方式,用loadLibrary导入存在源文件目录下的*.dll文件,然后定义native方法时,与c/c++实现的函数有相同的参数和返回类型。 view plain copy to clipboard public class OpticalFlowCalculateDll{ static{ System.loadLibrary( "OpticalFlow"); }