我在规则MFC dll中创建窗口,extern "C"  _declspec (dllexport) void  dllWin(CWnd* pParentWnd, CRect rect)
{
CMyWnd* pWnd   =   new   CMyWnd; pWnd->Create(NULL, NULL, WS_VISIBLE|WS_CHILD, rect, pParentWnd, 0);
pWnd->ShowWindow(SW_SHOWNORMAL);
pWnd->UpdateWindow();
}然后在ACTIVEX控件中动态加载这个DLL,这个控件在IE浏览器中运行正常,可以创建DLL中的窗口我又在WIN32 dll 中创建win32窗口#include <Afxwin.h>LRESULT CALLBACK WinProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);
extern "C"  _declspec (dllexport) HWND dllWin32(HINSTANCE hInstance, HWND hWndParent, CRect rect)
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WinProc;
wndcls.lpszClassName="BlackWin";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndcls); HWND hwnd;
hwnd=CreateWindow("BlackWin", NULL, WS_VISIBLE|WS_CHILD,
rect.left, rect.top, rect.Width(), rect.Height(),
hWndParent, NULL, hInstance, NULL); ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd); return hwnd;
}
LRESULT CALLBACK WinProc(
  HWND hwnd,      // handle to window
  UINT uMsg,      // message identifier
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"char code is %d",wParam);
MessageBox(hwnd,szChar,"char",0);
break;
case WM_LBUTTONDOWN:
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
Ellipse(hDC,10,10,100,70); EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
//case WM_DESTROY:
//PostQuitMessage(0);
//break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}然后也在ACTIVEX控件中动态加载这个DLL,这个控件在IE浏览器中没有运行正常,不能创建DLL中的win32窗口这是怎么回事呢,多谢