Problem Creating Docklets Using Vc++.net 2002

Hi all!

I am having a problem in creating a docklet. It seems that the dock was not able to recognize my DLL even though I put it under the /docklets folder. When I choose Add Docklet... the dll I placed there will not appear on the list!

I included the YzDocklet.lib under Linker --> Input --> Additional Dependencies but it still does not work. I can't find my DLL in the list of docklets!

Here is my source code:

#include <windows.h>
#include "YzDocklet.h"

HWND g_hWndDocklet = NULL;
int  g_idDocklet   = -1;
HINSTANCE g_hInst  = NULL;

LRESULT CALLBACK wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return (DefWindowProc(hWnd, message, wParam, lParam));
}

EXPORT HWND __cdecl OnInitialize(HINSTANCE hInst, HWND hWndDock, int idDocklet)
{
g_hInst = hInst;
g_hWndDocklet = hWndDock;
g_hWndDocklet = YzDockletCreate(hInst, idDocklet, wndProc);
g_idDocklet = idDocklet;

return g_hWndDocklet;
}

EXPORT void __cdecl YzDockletTerminate(HINSTANCE hInst, HWND hWndDocklet)
{
YzDockletDestroy(hInst, hWndDocklet);
}

EXPORT void __cdecl OnTerminate(HINSTANCE hInst, HWND hWndDocklet)
{
YzDockletDestroy(hInst, hWndDocklet);
}

EXPORT BOOL __cdecl OnLeftButtonClick(int x, int y, int width, int height, UINT key,
       BOOL& isMenuPopup, TypeDockletAnim& typeAnim)
{
MessageBox(g_hWndDocklet, "Left button clicked", NULL, MB_OK);
return TRUE;
}

Help!

#32477

1) What version of Y'z Dock are you using? (should be 0.80+)

2) You need to include the following:

// You prob. won't need this line if you did the "Dependency" thing
#pragma comment(lib, "../DockletSDK/YzDocklet.lib")

EXPORT DWORD __cdecl OnVersion(void)
{
/*
* Description:
*
*   This function tells to Y'z Dock that the version of Docklet-SDK
*   which this docklet linked.
*   This function is called ahead of OnInitialize().
*   This function must exist.
*
* Arguments:
*
*   No arguments.
*
* Return value:
*   It should return YZDOCKLET_VERSION.
*/
       return YZDOCKLET_VERSION;
}

I hope this helps.

#32496

If you're using Visual Studio .Net 2002 you need to make sure you're creating an unmanaged DLL. If you aren't, the DLL won't be a "proper" DLL - it'll be a .Net managed one - it'll be in .Net's "intermediate language" (or IL to it's friends) as opposed to machine code.

I would imagine, as Y'z Dock isn't a .Net program, that it doesn't support .Net based DLLs, and so you would need to make an unmanaged one.

#32508