OVH Cloud OVH Cloud

Ajouter une toolbar dans outlook express

15 réponses
Avatar
MarcU$
Est qui en aurais qui serais comment ajouter une toolbar dans outlook
express?

MarcU$

5 réponses

1 2
Avatar
MarcU$
"Christian ASTOR" wrote in message
news:3feb5925$0$6966$
MarcU$ a écrit:

> Est-il possible de faire ça avec un EXE ou dois-je absolument passer par


une
> DLL?

Faut passer par une DLL (une adresse ds un process n'a pas de
signification ds l'esp. d'adr. d'un autre process)
Indispensable aussi pour subclasser & intercepter les messages générés
par la Toolbar ajoutée.

> Qui est où qu'est ce que Richter?

Google si on sait pas.
"Programming Applications for Microsoft Windows, Fourth Edition", la
réf. pour tout ce qui est processes, threads, objets de synchro & Cie.

> A quoi peu servir la SizableRebar dans l'ajout d'une toolbar?

A rien, elle est juste ds la hiérarchie des fenêtres de OE (Spy++)




J'ai fait des test mais sa donne rien de plus, pourrait tu me montrer un
bout de code pour que je puisse comprendre ce qui cloche.

MarcU$
Avatar
Christian ASTOR
MarcU$ a écrit:


J'ai fait des test mais sa donne rien de plus, pourrait tu me montrer un
bout de code pour que je puisse comprendre ce qui cloche.



Oui, bien qu'il n'y ait presque pas de code.
Vieil ex basique de test pour OE 6 (tjrs Spy++ pour classes) :
"ThorConnWndClass" pour hook CBT
J'ai pas mis la création de la Toolbar ds GetMsgProc(), puisqu'il n'y a
pas de difficulté pour ça : suffit de reprendre l'ex principal de MSDN
et ça marche.

La DLL (appelée par ex "OEHook.dll" =>

HINSTANCE hInst;
HHOOK hCBTHook, hGetMsgHook;

LRESULT CALLBACK CBTProc( int nCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK GetMsgProc (int nCode, WPARAM wParam, LPARAM lParam );

#pragma data_seg ("Shared")
// hWndNotify sert pour les tests : par ex, hWnd du prog lançant la DLL.
//Elle contient une Listbox pour lister toutes les fenêtres créées par //OE
HWND hWndNotify = NULL;
#pragma data_seg ()

UINT uOEMsg;

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
hInst = (HINSTANCE) hModule;
uOEMsg = RegisterWindowMessage("OEMSG");
}
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
{
if (hCBTHook)
UnhookWindowsHookEx(hCBTHook);
if (hGetMsgHook)
UnhookWindowsHookEx(hGetMsgHook);
}
break;
}
return TRUE;
}

HWND GetOERebar()
{
HWND hWndOE = FindWindow("Outlook Express Browser Class", NULL);
HWND hWndSR = FindWindowEx(hWndOE, NULL, "SizableRebar", NULL);
HWND hWnd= FindWindowEx(hWndSR, NULL, "ReBarWindow32", NULL);
return hWnd;
}

LRESULT CALLBACK CBTProc( int nCode, WPARAM wParam, LPARAM lParam)
{
LPCBT_CREATEWND lpCW;
if (nCode >= 0)
{
switch ( nCode )
{
case HCBT_CREATEWND:
{
lpCW = (LPCBT_CREATEWND) lParam;
char sClass[MAX_PATH];
HWND hOERebar;
GetClassName ((HWND)wParam, sClass, 255);
if (strcmp(sClass, "ThorConnWndClass") == 0)
{
hOERebar = GetOERebar();

}
// Pour test : on liste toutes les fenêtres crées par OE
HWND hWndLB = FindWindowEx(hWndNotify, NULL, "Listbox", NULL);
SendMessage(hWndLB, LB_ADDSTRING, 0, (LPARAM)(LPSTR)sClass) ;
if (!hGetMsgHook && hOERebar)
{
hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE ,
(HOOKPROC)GetMsgProc, hInst, 0);
DWORD dwThreadId = GetWindowThreadProcessId(hOERebar, NULL);
PostThreadMessage(dwThreadId, uOEMsg, 0, 0);
}
}
break;
}

}
return nCode < 0 ? CallNextHookEx(hCBTHook, nCode, wParam, lParam) : 0;

}


