Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling the Windows WinMM DLL

843829Oct 8 2002 — edited Oct 9 2002
Hi,

I am trying to call the method WaveInGetDevCaps in the WinMM.dll
without success as shown below:

typedef UINT (*INPUTDEVCAPS)(UINT, LPWAVEINCAPS, UINT);

/*
* Class: PCDevices
* Method: getMicDeviceNameOnPC
* Signature: (I)Ljava/lang/String;
*/

JNIEXPORT jstring JNICALL Java_PCDevices_getMicDeviceNameOnPC
(JNIEnv * env, jobject obj, jint id) {

WAVEINCAPS caps;

INPUTDEVCAPS devCaps = (INPUTDEVCAPS) GetProcAddress(ref, "waveInGetDevCapsW");

if (devCaps != NULL) {
int status = (devCaps)(0, &caps, sizeof(WAVEINCAPS));
if (status == MMSYSERR_NOERROR) {
return env->NewStringUTF(caps.szPname);
} else {
return env->NewStringUTF("Error");
}
} else {
FreeLibrary(ref);
}
}

Initially the GetProcAddress failed when I used the generic method name WaveInGetDevCaps
without the "W". Which is strange because other methods in this DLL work without the Suffix
e.g. waveInGetNumDevs().

When I use the suffix I then get the following error:

"The value of ESP was not properly saved across a function call"

I would appreciate if someone could help me with this problem as I am not sure how now
to proceed.

Thanks in advance

Steve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2002
Added on Oct 8 2002
1 comment
252 views