Changing form's icon during run-time 
Author Message
 Changing form's icon during run-time

I noticed this problem too.  What I wanted to do was set the icon in the main form at design time and set all the child window icons
at runtime to save a bit of space in the frx files and in the executable.  Any ideas anyone?  Sorry I didn't answer the question,
but I thought I'd point out that it only seems to occur in WinNT/2000.
Quote:

>     I've got a wierd problem. The problem is when I try to change the icon
> of the form during run-time, it won't display correctly. When loaded at
> run-time , the background of the icon is black and all the colors are all
> washed up (like if they dropped in 16 colors). When I change it in
> design-time, the icon is displayed correctly (in 256 colors).

>     I've got a standard form. The icon I want to load is 16x16 in 256
> colors. I use the function LoadPicture() to load the icon into the form's
> icon property like this :

>     me.Icon = LoadPicture("this is the path", VbLpCustom, VbLpColor, 16, 16)

>     I've tried using an Image control to pre-load the icon and then assign
> it to the form's icon property but it did the same thing.

>     I haven't tried an ImageList control cause I think that when assigning
> an icon to the icon property will do the same thing as with the Image
> control.

>     Also, these icons show well anywhere in the program (toolbar, menu,
> listbar, ...) with the only exception of the form's icon.

>     I'm using VB 6.0 SP5 and Windows 2000 Prof. Ed.

>     If anybody can help me in this case or show me a different way to load a
> form icon during run-time, I'd be glad to hear about it. Thanks for helping

>     - Mathieu





Mon, 15 Sep 2003 08:39:35 GMT  
 Changing form's icon during run-time
    I've got a wierd problem. The problem is when I try to change the icon
of the form during run-time, it won't display correctly. When loaded at
run-time , the background of the icon is black and all the colors are all
washed up (like if they dropped in 16 colors). When I change it in
design-time, the icon is displayed correctly (in 256 colors).

    I've got a standard form. The icon I want to load is 16x16 in 256
colors. I use the function LoadPicture() to load the icon into the form's
icon property like this :

    me.Icon = LoadPicture("this is the path", VbLpCustom, VbLpColor, 16, 16)

    I've tried using an Image control to pre-load the icon and then assign
it to the form's icon property but it did the same thing.

    I haven't tried an ImageList control cause I think that when assigning
an icon to the icon property will do the same thing as with the Image
control.

    Also, these icons show well anywhere in the program (toolbar, menu,
listbar, ...) with the only exception of the form's icon.

    I'm using VB 6.0 SP5 and Windows 2000 Prof. Ed.

    If anybody can help me in this case or show me a different way to load a
form icon during run-time, I'd be glad to hear about it. Thanks for helping

    - Mathieu




Mon, 15 Sep 2003 07:20:34 GMT  
 Changing form's icon during run-time
I'm not sure but try :

'in a module
Public Declare Function LockWindowUpdate Lib "user32" Alias
"LockWindowUpdate" (ByVal hwndLock As Long) As Long

'before changing the icon
call LockWindowUpdate(me.hwnd)

... stuff to change the icon

call LockWindowUpdate(0)

Hope this will help

Regards



Mon, 15 Sep 2003 12:07:21 GMT  
 Changing form's icon during run-time
thanks for the help but it didn't worked. I wonder why It doesn't work ....

    - BeepBop


Quote:
> I'm not sure but try :

> 'in a module
> Public Declare Function LockWindowUpdate Lib "user32" Alias
> "LockWindowUpdate" (ByVal hwndLock As Long) As Long

> 'before changing the icon
> call LockWindowUpdate(me.hwnd)

> ... stuff to change the icon

> call LockWindowUpdate(0)

> Hope this will help

> Regards



Tue, 16 Sep 2003 07:02:51 GMT  
 Changing form's icon during run-time
Quote:
>     me.Icon = LoadPicture("this is the path", VbLpCustom, VbLpColor, 16,

16)
You don't use the other data on the end. What do I mean? Like this:
  Me.Icon = LoadPicture("this is the path")
That should do it.

QuickHare
Remove the NOSPAM to E-Mail direct.
Enleve la NOSPAM E-Mail moi directement.



Thu, 18 Sep 2003 02:20:17 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Changing Form's BorderStyle property at run time but before form is loaded

2. making a mdi form a form during run time with click event

3. Help: Change a MDI child's parent MDI form at run-time

4. Changing Locked Property in Access 2.0 During Run Time

5. Help needed with changing captions during run time

6. Changing tabstrip during run-time

7. Change the filename of a graphicfile in a report during run-time

8. changing label on datareport during run-time

9. Changing tabstrip during run-time

10. Change the filename of a graphicfile in a report during run-time

11. Changing Equations in code during run-time

12. Creating menu's during run-time

 

 
Powered by phpBB® Forum Software