CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    5

    Question Create irregular window in win32 dll

    I'd like to create an irregular window in win32 dll. The same code I use can be used in win32 application, but, it doesn't work quite well in win32 dll. It seems having message loop deadlock. Can anyone tell me a simple example that create a window in dll?

    Thanks.


    here is the code I call in DLL_PROCESS_ATTACH:
    int InitWnd(HINSTANCE hInst) {
    static TCHAR szAppName[] = TEXT("TTT");
    MSG msg;
    WNDCLASS wndclass;

    if (hwnd != NULL) return -1;

    hInstance = hInst;

    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = WndProc;
    wndclass.cbClsExtra = 0;
    wndclass.cbWndExtra = 0;
    wndclass.hInstance = hInstance;
    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wndclass.lpszMenuName = NULL;
    wndclass.lpszClassName = szAppName;

    if (!RegisterClass(&wndclass)) {
    MessageBox(NULL, TEXT("wrong"), "title", MB_ICONERROR);
    return 0;
    }

    nSizeBorder = GetSystemMetrics(SM_CXSIZEFRAME) + 1;


    hwnd = CreateWindowEx(0, szAppName,
    "tttwindow",
    WS_POPUP,
    200,
    200,
    600,
    600,
    NULL,
    NULL,
    hInstance,
    NULL);

    SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

    ShowWindow(hwnd, SW_SHOW);

    UpdateWindow(hwnd);

    return 0;
    } //InitWnd()
    Last edited by san_lee; January 14th, 2003 at 10:19 PM.

  2. #2
    Show us your code, and maybe we can solve your problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured