Go4Expert (http://www.go4expert.com/)
-   Win32 (http://www.go4expert.com/forums/win32/)
-   -   How to create a simple dialog in win32? (http://www.go4expert.com/forums/create-simple-dialog-win32-t18199/)

adrian 26Jun2009 09:31

How to create a simple dialog in win32?
I need a simple dialog with nothing on it (can't get simpler than that). I am fighting with this antiquated system using VC++6.0/MFC and LabVIEW 7.0. When I try and create a Tooltip in the OCX that is going into LV, it doesn't show up.

I then proceeded to do a lot of things, including a lot of swearing. I finally faked out a tooltip by way of a dialog generated by a resource, but I cannot get it to recognize the WS_EX_NOACTIVATE so that it doesn't grab focus. THIS IS THE VERY LAST THING I NEED TO DO! I will be leaving for holidays on Saturday and REALLY need this working before then.

I got to the point where I figured that if I am going to get this working, I'm going to have to forgo the MFC crap (really old MFC crap at that) and drill down to the WIN32 layer to do this properly. But I've never been able to sucessfully generate a dialog before. I've tried to create a window class, registered that, and then tried to create the window from there without success.

Here is the code:

Code: C++

BOOL MyCreate(HWND hwnd)
    HWND       hWnd;

    HINSTANCE hInstance = ::AfxGetInstanceHandle();

    if (WndClsEx.cbSize == 0) {
        // Create the application window
        WndClsEx.cbSize        = sizeof(WNDCLASSEX);
        WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;
        WndClsEx.lpfnWndProc   = CMyToolTip2::WndProc;
        WndClsEx.cbClsExtra    = 0;
        WndClsEx.cbWndExtra    = 0;
        WndClsEx.hIcon         = NULL;
        WndClsEx.hCursor       = NULL;
        WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
        WndClsEx.lpszMenuName  = NULL;
        WndClsEx.lpszClassName = ClsName;
        WndClsEx.hInstance     = hInstance;
        WndClsEx.hIconSm       = NULL;

        // Register the application

    // Create the window object
    hWnd = ::CreateWindow(
    // Find out if the window was created
    if ( !hWnd )
        int err = ::GetLastError();
        ASSERT(FALSE); // fails here with err = 0

I pass to this the hwnd of the ActiveX container. What am I doing wrong?

I really thank you for any help you can give me,


All times are GMT +5.5. The time now is 22:59.