how to call a windows function(media player, change desktop paper)

This is a discussion on how to call a windows function(media player, change desktop paper) within the Windows Programming forums, part of the Platform Specific Boards category; how to call other functions from code ex:automatically log on net from code,play media player.......

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    2

    how to call a windows function(media player, change desktop paper)

    how to call other functions from code
    ex:automatically log on net from code,play media player....

  2. #2
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    This should be asked in a Windows specific forum -- it's not a C language question.
    Insert obnoxious but pithy remark here

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    Agreed - moved.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    You can use ShellExecute/Ex to open media (it will open in media player if that is the default player for that file type) or open the player directly.

  5. #5
    Registered User
    Join Date
    May 2004
    Posts
    6
    To change desktop wallpaper (when 'activeDesktop' is enabled):

    Code:
    #include <shlobj.h>
    
    extern const IID IID_IActiveDesktop = {
    	0xf490eb00,0x1240,0x11d1, {
    		0x98,0x88,0x00,0x60,0x97,0xde,0xac,0xf9 		}
    };
    
    
    extern const IID CLSID_ActiveDesktop = {
    	0x75048700,0xef1f,0x11d0, {
    		0x98,0x88,0x00,0x60,0x97,0xDE,0xac,0xf9		}
    };
    
    
    
    
    int changeWallpaper(char *strPicPath, DWORD flags)
    {
    	WCHAR tempstr[MAX_PATH];
    	char str[255]="";
    	HRESULT hr;
    	MultiByteToWideChar(CP_ACP, 0, strPicPath, -1, tempstr, sizeof(tempstr) );
    	IActiveDesktop *pActiveDesktop;
    
    	CoInitialize(NULL);
    	hr = CoCreateInstance(&CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,&IID_IActiveDesktop, (void**)&pActiveDesktop);
    	if(hr == S_OK )	{
    		hr = pActiveDesktop->SetWallpaper(tempstr, 0);
    		if(hr!=S_OK) {
    			return 0;
    		}
    		WALLPAPEROPT wpo;
    		wpo.dwSize = sizeof(WALLPAPEROPT);
    		wpo.dwStyle = flags;
    		pActiveDesktop->SetWallpaperOptions(&wpo,0);
    		pActiveDesktop->ApplyChanges(AD_APPLY_ALL);
    		pActiveDesktop->Release();
    		CoUninitialize();
    		return TRUE;
    	}
    	else {
    		return FALSE;
    	}
    }
    To use, strPicPath is the path to the image, and flags is either WPSTYLE_CENTER or WPSTYLE_STRETCH. There are more, but I can't remember them for now... You can find them in the docs...

    Hope this helps!
    Franchie.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 11-03-2008, 08:48 PM
  2. I need some quick help with code.
    By stehigs321 in forum C Programming
    Replies: 35
    Last Post: 10-30-2003, 09:07 PM
  3. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  4. How to change Windows Style
    By sean345 in forum Windows Programming
    Replies: 8
    Last Post: 07-30-2002, 03:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21