MultiThreading Problem

Discussion in 'Win32' started by imported_hypheni, Aug 2, 2010.

  1. imported_hypheni

    imported_hypheni New Member

    Joined:
    Jun 24, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Im using CreateThread for multithreading in my program. But what I am facing is that one of my multithread fails to work as the thread function needs to have more than one argument. Actually Im using EnumChildWindows in one of my thread function and thus it fails to call the callback function from the main program. Here is my code, please correct me ..

    Code:
    HWND hGG;
    wchar_t getWndName[200];
    HANDLE hThread_A;
    
    DWORD WINAPI Auto_Thread (LPVOID hWnd)
    {
            hGG = (HWND)hWnd;
            for (;;)        {
                    if (IsZoomed(FindWindow(0, L"Application"))!=0)               
                            break;
            }
    
            hGG = FindWindow(0, L"Application");
            Sleep(500);
            EnumChildWindows(hGG, EnumChildProc, (LPARAM)&getWndName);
            //Here getWndName not passed to the new thread. I think here is my problem
            CloseHandle (hThread_A);
            return 0;
    }
    
    //executing thread by a button press
    
            hThread_A = CreateThread (0, 0, Auto_Thread, hw, 0 , 0);
    
    // EnumChildWindows Callback function
    
    BOOL CALLBACK EnumChildProc (HWND hwChild, LPARAM lParam)       
    {
            if (GetWindowText(hwChild, getWndName, 200)!=0 && wcscmp(getWndName, L"Found")==0)       
            {
                    // .............
            }
            return TRUE;
    }
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice