Error : JNI

  • Thread starter Anitha Namachivayam via JavaKB.com
  • Start date
A

Anitha Namachivayam via JavaKB.com

Hi,

How to pass handle of JFrame window to VC++ in JNI?

I used FindWindow :

JNIEXPORT void JNICALL
Java_T_Tmanager_init1(JNIEnv *env, jclass cla,jstring str)
{
const char* cw = env->GetStringUTFChars(str, 0);
HWND hwnd = FindWindow(NULL,cw);
env->ReleaseStringUTFChars(str, cw);
InitTwain(hwnd);
}

When i tried to create dll file, it is showing the following error :

TmanagerImpl1.obj : error LNK2001 : unresolved external symbol
_imp_FindWindowA@8

sample.dll: fatal error LNK1120 : 1 unresolved externals

Please help me in finding this error...

Thanks,
Sri
 
T

Thomas Fritsch

Anitha said:
Hi,

How to pass handle of JFrame window to VC++ in JNI?

I used FindWindow :

JNIEXPORT void JNICALL
Java_T_Tmanager_init1(JNIEnv *env, jclass cla,jstring str)
{
const char* cw = env->GetStringUTFChars(str, 0);
HWND hwnd = FindWindow(NULL,cw);
env->ReleaseStringUTFChars(str, cw);
InitTwain(hwnd);
}

When i tried to create dll file, it is showing the following error :

TmanagerImpl1.obj : error LNK2001 : unresolved external symbol
_imp_FindWindowA@8
The linker complained because of the Windows-API-function FindWindow.
This function resides in USER32.DLL. I think you have to add the
import-library USER32.LIB to your VC++ project settings, or something
like that.
sample.dll: fatal error LNK1120 : 1 unresolved externals

Please help me in finding this error...

Thanks,
Sri
Hope this helps.
 
A

Anitha Namachivayam via JavaKB.com

Hello,
I know FindWindow is present in user32.dll. This dll is present in c:\
windows\system32.

when i give the command(given in next line), the error that i already
mentioned is coming.

link /LibPath:C:\Progra~1\Micros~3\vc98\Lib /dll /out:sample.dll
TManagerImpl1.obj

I don't know where to load User32.dll and how to include in path.
Can any help me !!! Plz very urgent !!!

Thanks,
Sri
 
T

Thomas Fritsch

Anitha said:
Hello,
I know FindWindow is present in user32.dll. This dll is present in c:\
windows\system32.

when i give the command(given in next line), the error that i already
mentioned is coming.

link /LibPath:C:\Progra~1\Micros~3\vc98\Lib /dll /out:sample.dll
TManagerImpl1.obj

I don't know where to load User32.dll and how to include in path.
Can any help me !!! Plz very urgent !!!

As far as I know, you have to link with the import-library USER32.LIB
(should be in the LIB folder of your VC++ installation), *not* with
USER32.DLL. USER32.DLL (in the Windows system folder, as you said) is
required only at run-time, not at link-time.
Sorry, but I'm not familiar in using LINK.EXE from the command-line.
Actually I don't know more than the help-text from calling "LINK /?".
But it should be an easy question for other Windows-experts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top