Docklet Programming
Thursday, February 17, 2005 by Matthew Merritt | Discussion: ObjectDock
Thanks,
Matt.
Reply #2 Thursday, February 17, 2005 8:55 PM
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 Thursday, February 17, 2005 9:54 PM

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 #4 Thursday, February 17, 2005 10:24 PM
Thanks, works perfectly!
Matt.
Reply #6 Friday, February 18, 2005 5:31 PM
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:

Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Thursday, February 17, 2005 8:31 PM