LRESULT CALLBACK GetMsgProc (int nCode, WPARAM wParam, LPARAM lParam )
{
MSG *lpMsg;
if (nCode >= 0)
{
lpMsg = (MSG*) lParam;
if ( lpMsg->message == uOEMsg)
{
// Pour Test
char sText[255];
HWND hOERebar = GetOERebar();
wsprintf (sText, "hWnd = %x", hOERebar);
MessageBox(NULL, sText, "Info", MB_OK);

}

}
return CallNextHookEx(hGetMsgHook, nCode, wParam, lParam);

}

OEHOOK_API BOOL SetOEHook(BOOL bInstall, HWND hLocalWnd)
{
if (bInstall)
{
HWND hOERebar = GetOERebar();
if (!hOERebar)
{
if(!(hCBTHook = SetWindowsHookEx(WH_CBT, (HOOKPROC)CBTProc, hInst, 0)))
return FALSE;
else
hWndNotify = hLocalWnd;
}
else
{
hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE , (HOOKPROC)GetMsgProc,
hInst, 0);
DWORD dwThreadId = GetWindowThreadProcessId(hOERebar, NULL);
PostThreadMessage(dwThreadId, uOEMsg, 0, (LPARAM)hOERebar);

}
}
else
{
if (hCBTHook)
UnhookWindowsHookEx(hCBTHook);
if (hGetMsgHook)
UnhookWindowsHookEx(hGetMsgHook);
}
return TRUE;

}

.h => #ifdef OEHOOK_EXPORTS
#define OEHOOK_API __declspec(dllexport)
#else
#define OEHOOK_API __declspec(dllimport)
#endif

.def =>
LIBRARY "OEHook"
EXPORTS
SetOEHook
SECTIONS
Shared READ WRITE SHARED

L'appli appelante =>

typedef BOOL (*LOADPROC)(BOOL bInstall, HWND hLocalWnd);

BOOL InstallHook(BOOL bInstall, HWND hWndNotify)
{
LOADPROC pFctn;
HMODULE hDLL = GetModuleHandle("OEHook");
if (hDLL == NULL) return FALSE;
pFctn = (LOADPROC)GetProcAddress(hDLL,"SetOEHook");
if (!pFctn (bInstall, hWndNotify)) return FALSE;
return TRUE;
}


puis ds le WinMain =>

// d'abord création hWnd principale & Cie puis :
HMODULE hDll;
hDll = LoadLibrary("OEHook.dll" );
if (!hDll )
return 0;
InstallHook(TRUE, hWnd);

// boucle Msg
MSG msg;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

InstallHook(FALSE, NULL);

FreeLibrary(hDll);
Avatar
MarcU$
HOURA sa la fonctionner.
J'ai fait un premier test avec SendMessage au lieu de PostThreadMessage et
sa fonction quand même.

Merci bien

MarcU$
Avatar
MarcU$
Merde sauf que la en fesans des teste j'ai effacer l'autre toolbar avec un
RB_DELETEBAND et elle ne veulent pas réapparaitre même et reboutant ou en
cochant toolbar dans le sous menu. Tu aurait pas une petite idée comment la
faire réapparaitre.

MarcU$


"MarcU$" <marcU$@hotmail.com> wrote in message
news:%_OHb.19690$
HOURA sa la fonctionner.
J'ai fait un premier test avec SendMessage au lieu de PostThreadMessage et
sa fonction quand même.

Merci bien

MarcU$




Avatar
MarcU$
Finallement j'ai réinstaller outlook :)

MarcU$


"MarcU$" <marcU$@hotmail.com> wrote in message
news:3JPHb.20002$
Merde sauf que la en fesans des teste j'ai effacer l'autre toolbar avec un
RB_DELETEBAND et elle ne veulent pas réapparaitre même et reboutant ou en
cochant toolbar dans le sous menu. Tu aurait pas une petite idée comment


la
faire réapparaitre.

MarcU$


"MarcU$" <marcU$@hotmail.com> wrote in message
news:%_OHb.19690$
> HOURA sa la fonctionner.
> J'ai fait un premier test avec SendMessage au lieu de PostThreadMessage


et
> sa fonction quand même.
>
> Merci bien
>
> MarcU$
>
>




1 2