How would I implement this C++ code into this header file, needed for java implementation [closed]

  c++, java, java-native-interface, javafx, native

So I have this c++ code I wish to implement into my java project.

Function: change resolution

DEVMODE devmode;
devmode.dmSize = sizeof(DEVMODE);
devmode.dmPelsWidth = desiredWidth;
devmode.dmPelsHeight = desiredHeight;

long result = ChangeDisplaySettings(&devmode, DM_PELSWIDTH || DM_PELSHEIGHT);

I want to implement this into this header file I generated and into its respected function so I can use it in my java project…

#include <jni.h>

#ifndef _Included_Main_C
#define _Included_Main_C
#ifdef __cplusplus
extern "C" {
#endif

//list resolutions (ignore)
JNIEXPORT jobject JNICALL Java_Main_C_list
  (JNIEnv *, jclass);

//change resolution
//jint represents width and height
JNIEXPORT jboolean JNICALL Java_Main_C_change
  (JNIEnv *, jclass, jint, jint);

#ifdef __cplusplus
}
#endif
#endif

Any help would be appreciated.

Source: Windows Questions C++

LEAVE A COMMENT