Well, after much frustration and self-teaching I managed to do this. Thought I'd share if anyone's interested.
I used CallDLL and a custom DLL. I'm sure there's a way to make it a userlib and I plan to...but, for now, this works.
[edit]Even better - now you can set the small icon (taskbar and UL corner of window) and the large icon (task switcher). You can call either, but SetIconLg does both. The icon has to be called "icon.ico" and placed in the exe directory - couldn't figure how to pass in the name with a bank...prob just being stupid.[/edit]
seticon.h
seticon.cpp
BBfile:
BTW, this is based on the source from the DLL demo on BC.com.
Now, to convert it to a generic userlib.
M
I used CallDLL and a custom DLL. I'm sure there's a way to make it a userlib and I plan to...but, for now, this works.
[edit]Even better - now you can set the small icon (taskbar and UL corner of window) and the large icon (task switcher). You can call either, but SetIconLg does both. The icon has to be called "icon.ico" and placed in the exe directory - couldn't figure how to pass in the name with a bank...prob just being stupid.[/edit]
seticon.h
// Includes #include "windows.h" // SetIconSm extern "C"{ _declspec(dllexport) int _cdecl SetIconSm( int const *in,int in_size,int *out,int out_sz ); } // SetIconLg extern "C"{ _declspec(dllexport) int _cdecl SetIconLg( int const *in,int in_size,int *out,int out_sz ); }
seticon.cpp
// Set current window/taskbar icon int SetIconSm( int const *in,int in_size,int *out,int out_sz ) { HWND CurWin = GetActiveWindow(); HANDLE CurIcon = LoadImage(0, "icon.ico", IMAGE_ICON, SM_CXICON, SM_CYICON, LR_LOADFROMFILE); LRESULT result = SendMessage(CurWin, WM_SETICON, ICON_SMALL, (LPARAM)CurIcon); return(1); } // Set current taskswitcher icon int SetIconLg( int const *in,int in_size,int *out,int out_sz ) { HWND CurWin = GetActiveWindow(); HANDLE CurIcon = LoadImage(0, "icon.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE); LRESULT result = SendMessage(CurWin, WM_SETICON, ICON_BIG, (LPARAM)CurIcon); return(1); }
BBfile:
AppTitle("Test Window") CallDLL("seticon", "SetIconLg") WaitKey() End()
BTW, this is based on the source from the DLL demo on BC.com.
Now, to convert it to a generic userlib.
M