| |

VerySource

 Forgot password?
 Register
Search
View: 990|Reply: 7

This is the pallet program code. What does .dwState = 0 mean in the code?

[Copy link]

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-24 20:00:01
| Show all posts |Read mode
With m_IconData
        .cbSize = Len (m_IconData)
        .hWnd = Me.hWnd
        .uID = vbNull
        .uFlags = NIF_ICON Or NIF_INFO Or NIF_MESSAGE Or NIF_TIP 'NIF_TIP Or NIF_MESSAGE
        .uCallbackMessage = WM_MOUSEMOVE
        .hIcon = Picture1.Picture 'Me.Icon
        .szTip = "Your Message Here"&vbNullChar
        .dwState = 0
        .dwStateMask = 0
        .szInfo = "This is the result"&vbCrLf&"Pretty cool huh?"&Chr (0)
        '.szInfo = txt
        .szInfoTitle = "Button Clicked"&Chr (0)
        .dwInfoFlags = 1 'NIIF_ERROR
        .uTimeout = 3000
End With
This is the pallet program code. What does .dwState = 0 mean in the code?
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-2-12 08:45:01
| Show all posts
dwState icon state, there are 2 flags, which can be set as NIS_HIDDEN (icon hiding), NIS_SHAREDICON (icon sharing) flags separately. Second question: What is the difference between NIS_HIDDEN (icon hiding) and NIS_SHAREDICON (icon sharing) flags? ? ?
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-13 19:30:01
| Show all posts
You probably read this code there? The most important thing is that you don't post, do you think it useful?

Fortunately, the pallet code is everywhere.

dwState is a property of m_IconData, you can think so.

And m_IconData defines NOTIFYICONDATA structure.
If nothing is wrong, I think there should be something like this in your code: Dim m_IconData As NOTIFYICONDATA

This structure, you can break it down like this

Private Type NOTIFYICONDATA
    cbSize As Long 'structure size (bytes)
    hwnd As Long 'Handle of the window processing the message
    uId As Long 'unique identifier
    uFlags As Long 'Flags
    uCallBackMessage As Long 'Message received by the message processing window
    hIcon As Long '' Tray Icon Handle
    szTip As String * 128 'Tooltip
    dwState As Long 'Tray Icon State
    dwStateMask As Long 'State Mask
    szInfo As String * 256 'balloon prompt text
    uTimeoutOrVersion As Long 'balloon prompt disappear time or version
    'uTimeout-Time to disappear balloon prompt (unit: ms, 10000-30000)
    'uVersion-Version (0 for V4, 3 for V5)
    szInfoTitle As String * 64 'balloon tip title
    dwInfoFlags As Long 'balloon tip icon
End Type

If you can't understand this structure, you should check MSDN, MSDN has explained in detail

dwState
Version 5.0. State of the icon. There are two flags that can be set independently. Flag Description
NIS_HIDDEN The icon is hidden.
NIS_SHAREDICON The icon is shared.

Your code should have the following definitions:
'dwState to NOTIFYICONDATA structure
Private Const NIS_HIDDEN =&H1 'Hide icon
Private Const NIS_SHAREDICON =&H2 'Share icon


This has already been explained, dwState As Long 'Tray Icon State

And dwStateMask's explanation in MSDN is
dwStateMask
Version 5.0. A value that specifies which bits of the state member are retrieved or modified. For example, setting this member to NIS_HIDDEN causes only the item's hidden state to be retrieved.

Therefore, the value of dwstate is obtained by performing an AND operation with dwstatemask. As long as dwstatemask is 0, dwstate is 0 no matter what. This is why dwstate = 0.

In fact, if you comment this sentence, the program will run.
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-4-6 00:15:01
| Show all posts
What is the difference between NIS_HIDDEN (icon hiding) and NIS_SHAREDICON (icon sharing) marks? ? ?
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-6-27 10:15:01
| Show all posts
The dwState icon state has 2 marks, which can be set to NIS_HIDDEN (icon hiding), NIS_SHAREDICON (icon sharing) marks separately. Question: What is the difference between NIS_HIDDEN (icon hiding) and NIS_SHAREDICON (icon sharing) marks? ? ?
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-7-21 21:15:01
| Show all posts
But when dwState and dwStateMask are both 0, why the icon is not hidden, not that it will be hidden?
Reply

Use magic Report

0

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 Invalid IP Address

Post time: 2020-7-28 21:00:01
| Show all posts
Private Type NOTIFYICONDATA
    cbSize As Long 'Structure size (bytes)
    hwnd As Long'The handle of the window handling the message
    uId As Long'Unique identifier
    uFlags As Long 'Flags
    uCallBackMessage As Long'Message received by the window processing the message
    hIcon As Long 'Tray icon handle
    szTip As String * 128 'Tooltip prompt text
    dwState As Long 'Tray icon state
    dwStateMask As Long'State mask
    szInfo As String * 256'Balloon prompt text
    uTimeoutOrVersion As Long 'The disappearance time or version of the balloon prompt
    'uTimeout-balloon prompt disappearing time (unit: ms, 10000 - 30000)
    'uVersion-Version (0 for V4, 3 for V5)
    szInfoTitle As String * 64'Balloon tip title
    dwInfoFlags As Long 'balloon prompt icon
End Type
Decompose like this!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-2 23:30:01
| Show all posts
Hidden refers to hiding when inactive
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list