Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 14 May 2008 23:00:32 +0100,    group: microsoft.public.platformsdk.shell        back       


How to programmatically move the windows TaskBar?   
Hi There,

Is it possible to programmatically move the Windows Tas

I've been attempting to write a simple C program that is capable of moving 
the TaskBar in Windows.
So far, I've stumple upon the ShellAPI function "SHAppBarMessage". I've 
attempted to use it,
but nothing is happening to my taskbar at all.  Please see below for my full 
code.

Can someone help?


Regards,
Jr


#include <stdio.h>
#include <windows.h>
#include <shellapi.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int nShowCmd)
{
 HWND hWnd = FindWindow("Shell_TrayWnd", NULL);
 APPBARDATA abd;
 ZeroMemory(&abd, sizeof(abd));
 abd.cbSize = sizeof(APPBARDATA);
 SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
 abd.rc.top = 300;
 abd.uEdge = ABE_RIGHT;
 SHAppBarMessage(ABM_SETPOS, &abd);
 MessageBox(NULL, "Done!", "Taskbar Refresh", MB_OK);
 return 0;
}
date: Wed, 14 May 2008 23:00:32 +0100   author:   James

Re: How to programmatically move the windows TaskBar?   
On May 14, 3:00 pm, "James"  wrote:
> Hi There,
>
> Is it possible to programmatically move the Windows Tas
>
> I've been attempting to write a simple C program that is capable of moving> the TaskBar in Windows.
> So far, I've stumple upon the ShellAPI function "SHAppBarMessage". I've
> attempted to use it,
> but nothing is happening to my taskbar at all.  Please see below for my full
> code.
>
> Can someone help?
>
> Regards,
> Jr
>
> #include <stdio.h>
> #include <windows.h>
> #include <shellapi.h>
>
> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
> lpCmdLine, int nShowCmd)
> {
>  HWND hWnd = FindWindow("Shell_TrayWnd", NULL);
>  APPBARDATA abd;
>  ZeroMemory(&abd, sizeof(abd));
>  abd.cbSize = sizeof(APPBARDATA);
>  SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
>  abd.rc.top = 300;
>  abd.uEdge = ABE_RIGHT;
>  SHAppBarMessage(ABM_SETPOS, &abd);
>  MessageBox(NULL, "Done!", "Taskbar Refresh", MB_OK);
>  return 0;
>


Hi,

You can use the following APIs to size/position Windows taskbar:

	SHAppBarMessage(ABM_GETTASKBARPOS, &pData);

	hTaskbar = FindWindow(L"Shell_TrayWnd", NULL);

	GetWindowRect(hTaskbar, &RECT);

	SetWindowPos(hTaskbar, NULL, X, Y, CX, CY,
					SWP_NOSENDCHANGING);
	ShowWindow(hTaskbar, SW_SHOW);

	UpdateWindow(hTaskbar);

	GetDesktopWindow();

	RedrawWindow(hDesktopWindow, NULL, NULL,
	RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);

	SystemParametersInfo(SPI_SETWORKAREA, 0, NULL, SPIF_SENDCHANGE);

http://msdn2.microsoft.com/en-us/library/ms647647.aspx

http://msdn2.microsoft.com/en-us/library/ms633499.aspx

http://msdn2.microsoft.com/en-us/library/ms633519.aspx

http://msdn2.microsoft.com/en-us/library/ms633545.aspx

http://msdn2.microsoft.com/en-us/library/ms633548.aspx

http://msdn2.microsoft.com/en-us/library/ms534874.aspx

http://msdn2.microsoft.com/en-us/library/ms633504.aspx

http://msdn2.microsoft.com/en-us/library/ms534900.aspx

http://msdn2.microsoft.com/en-us/library/ms724947.aspx

Kellie.
date: Wed, 14 May 2008 19:36:50 -0700 (PDT)   author:   Kellie Fitton

Re: How to programmatically move the windows TaskBar?   
Hi Kellie,

Many thanks for this, it worked perfectly :-)

Regards,
Jr.

"Kellie Fitton"  wrote in message 
news:ea65678c-562d-4924-a55c-e180c7ccee68@q24g2000prf.googlegroups.com...
On May 14, 3:00 pm, "James"  wrote:
> Hi There,
>
> Is it possible to programmatically move the Windows Tas
>
> I've been attempting to write a simple C program that is capable of moving
> the TaskBar in Windows.
> So far, I've stumple upon the ShellAPI function "SHAppBarMessage". I've
> attempted to use it,
> but nothing is happening to my taskbar at all. Please see below for my 
> full
> code.
>
> Can someone help?
>
> Regards,
> Jr
>
> #include <stdio.h>
> #include <windows.h>
> #include <shellapi.h>
>
> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
> lpCmdLine, int nShowCmd)
> {
> HWND hWnd = FindWindow("Shell_TrayWnd", NULL);
> APPBARDATA abd;
> ZeroMemory(&abd, sizeof(abd));
> abd.cbSize = sizeof(APPBARDATA);
> SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
> abd.rc.top = 300;
> abd.uEdge = ABE_RIGHT;
> SHAppBarMessage(ABM_SETPOS, &abd);
> MessageBox(NULL, "Done!", "Taskbar Refresh", MB_OK);
> return 0;
>


Hi,

You can use the following APIs to size/position Windows taskbar:

SHAppBarMessage(ABM_GETTASKBARPOS, &pData);

hTaskbar = FindWindow(L"Shell_TrayWnd", NULL);

GetWindowRect(hTaskbar, &RECT);

SetWindowPos(hTaskbar, NULL, X, Y, CX, CY,
SWP_NOSENDCHANGING);
ShowWindow(hTaskbar, SW_SHOW);

UpdateWindow(hTaskbar);

GetDesktopWindow();

RedrawWindow(hDesktopWindow, NULL, NULL,
RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);

SystemParametersInfo(SPI_SETWORKAREA, 0, NULL, SPIF_SENDCHANGE);

http://msdn2.microsoft.com/en-us/library/ms647647.aspx

http://msdn2.microsoft.com/en-us/library/ms633499.aspx

http://msdn2.microsoft.com/en-us/library/ms633519.aspx

http://msdn2.microsoft.com/en-us/library/ms633545.aspx

http://msdn2.microsoft.com/en-us/library/ms633548.aspx

http://msdn2.microsoft.com/en-us/library/ms534874.aspx

http://msdn2.microsoft.com/en-us/library/ms633504.aspx

http://msdn2.microsoft.com/en-us/library/ms534900.aspx

http://msdn2.microsoft.com/en-us/library/ms724947.aspx

Kellie.
date: Thu, 15 May 2008 06:35:30 +0100   author:   James

Re: How to programmatically move the windows TaskBar?   
Hi there again,

The below code is working, however, the problem is that the Taskbar is only 
repositioned temporarily - a few seconds and then it is return back to the 
bottom of the screen.

Can somebody please help as I want it to be permanently repositioned the 
taskbar at the top of the screen?


#include <stdio.h>
#include <windows.h>
#include <shellapi.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int nShowCmd)
{
 RECT rect;
 RECT deskTopRect;
 HWND hDesktopWindow;
 char* strMessage = "Your Taskbar is now refreshed.";
 HWND hWnd = FindWindow("Shell_TrayWnd", NULL);
 APPBARDATA abd;
 ZeroMemory(&abd, sizeof(APPBARDATA));
 abd.cbSize = sizeof(APPBARDATA);

 SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
 GetWindowRect(hWnd, &rect);
 SetWindowPos(hWnd, NULL, rect.left, 0, rect.right, rect.bottom-rect.top, 
SWP_NOSENDCHANGING);

 ShowWindow(hWnd, SW_SHOW);
 UpdateWindow(hWnd);
 GetWindowRect(hWnd, &rect);

 hDesktopWindow = GetDesktopWindow();

 GetWindowRect(hDesktopWindow, &deskTopRect);
 deskTopRect.top = rect.bottom;
 RedrawWindow(hDesktopWindow, NULL, NULL, 
RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
 SystemParametersInfo(SPI_SETWORKAREA, 0, (LPVOID)&deskTopRect, 
SPIF_SENDCHANGE);

 //SystemParametersInfo(SPI_SETWORKAREA, 0, NULL, SPIF_SENDCHANGE);
 UpdateWindow(hDesktopWindow);

 MessageBox(NULL, strMessage, "Taskbar Refresh", MB_OK);
 return 0;
}



"James"  wrote in message 
news:OjS8$1ktIHA.2188@TK2MSFTNGP04.phx.gbl...
> Hi Kellie,
>
> Many thanks for this, it worked perfectly :-)
>
> Regards,
> Jr.
>
> "Kellie Fitton"  wrote in message 
> news:ea65678c-562d-4924-a55c-e180c7ccee68@q24g2000prf.googlegroups.com...
> On May 14, 3:00 pm, "James"  wrote:
>> Hi There,
>>
>> Is it possible to programmatically move the Windows Tas
>>
>> I've been attempting to write a simple C program that is capable of 
>> moving
>> the TaskBar in Windows.
>> So far, I've stumple upon the ShellAPI function "SHAppBarMessage". I've
>> attempted to use it,
>> but nothing is happening to my taskbar at all. Please see below for my 
>> full
>> code.
>>
>> Can someone help?
>>
>> Regards,
>> Jr
>>
>> #include <stdio.h>
>> #include <windows.h>
>> #include <shellapi.h>
>>
>> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
>> lpCmdLine, int nShowCmd)
>> {
>> HWND hWnd = FindWindow("Shell_TrayWnd", NULL);
>> APPBARDATA abd;
>> ZeroMemory(&abd, sizeof(abd));
>> abd.cbSize = sizeof(APPBARDATA);
>> SHAppBarMessage(ABM_GETTASKBARPOS, &abd);
>> abd.rc.top = 300;
>> abd.uEdge = ABE_RIGHT;
>> SHAppBarMessage(ABM_SETPOS, &abd);
>> MessageBox(NULL, "Done!", "Taskbar Refresh", MB_OK);
>> return 0;
>>
>
>
> Hi,
>
> You can use the following APIs to size/position Windows taskbar:
>
> SHAppBarMessage(ABM_GETTASKBARPOS, &pData);
>
> hTaskbar = FindWindow(L"Shell_TrayWnd", NULL);
>
> GetWindowRect(hTaskbar, &RECT);
>
> SetWindowPos(hTaskbar, NULL, X, Y, CX, CY,
> SWP_NOSENDCHANGING);
> ShowWindow(hTaskbar, SW_SHOW);
>
> UpdateWindow(hTaskbar);
>
> GetDesktopWindow();
>
> RedrawWindow(hDesktopWindow, NULL, NULL,
> RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
>
> SystemParametersInfo(SPI_SETWORKAREA, 0, NULL, SPIF_SENDCHANGE);
>
> http://msdn2.microsoft.com/en-us/library/ms647647.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms633499.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms633519.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms633545.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms633548.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms534874.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms633504.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms534900.aspx
>
> http://msdn2.microsoft.com/en-us/library/ms724947.aspx
>
> Kellie.
>
>
date: Sat, 24 May 2008 08:56:05 +0100   author:   James

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us