Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2979 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  activeX dans applet java

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

activeX dans applet java

n°1695598
puisquetur​epondspas
Posté le 01-03-2008 à 17:02:24  profilanswer
 

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 :
  1. /*
  2. * Class:     COMControl
  3. * Method:    initialize
  4. * Signature: ()V
  5. */
  6. JNIEXPORT void JNICALL Java_COMControl_initialize
  7.   (JNIEnv *env, jobject obj)
  8. {
  9. JAWT awt;
  10. JAWT_DrawingSurface *ds;
  11. JAWT_DrawingSurfaceInfo *dsi;
  12. JAWT_Win32DrawingSurfaceInfo *dsi_win;
  13. jint lock;
  14. // Get the AWT object from the Java environment.
  15. awt.version = JAWT_VERSION_1_4;
  16. JAWT_GetAWT(env, &awt);
  17. // Get the AWT drawing surface.
  18. ds = awt.GetDrawingSurface(env, obj);
  19. // Lock the drawing surface to perform additional actions.
  20. lock = ds->Lock(ds);
  21. // Get information about the drawing surface.
  22. dsi = ds->GetDrawingSurfaceInfo(ds);
  23. dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
  24. // Get the native window handle from the information above.
  25. HWND hWnd = dsi_win->hwnd;
  26. if (hWnd != NULL)
  27.  // Start a new thread to allow messages to be sent.
  28.  _beginthread(init, 0, hWnd);
  29. // Free the drawing surface info and unlock the drawing surface.
  30. ds->FreeDrawingSurfaceInfo(dsi);
  31. ds->Unlock(ds);
  32. awt.FreeDrawingSurface(ds);
  33. }


 
 
et changer cette methode

Code :
  1. using namespace NETControl;
  2. BOOL APIENTRY DllMain( HANDLE hModule,
  3.                        DWORD  ul_reason_for_call,
  4.                        LPVOID lpReserved
  5.      )
  6. {
  7.     return TRUE;
  8. }
  9. static CAxWindow *g_axWindow = NULL;
  10. static CComPtr<INETControl> g_spControl = NULL;
  11. static OLE_COLOR g_BackColor = NULL;
  12. static OLE_COLOR g_ForeColor = NULL;
  13. void init(void *argv)
  14. {
  15. HRESULT hr = S_OK;
  16. if (argv != NULL && g_axWindow == NULL)
  17. {
  18.  // Initialize COM.
  19.  CoInitialize(NULL);
  20.  // Create the CAxWindow to host the contorl.
  21.  g_axWindow = new CAxWindow((HWND)argv);
  22.  if (g_axWindow != NULL)
  23.  {
  24.   // Create and host the .NET control in our window.
  25.   hr = g_axWindow->CreateControl(CT2W(TEXT("DevX.NETControl" )),
  26.    NULL, NULL);
  27.   if (SUCCEEDED(hr))
  28.   {
  29.    // Get the interface pointer to the .NET control.
  30.    hr = g_axWindow->QueryControl(IID_INETControl,
  31.     (LPVOID*)&g_spControl);
  32.    if (FAILED(hr))
  33.    {
  34.     g_axWindow->DestroyWindow();
  35.     delete g_axWindow;
  36.     g_axWindow = NULL;
  37.     return;
  38.    }
  39.    // If the background and foreground colors have been
  40.    // cached, set them now.
  41.    if (g_BackColor != NULL)
  42.     g_spControl->put_BackColor(g_BackColor);
  43.    if (g_ForeColor != NULL)
  44.     g_spControl->put_ForeColor(g_ForeColor);
  45.   }
  46.   else
  47.   {
  48.    delete g_axWindow;
  49.    g_axWindow = NULL;
  50.   }
  51.  }
  52. }
  53. // Start the message loop.
  54. MSG msg;
  55. while (GetMessage(&msg, NULL, NULL, NULL))
  56. {
  57.  TranslateMessage(&msg);
  58.  DispatchMessage(&msg);
  59. }
  60. _endthread();
  61. }


 
 
Merci  
 
 

mood
Publicité
Posté le 01-03-2008 à 17:02:24  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  activeX dans applet java

 

Sujets relatifs
[JAVA SWING] probleme avec la gestion des layout managerAppeler WebService Java securisé
activeXPb de connexion java <-> BDD MySQL via un tunnel SSH
ActiveXproblème Java ME client web service
developper une solution en java pour la transmissionActiveX sous Visual .net 2005, chaine en parametre
[?PHP,HTML,JAVA?] problème avec une redirectionsavoir groupe grace a activeX ou applet java?
Plus de sujets relatifs à : activeX dans applet java


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR