here's the code of a dll i have:
#include
#define MYCOMMAND __declspec ( dllexport )
#define save 9001
#define open 9002
#define close 9003
MYCOMMAND menu3(int a){
WNDPROC OldWndProc;
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam)
{
switch(wParam)
{
case save:
MessageBox(NULL,"hello","",MB_OK);
break;
default:
return CallWindowProc(OldWndProc,
hwnd, uMsg, wParam, lParam);
}
return 0;
}
/*int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE d2,
LPSTR d3, int d4)
{ */
MSG msg;
HMENU hMenu,hSubMenu;
HWND hwnd;
hwnd = GetActiveWindow();
hMenu = CreateMenu();
hSubMenu = CreatePopupMenu();
AppendMenu(hSubMenu, MF_STRING,save, "save");
AppendMenu(hSubMenu, MF_STRING,open, "open");
AppendMenuA(hMenu,MF_STRING | MF_POPUP,(UINT)hSubMenu,"file");
AppendMenuA(hMenu,MF_STRING ,close,"close");
SetMenu(hwnd,hMenu);
/* hwnd = CreateWindow("BUTTON", "Hello, World!",
WS_VISIBLE | BS_CENTER, 100, 100, 100, 80,
NULL, NULL, hInstance, NULL); */
OldWndProc =
(WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG)WndProc);
while (GetMessage(&msg, NULL, 0, 0))
DispatchMessage(&msg);
return msg.wParam;
//}
return 0; }
it's basicly the code of someone's example of subclassing that i have altered to accept the handle of my db project window. it works fine but it still does what my other examples did which is when the dll is called it seems to loop within the dll and doesn't return to the db program.
load dll "C:\menu0.4.dll",1
a=call dll(1,"menu3")
`inc a
do
inc a
print "...",a
sync
loop
end
could this be because i'm doing this with the 'call dll' function instead of compiling using the pluging method, it's a bit hard to explain but i thought by subclassing the db project window you where just changing the area where the messages are proccessed and once this was done the window would just act on the new area until the program ended, no need to call the function again?