Docklet Programming

I have a question about developing my own Docklet is this were I would post the quetion? If not where might I do that?

Thanks,
Matt.
3,026 views 6 replies
Reply #1 Top
Here is fine.
Reply #2 Top
Right on!

Ok I have a working Docklet that I started from the SampleDocklet in the SDK. Now, I am working on setting the Image from within my custom Configuration Dialog, I can do that too, but what I can't seem to do is make that image display in my Configuration Dialog. The code that is in the SampleDocklet use SendMessage(...) which does not work. I have tried all the ideas I could come up with to no avail...

So, after all that, simply I am looking for a code snippit or direction to look on how to display the image in my Configuration Dialog.

Thanks,
Matt.
Reply #3 Top
Here is the code I use. It might not be the best way to do it, but it works for me

You need to have a Picture Control of Type Bitmap in your form. Replace the size variable with the size of your control


// Load the image
Bitmap* image = lpData->docklet->LoadGDIPlusImage(path); // replace this by a call to the LoadGDIPlusImage function from the SDK

if (image != NULL) {
// Get the background color
Color* background = new Color();
background->SetFromCOLORREF(GetSysColor(COLOR_BTNFACE));

// Create the bitmap
Bitmap bitmap(image->GetHeight(),image->GetWidth());
Graphics bitmapGraphics(&bitmap);
SolidBrush solidBrush(*background);
bitmapGraphics.FillRectangle(&solidBrush, 0, 0, image->GetHeight(), image->GetWidth());

bitmapGraphics.DrawImage(image,0,0,image->GetHeight(),image->GetWidth());

Bitmap* icon = (Bitmap*)bitmap.GetThumbnailImage(size,size,NULL,NULL);
HBITMAP hBitmap;
icon->GetHBITMAP(*background, &hBitmap);

// Display the image
SendDlgItemMessage(hDlg, ID_DIALOG, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM) hBitmap);

delete(icon);
delete(background);
}

delete(image);


If you need more, I can send you the code of my TodoList docklet (leave me your email).

Edit: Wincustomize is inserting < BR > tags in my < pre > < / pre > tags. Grrrrrr....
Reply #5 Top
Matthew...What does your new docklet do?
Reply #6 Top
Well, I will try to explain it. I am a firefighter and work a funny shift. The way it works is there are 3 shifts that work 24 hours. We work 3 out of 5 days, then have 4 days off. This set of days I work is:

Friday, Sunday, Tuesday, then I'm off from Wednesdat to the next Sunday where I work Sunday, Tuesday, Thursday, then I'm off from Friday until Tuesday, etc...


So each year we get a color coded calendar that shows which days we work for the whole year. Well I wrote a Docklet that is a representation of that. It is a monthly view of a calendar, then I calculate each days shift then color code that day appropriately. Then add some numbers for dates, either only Sundays or the Shift that you work. I also blow up today and date it. Not very general purpose, but it is giving me lots of ideas for more.

Here is what it looks like: