|
Hi,
I need to create an application that is shown in Windows Taskbar as a Toolbar, same as the Windows Media Player do.
I dont know where should I start.
Thanks in advance.
- NS -
|
|
|
|
|
search for Shell_NotifyIcon in msdn
i think this will help
Regards,
Pankaj Sachdeva
"There is no future lies in any job"
"but"
"future lies in the person who holds the job"
|
|
|
|
|
They are called deskbands. check Here[^]
|
|
|
|
|
Thank you. I have to look...
- NS -
|
|
|
|
|
Hello, im pretty new to using win32 common controls, im wondering how to use the toolbar messages correctyl. Im writing an application that can remove icon's from the system-tray toolbar for annoying applications that dosn't allow you to remove their tray icon.
Here is my code, the button is hidden when i send a TB_HIDEBUTTON, but the toolbar is not resized properly at all, it shows cleary that a button is missing. So i need a way to automatically resize it to the correct size for the new number of buttons. I have tried TB_AUTOSIZE but it dosn't seem to have any effect.
Also, a second problem is the TB_GETBUTTONTEXT message, it returns a strLen of the button string correctly, but the "text" var is always just unilitialized garbage, i dont see why. Anyone knows why?
void main()<br />
{<br />
HWND hwnd = FindWindowEx(0,0,"Shell_TrayWnd",0);<br />
hwnd = FindWindowEx(hwnd , 0 ,"TrayNotifyWnd",0);<br />
hwnd = FindWindowEx(hwnd , 0 ,"SysPager",0);<br />
hwnd = FindWindowEx(hwnd , 0 ,0,"Notification Area");<br />
<br />
int index = 0;<br />
int count = (int)::SendMessage(hwnd, TB_BUTTONCOUNT, 0, 0);<br />
for(int i=0; i<count; i++)<br />
{ <br />
char text[1024];<br />
int strLen = ::SendMessage(hwnd, TB_GETBUTTONTEXT, i, (LPARAM)text); <br />
}<br />
<br />
BOOL b = ::SendMessage(hwnd, TB_HIDEBUTTON, 0, 1); <br />
b = ::SendMessage(hwnd, TB_AUTOSIZE, 0, 0); <br />
}
Thanks in advance
|
|
|
|
|
spaam wrote: Also, a second problem is the TB_GETBUTTONTEXT message
In your case the application you create and taskbar are two saparate process. So pointer you passed to TB_GETBUTTONTEXT is pointing is vaid for your application aonly. the other applcation cannot access this address. Thats why your getting junk values. What you need to do is allocate some memory in the target process using the VirtualAllocEx() function, then pass that pointer to the message. After the message, you can read the string using the ReadProcessMemory() function.
|
|
|
|
|
Hi all
Iam trying to develop a "Net Cafe" programme in vc++ 8. All communication between the Server and the Client are done through Socket.
My Problem was to Create the User Login Dialog ie: on that i want use disabling the Hot Key(Alt+Tab ,Ctl+combination) and enabling that after user logging.(Ctl+Alt+Del was done Disabled in Administrator )Rest of the hot keys only i wanted.
Give your Suggestion and if any sample code about this.
Awaiting for your suggestion.
-- modified at 3:02 Friday 7th September, 2007
shakumar
|
|
|
|
|
|
Hello Friends,
I am trying to change the Text of Start Button. But not getting sucess.
I am trying following code.
HWND hTray = ::FindWindow(L"Shell_TrayWnd", NULL);<br />
HWND hStart = ::FindWindowEx( hTray, NULL, L"Button", NULL);<br />
SendMessage(hStart, WM_SETTEXT, 0, (LPARAM)L"MyText");
But nothing seems to happen. But when I see in Spy++ it show the new text.
I dont know what is going on.
Even I dont know Can we change the Text or not.
|
|
|
|
|
I am using winxp and I can see the changes with your code. It's working fine.
So atleast one thing is confirmed, We can change the text
|
|
|
|
|
There is a possibility that the start button may be using a bitmap for drawing the face. So if you change the text it wont be updated. It depends on the windows theme that you use. Try changing the theme.
- NS -
|
|
|
|
|
I am Using Win2000. Dont know enything about Themes. Can u guide me through that
|
|
|
|
|
I meant the look and feel of windows. That is got from Display properties => Appearance.
Since you could verify the change by using Spy++, we can say that the button text is changed.
But since I dont have Win2000 here, I cant test it.
I am not familar with Win2000. Can you change the appearance to Windows 98 classic?
You can take the display propertied by right clicking the desktop.
- NS -
|
|
|
|
|
No its Not Working. I know that start button is saved as a string in Winxp and Win98. Becoz previosly i have changed the Text on Start button using Resource hacker . But dont know how they save the text (Start) in Win2000.
|
|
|
|
|
As I said before, I have no experience with Win2000. So I am really sorry.
- NS -
|
|
|
|
|
Your code is working on the XP.
|
|
|
|
|
Yes I checked on WinXp and its working there. But it has its own problem.Window gets its Original Text(Start) after Some time.
|
|
|
|
|
When I open a msg file at ms office outlook and view it via outlook spy there is this property PR_HTML but when I save it it disappears.
How did that happen?
Where can I find the html content?
thanks
|
|
|
|
|
Also I am using outlook 2003 therefore the mapi_utils I got doesnt work.
Is there an existing updated version for outlook2003?
Thanks
|
|
|
|
|
Hi,
I have one service, if it stopped normally by either stopping it thro SCM applet or user manually shutting down the system i am doing all the processing before it shuts down in Service Control handler function when it receives SERVICE_CONTROL_STOP or SERVICE_CONTROL_SHUTDOWN messages.
But I need to handle when this service is killed/stopped abruptly thro task manager or thro some other means. what message does it send to Control handler function so that i can do something here ,
or please tell me how to handle this ?
Thanks...
|
|
|
|
|
hey folks,
I've got a little snippet I wanna use to do a splash screen from a mask-image (2-bit image). well... it doesn't work
CBitmap bg_Image;
bg_Image.LoadBitmap(IDB_BITMAP1);
BITMAP bBitmap;
bg_Image.GetBitmap(&bBitmap);
BYTE *pBuffer = new BYTE[bBitmap.bmWidth * bBitmap.bmHeight];
bg_Image.GetBitmapBits(bBitmap.bmHeight*bBitmap.bmWidth, pBuffer);
CRgn newRegion;
newRegion.CreateRectRgn(0,0,0,0);
CRgn tmpRgn;
for (int y=1; y< bBitmap.bmHeight; ++y)
{
for (int x=1; x < bBitmap.bmWidth; ++x)
{
BYTE c = pBuffer[(y)*bBitmap.bmWidth + x];
if (c == 255)
{
tmpRgn.DeleteObject();
tmpRgn.CreateRectRgn(x,y,x+1,y+1);
newRegion.CombineRgn(&newRegion, &tmpRgn, RGN_OR);
}
}
}
this->SetWindowRgn(newRegion, true);
delete [] pBuffer;
The result is nothing near what I expected... some ragged & jagged dialog.
when I set a breakpoint on "tmpRgn.CreateRectRgn(x,y,x+1,y+1);"
I find that the x and y of the for-loop is not what it should be in the image!!!
any hints on how to do my splash-screen?
thx in advance
zqueezy
-- modified at 20:58 Thursday 6th September, 2007
|
|
|
|
|
All the code looks like it's for 8-bit images only (and assumes a WORD aligned width).
If the source bitmap is not 8-bitsperpixel, then you need to use bBitmap.bmWidthBytes
instead of bBitmap.bmWidth when calculating array size and offset of pixel in buffer.
Plus, if it's < 8 bpp, you need to mask out the appropriate bits to match the color.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
so for anybody who's intrested and for the sake of completeness:
BOOL CMeineFormDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
CBitmap bg_Image;
bg_Image.LoadBitmap(IDB_BITMAP1);
BITMAP bBitmap;
bg_Image.GetBitmap(&bBitmap);
int iByteSize = bBitmap.bmWidthBytes * bBitmap.bmHeight * (bBitmap.bmBitsPixel/8);
BYTE *pBuffer = new BYTE[iByteSize];
bg_Image.GetBitmapBits(iByteSize, pBuffer);
CRgn newRgn;
newRgn.CreateRectRgn(0,0,0,0);
CRgn tmpRgn;
int iOffset = bBitmap.bmBitsPixel/8;
int r,g,b,c;
for (int y=0; y< bBitmap.bmHeight; ++y)
{
for (int x=0; x < bBitmap.bmWidth; ++x)
{
c = y*bBitmap.bmWidthBytes + x*iOffset;
r = pBuffer[c+2];
g = pBuffer[c+1];
b = pBuffer[c];
if (r == 255 && g == 255 && b == 255)
{
tmpRgn.DeleteObject();
tmpRgn.CreateRectRgn(x,y,x+1,y+1);
newRgn.CombineRgn(&newRgn, &tmpRgn, RGN_OR);
}
}
}
this->SetWindowRgn(newRgn, true);
delete [] pBuffer;
return TRUE;
}
|
|
|
|
|
zqueezy wrote: int iByteSize = bBitmap.bmWidthBytes * bBitmap.bmHeight * (bBitmap.bmBitsPixel/8);
...as long as you only use bitmaps witha format >= 8 bitsperpixel
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm having a little trouble writing integer values to a file with ofstream objects. If I do ofstream::write(), then I have to pass it a char or a char*. So far, in my code, I've tried doing the following:
ofstream geomFile("C:\\file.dat", ios::binary);
geomFile.write((char*)ordX, sizeof(int) * numOrds);
geomFile.write((char*)ordY, sizeof(int) * numOrds);
where ordX and ordY are defined here:
const int numOrds = 10;
int ordX[numOrds];
int ordY[numOrds];
Basically, since I know the array is a contiguous memory location of 10 integers, I do a write starting from the pointer value of ordX and ordY through sizeof(int) (4) * numOrds (10) = 40 bytes. What I expect is to have 20 4-byte integers lined up in my file one after another. Unfortunately, when I read back from the file, I'm not getting the right result. Any ideas?
I guess I should also specify how I'm reading back the file using an ifstream object.
ifstream geomFile("C:\\geom.dat", ios::binary);
char readBuf[sizeof(int)];
int ordX[numOrds];
for (int i = 0; i < 10; i++)
{
geomFile.get(readBuf, 4);
ordX[i] = *(int*)readBuf;
}
I know the above looks a bit like a hack, but I'm sort of confused as to how I'd manipulate things in 4-byte blocks other than casting to int* and dereferencing.
-- modified at 20:45 Thursday 6th September, 2007
|
|
|
|
|