SetWindowText - Ne marche pas de C++ a VB!!! Aidez-moi:(

Résolu
pepsidrinker Messages postés 151 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 15 avril 2009 - 16 mai 2007 à 21:27
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 16 mai 2007 à 21:34
Aidez-moi svp.
Voila,
J'ai un DLL fait de c++ qui change le texte d'une fenetre avec SetWindowText.
Voici le code (tout simple)
-------------------------------------------------------
dll de c++
------------------------------------------------------
#include "stdafx.h"
#include <windows.h>


extern "C" __declspec(dllexport) void __stdcall  SetWndText(char* p_string,HWND hwnd);


BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved )
{


    return TRUE;
}


void __stdcall SetWndText(char* p_string,HWND hwnd)
{
 SetWindowText(hwnd,p_string);
}

-------------------------------------------------------
FIN dll de c++
------------------------------------------------------
et donc, dans un autre code c++,je trouve le 'hwnd' de la fenetre(une fenetre text) d'un prog fait en vb comme voici:
------------
prog c++ qui trouve le hwnd de la fenetre de vb
---------


HWND parent = FindWindowA("ThunderFormDC",
"Ihotel International Inc.");



if



(parent==NULL)cout<<


"1"
;HWND child = FindWindowExA(parent,NULL,


"ThunderTextBox"
,NULL);


if



(child==NULL)cout<<


"2"
;SetWndText(


"salut de c++"
,child);

------------
FIN DE prog c++ qui trouve le hwnd de la fenetre de vb
---------


et voila...kan je met 'setwndtext' avec 'parent' comme hwnd, sa marche...mais avec 'child' marche pas... et le handle est valide...
kku peut mexpliker ste plai??

Pepsidrinker

1 réponse

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
16 mai 2007 à 21:34
SendMessage avec WM_SETTEXT en inter processus.

ciao...
BruNews, MVP VC++
3
Rejoignez-nous