PDA

View Full Version : Randomized Icon


Robust
04-30-2009, 01:45 PM
Hello
I am trying to make my program generate random icons
I came up with this:


#include <windows.h>
#include "resource.h"
HINSTANCE hInst;
BOOL CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HICON hIcon3;
BYTE ANDmaskIcon[] = { 0xFF, 0xFF, 0xFF, 0xFF };
BYTE XORmaskIcon[] = { 0x00, 0x00, 0x00, 0x00 };
hIcon3 = CreateIcon(hInst,32,32,1,1,ANDmaskIcon,XORmaskIcon);
switch(uMsg){
case WM_INITDIALOG:
SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
break;
case WM_CLOSE:
EndDialog(hDlg, 0);
break;
case WM_PAINT:
SendMessage(GetDlgItem(hDlg, IDC_ICONIMG), STM_SETICON, (WPARAM)hIcon3, (LPARAM)0);
break;
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
hInst = hInstance;
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DlgProc);
return 0;
}


I tried changing the values of ANDmaskIcon and XORmaskIcon, but the icon is still the same, what should i do to randomize it?

mic2100
04-30-2009, 04:01 PM
have u tried refreshing the window view? i have found wen trying to do a similar task i had to do that b4 the changes would show

nancy_d101
04-30-2009, 05:54 PM
the program seems to complicated to understand...lol..
acai berry (http://melatanon.com/Acai-Berry/index.html)