Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Enumwindows hangs (freezing) application any idea?

Enumwindows hangs (freezing) application any idea?

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsonquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ERLN
    wrote on last edited by
    #1

    Hi I have using MFC dialog application. in that it is calling another dialog. in 2nd dialog i am enumerating the windows using enumwindows api. after calling the enumwindows application is freezing or hanging. any idea about this.

    D R 2 Replies Last reply
    0
    • E ERLN

      Hi I have using MFC dialog application. in that it is calling another dialog. in 2nd dialog i am enumerating the windows using enumwindows api. after calling the enumwindows application is freezing or hanging. any idea about this.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Does your callback get called at all?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      1 Reply Last reply
      0
      • E ERLN

        Hi I have using MFC dialog application. in that it is calling another dialog. in 2nd dialog i am enumerating the windows using enumwindows api. after calling the enumwindows application is freezing or hanging. any idea about this.

        R Offline
        R Offline
        rp_suman
        wrote on last edited by
        #3

        Please post the code snippet where the application hangs. APIs never hang application, only the way of using it. Something might went wrong in the callback.

        -- "Programming is an art that fights back!"

        E 1 Reply Last reply
        0
        • R rp_suman

          Please post the code snippet where the application hangs. APIs never hang application, only the way of using it. Something might went wrong in the callback.

          -- "Programming is an art that fights back!"

          E Offline
          E Offline
          ERLN
          wrote on last edited by
          #4

          Dialog1 ::Onok()
          {

          HWND hShareWnd = NULL;
          UpdateData();
          bDesktopShareStarted = 	!bDesktopShareStarted ;
          if(bDesktopShareStarted)
          {
          	int width = GetSystemMetrics(SM\_CXSCREEN);
          	int height = GetSystemMetrics(SM\_CYSCREEN);
          	int x = 0;
          	int y =0;
          
          	CVariableRegion VariableRgnDlg;   ////dialog 2 
          	if(VariableRgnDlg.DoModal() ==IDOK)
          	{
          	
          		hShareWnd = VariableRgnDlg.GetShareWindow();
          		width = VariableRgnDlg.GetShareWidth();
          		height = VariableRgnDlg.GetShareHeight();
          		x = VariableRgnDlg.GetShareXPosition();
          		y= VariableRgnDlg.GetShareYPosition();
          		if(m\_bEnableAVIRecording)
          			EnableAVIRecording();
          		else
          			EnableAVIRecording(FALSE);
          		//Session
          		ZeroMemory(szBuffer,sizeof(szBuffer));
          		GetDlgItemText(IDC\_EDIT\_CODE,szBuffer,sizeof(szBuffer));
          		lLength = \_tcslen(szBuffer) + 1 ; //reusing the same variable
          		SetRegInfo(LASTUSED\_SESSION,szBuffer,REG\_SZ,&lLength);
          		
          		
          		
          		
          		
          		//Session pass
          		ZeroMemory(szBuffer,sizeof(szBuffer));
          		GetDlgItemText(IDC\_EDIT\_PASS,szBuffer,sizeof(szBuffer));
          		lLength = \_tcslen(szBuffer); //reusing the same variable
          		SetRegInfo(LASTUSED\_SESSION\_PASS,szBuffer,REG\_SZ,&lLength);
          		
          		
          		
          		
          		//Client Name
          		ZeroMemory(szBuffer,sizeof(szBuffer));
          		GetDlgItemText(IDC\_EDIT\_CLIENT\_NAME,szBuffer,sizeof(szBuffer));
          		lLength = \_tcslen(szBuffer); //reusing the same variable
          		SetRegInfo(LASTUSED\_USERNAME,szBuffer,REG\_SZ,&lLength);
          		
          		
          					
          		
          		//Record AVI 
          		lLength = sizeof(m\_bEnableAVIRecording); //reusing the same variable
          		m\_bEnableAVIRecording = IsDlgButtonChecked(IDC\_CHECK\_AVI\_REC);
          		SetRegInfo(LASTOPTION\_AVI,(LPTSTR)&m\_bEnableAVIRecording,REG\_DWORD,&lLength);
          		
          		
          		StartDesktopShare(hShareWnd,width,height,x,y,GetDlgItem(IDC\_TARGETWND)->m\_hWnd);
          		GetDlgItem(IDC\_BUTTON\_DSK\_SHARE)->SetWindowText(TEXT("Stop Share"));
          	
          	}
          	else
          	{
          		StopDesktopShare();
          		GetDlgItem(IDC\_BUTTON\_DSK\_SHARE)->SetWindowText(TEXT("Start Share"));
          		bDesktopShareStarted = 	!bDesktopShareStarted ;
          	}
          
          
          }
          else
          {
          	StopDesktopShare();
          	GetDlgItem(IDC\_BUTTON\_DSK\_SHARE)->SetWindowText(TEXT("Start Share"));
          }
          

          }

          dialog 2 code//
          in dialog 2 on button click this function is called.
          long CVariableRegion::GetWindowsList()
          {
          HWND hListBox = NULL;
          TCHAR sWindowCount[100] = {0};
          int nWindowsCount = 0;
          CWnd *hDeskopWnd = NULL;
          TCHAR szWindowCountTitle[MAX_PATH]={0};

          hListBox = GetDlgItem(IDC\_WIN\_LIST)-&g
          
          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups