Announcement

Collapse
No announcement yet.

streetdeck using wmp

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • streetdeck using wmp

    im using the fusion brain with streetdeck to control the frontend by using the steering wheel controls. but I need to know if StreetDeck opens WMP and sends instructions to it that way, or if it uses the WMP dll and doesnt actually open WMP.

    If SD doesnt open WMP, then I need to find the class name of StreetDeck. any streetdeck team member know?
    https://www.facebook.com/hinnantdesign1

  • #2
    StreetDeck embends a WMP window. YOu can use SPY++ from microsoft to figure out whatever class names you want. The class name for the main StreetDeck window is not constant. The window caption is though.
    StreetDeck.com Developer (I am Chuck)
    Get StreetDeck at http://www.streetdeck.com
    The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.

    Comment


    • #3
      Originally posted by god_of_cpu View Post
      StreetDeck embends a WMP window. YOu can use SPY++ from microsoft to figure out whatever class names you want. The class name for the main StreetDeck window is not constant. The window caption is though.
      yeah I download the spy++ to find the class name. the title in streetdeck is call ''streetdeck'' and the class name changed every time I would open streetdeck. I need a constant class name. Im not sure if the control in the fusion brain would work right.
      https://www.facebook.com/hinnantdesign1

      Comment


      • #4
        I use the following code to find the StreetDeck window. Basically after finding a window with the right window caption, we then confirm it by looking at the name of the executable of the process it belongs to.


        Code:
        ::EnumWindows(&EnumMainWindows, (LPARAM)&m_hWndStreetDeck);
        Code:
        //***************************************************************************
        // --- In  : hWnd : A top-level window
        //			 lParam : Additioanl data (pointer to a CInstanceWindow object)
        // --- Out : 
        // --- Returns : Whether to continue iterating
        // --- Effect : This function is called for every top-level window
        //***************************************************************************
        BOOL CALLBACK EnumMainWindows(HWND hWnd, LPARAM lParam)
        {
        	TCHAR szTitle[12];	
        	GetWindowText(hWnd, szTitle, 12);
        
        	//If this is the right window title, lets look at the executale file name to confirm its 
        	//a StreetDeck instance and not just some other window with the same name
        	if (lstrcmp(szTitle, _T("StreetDeck")) == 0)
        	{
        		// We will search for a toplevel window of the specified instance
        		// Thiw window should be not-owned (to exclude dialogs) 
        		DWORD nWindowPID = 0;
        		HMODULE hMod = NULL;
        		TCHAR filename[MAX_PATH];
        		::GetWindowThreadProcessId(hWnd, &nWindowPID);
        
        		
        		HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, nWindowPID);
        		if (hProcess == NULL)
        		{
        			DWORD dwError = GetLastError();
        			
        			//If we failed because of security rights, assume its vista and try to query for the the
        			//process name iwth limited information rights
        			if (dwError == ERROR_ACCESS_DENIED)
        			{
        				hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, nWindowPID);
        				DWORD dwLength = MAX_PATH;
        				if (GetProcessImageFileName(hProcess, filename, sizeof(filename)))
        				{
        					CString strFind = filename;
        					int iEndSlash = strFind.ReverseFind('\\');
        					if (iEndSlash > 0)
        						strFind = strFind.Right(strFind.GetLength() - iEndSlash - 1);
        					if (strFind.CompareNoCase(_T("StreetDeck.exe")) == 0)
        					{
        						*((HWND*) lParam) = hWnd;
        						CloseHandle(hProcess); 
        						return FALSE;
        					}
        				}
        			}
        		} else
        		{
        			if(GetModuleFileNameEx(hProcess, hMod, filename, sizeof(filename))) 
        			{ 
        				CString strFind = filename;
        		  		int iEndSlash = strFind.ReverseFind('\\');
        				if (iEndSlash > 0)
        				 	strFind = strFind.Right(strFind.GetLength() - iEndSlash - 1);
        				if (strFind.CompareNoCase(_T("StreetDeck.exe")) == 0)
        				{
        					*((HWND*) lParam) = hWnd;
        					CloseHandle(hProcess); 
        					return FALSE;
        				}
        			}
        
        			CloseHandle(hProcess); 
        		}
        	}
        
        	// ... Not found, keep on looking
        	return TRUE;
        }
        StreetDeck.com Developer (I am Chuck)
        Get StreetDeck at http://www.streetdeck.com
        The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.

        Comment


        • #5
          Originally posted by god_of_cpu View Post
          I use the following code to find the StreetDeck window. Basically after finding a window with the right window caption, we then confirm it by looking at the name of the executable of the process it belongs to.


          Code:
          ::EnumWindows(&EnumMainWindows, (LPARAM)&m_hWndStreetDeck);
          Code:
          //***************************************************************************
          // --- In  : hWnd : A top-level window
          //			 lParam : Additioanl data (pointer to a CInstanceWindow object)
          // --- Out : 
          // --- Returns : Whether to continue iterating
          // --- Effect : This function is called for every top-level window
          //***************************************************************************
          BOOL CALLBACK EnumMainWindows(HWND hWnd, LPARAM lParam)
          {
          	TCHAR szTitle[12];	
          	GetWindowText(hWnd, szTitle, 12);
          
          	//If this is the right window title, lets look at the executale file name to confirm its 
          	//a StreetDeck instance and not just some other window with the same name
          	if (lstrcmp(szTitle, _T("StreetDeck")) == 0)
          	{
          		// We will search for a toplevel window of the specified instance
          		// Thiw window should be not-owned (to exclude dialogs) 
          		DWORD nWindowPID = 0;
          		HMODULE hMod = NULL;
          		TCHAR filename[MAX_PATH];
          		::GetWindowThreadProcessId(hWnd, &nWindowPID);
          
          		
          		HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, nWindowPID);
          		if (hProcess == NULL)
          		{
          			DWORD dwError = GetLastError();
          			
          			//If we failed because of security rights, assume its vista and try to query for the the
          			//process name iwth limited information rights
          			if (dwError == ERROR_ACCESS_DENIED)
          			{
          				hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, nWindowPID);
          				DWORD dwLength = MAX_PATH;
          				if (GetProcessImageFileName(hProcess, filename, sizeof(filename)))
          				{
          					CString strFind = filename;
          					int iEndSlash = strFind.ReverseFind('\\');
          					if (iEndSlash > 0)
          						strFind = strFind.Right(strFind.GetLength() - iEndSlash - 1);
          					if (strFind.CompareNoCase(_T("StreetDeck.exe")) == 0)
          					{
          						*((HWND*) lParam) = hWnd;
          						CloseHandle(hProcess); 
          						return FALSE;
          					}
          				}
          			}
          		} else
          		{
          			if(GetModuleFileNameEx(hProcess, hMod, filename, sizeof(filename))) 
          			{ 
          				CString strFind = filename;
          		  		int iEndSlash = strFind.ReverseFind('\\');
          				if (iEndSlash > 0)
          				 	strFind = strFind.Right(strFind.GetLength() - iEndSlash - 1);
          				if (strFind.CompareNoCase(_T("StreetDeck.exe")) == 0)
          				{
          					*((HWND*) lParam) = hWnd;
          					CloseHandle(hProcess); 
          					return FALSE;
          				}
          			}
          
          			CloseHandle(hProcess); 
          		}
          	}
          
          	// ... Not found, keep on looking
          	return TRUE;
          }
          so what is it then? Im confused
          https://www.facebook.com/hinnantdesign1

          Comment


          • #6
            Originally posted by god_of_cpu View Post
            StreetDeck embends a WMP window. YOu can use SPY++ from microsoft to figure out whatever class names you want. The class name for the main StreetDeck window is not constant. The window caption is though.
            can I just use ''streetdeck'' as the class name?
            https://www.facebook.com/hinnantdesign1

            Comment


            • #7
              The class name of the StreetDeck window is not "StreetDeck".

              You can just search for the window name of StreetDeck and it will work most of the time, but its not garunteed to be unique. Windows explorer will also have a window name of StreetDeck if you are browsing that folder.
              StreetDeck.com Developer (I am Chuck)
              Get StreetDeck at http://www.streetdeck.com
              The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.

              Comment


              • #8
                How to I use the code above to find the class name? I need something that is constant.
                https://www.facebook.com/hinnantdesign1

                Comment


                • #9
                  Originally posted by customaudioman View Post
                  How to I use the code above to find the class name? I need something that is constant.
                  You don't, the class name is not constant. The code above searches through every window and compares the exe name that created it to the streetdeck executable.
                  StreetDeck.com Developer (I am Chuck)
                  Get StreetDeck at http://www.streetdeck.com
                  The Official StreetDeck Forums have moved, please visit us at http://www.streetdeck.com/forum for official support for Streetdeck.

                  Comment

                  Working...
                  X