puisqueturepondspas | Bonjour
Je veux integrer un activeX, une dll que j'ai telecharge dans une applet java
Je peux créer une applet, une couche jni et une native method for initializing the control.
J'ai trouve sur le net des exemple mais ce n'était pas avec une dll
j'ai conclu que les differents exemple utilisaient
1 exemple
http://www.codeproject.com/KB/java/javacom.aspx
HWND hwndChild = ::CreateWindow("AtlAxWin",
"Shell.Explorer.1", WS_CHILD|WS_VISIBLE,
0,0,0,0,
pThreadParam->hwnd,NULL,
::GetModuleHandle(NULL),
NULL);
pour integre ds l'applet une page internet
2em exemple
http://www.devx.com/interop/Article/19845#codeitemarea
// Create and host the .NET control in our window.
hr = g_axWindow->CreateControl(CT2W(TEXT("DevX.NETControl" )),
NULL, NULL);
il cree un control avec .NEt
je connais rien au C++
je me demande qu'est ce que je dois mettre dans ma methode create controle
Je ne peux pas cree l'activeX il est deja cree, avez vous des pistes . Merci
on m'a conseille de prendre le deuxieme exemple et d'enlever la couche .NET
je pense que je dois garder la methode de capture de lafenetre windows
Code :
- /*
- * Class: COMControl
- * Method: initialize
- * Signature: ()V
- */
- JNIEXPORT void JNICALL Java_COMControl_initialize
- (JNIEnv *env, jobject obj)
- {
- JAWT awt;
- JAWT_DrawingSurface *ds;
- JAWT_DrawingSurfaceInfo *dsi;
- JAWT_Win32DrawingSurfaceInfo *dsi_win;
- jint lock;
- // Get the AWT object from the Java environment.
- awt.version = JAWT_VERSION_1_4;
- JAWT_GetAWT(env, &awt);
- // Get the AWT drawing surface.
- ds = awt.GetDrawingSurface(env, obj);
- // Lock the drawing surface to perform additional actions.
- lock = ds->Lock(ds);
- // Get information about the drawing surface.
- dsi = ds->GetDrawingSurfaceInfo(ds);
- dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
- // Get the native window handle from the information above.
- HWND hWnd = dsi_win->hwnd;
- if (hWnd != NULL)
- // Start a new thread to allow messages to be sent.
- _beginthread(init, 0, hWnd);
- // Free the drawing surface info and unlock the drawing surface.
- ds->FreeDrawingSurfaceInfo(dsi);
- ds->Unlock(ds);
- awt.FreeDrawingSurface(ds);
- }
|
et changer cette methode
Code :
- using namespace NETControl;
- BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- return TRUE;
- }
- static CAxWindow *g_axWindow = NULL;
- static CComPtr<INETControl> g_spControl = NULL;
- static OLE_COLOR g_BackColor = NULL;
- static OLE_COLOR g_ForeColor = NULL;
- void init(void *argv)
- {
- HRESULT hr = S_OK;
- if (argv != NULL && g_axWindow == NULL)
- {
- // Initialize COM.
- CoInitialize(NULL);
- // Create the CAxWindow to host the contorl.
- g_axWindow = new CAxWindow((HWND)argv);
- if (g_axWindow != NULL)
- {
- // Create and host the .NET control in our window.
- hr = g_axWindow->CreateControl(CT2W(TEXT("DevX.NETControl" )),
- NULL, NULL);
- if (SUCCEEDED(hr))
- {
- // Get the interface pointer to the .NET control.
- hr = g_axWindow->QueryControl(IID_INETControl,
- (LPVOID*)&g_spControl);
- if (FAILED(hr))
- {
- g_axWindow->DestroyWindow();
- delete g_axWindow;
- g_axWindow = NULL;
- return;
- }
- // If the background and foreground colors have been
- // cached, set them now.
- if (g_BackColor != NULL)
- g_spControl->put_BackColor(g_BackColor);
- if (g_ForeColor != NULL)
- g_spControl->put_ForeColor(g_ForeColor);
- }
- else
- {
- delete g_axWindow;
- g_axWindow = NULL;
- }
- }
- }
- // Start the message loop.
- MSG msg;
- while (GetMessage(&msg, NULL, NULL, NULL))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- _endthread();
- }
|
Merci
|