Prev: Hey, what's the URL to that IEEE floating-point number page?
Next: Is There An AC/Battery API Call
From: Norm on 30 Apr 2010 17:58 Karl, I have added the following code to my program, but I am not sure it is correct, as I don't know exactly how to recreated the taskbar. Is this the right way to implement this function? If it is the correct way to implement this, what would happen if I run ShellTrayAdd function and the icon is there" Thanks, Norm Public m_msgNewTaskbar As String Public Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long Public Const TaskbarCreatedString As String = "TaskbarCreated" In Sub Main I have the following: m_msgNewTaskbar = RegisterWindowMessage(TaskbarCreatedString) In the WindowProc I have: Select Case uMsg Case WM_QUERYENDSESSION: Unload frmMain WindowProc = 1 Exit Function Case WM_MYHOOK Select Case lParam Case WM_RBUTTONUP: If Not bMsePos Then MsePosX = (ptAPI.x * 13) MsePosY = (ptAPI.y * 14.3) bMsePos = False End If SetForegroundWindow frmMain.hwnd frmMain.LeftMouseClick Case WM_LBUTTONUP: If Not bMsePos Then MsePosX = (ptAPI.x * 13) MsePosY = (ptAPI.y * 14.3) bMsePos = False End If SetForegroundWindow frmMain.hwnd frmMain.LeftMouseClick End Select Case m_msgNewTaskbar frmMain.ShellTrayAdd Case Else WindowProc = CallWindowProc(defWindowProc, hwnd, uMsg, wParam, lParam) Exit Function End Select The ShellTrayAdd function is: With NID .cbSize = LenB(NID) .hwnd = frmMain.hwnd .uID = 125& .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .uCallbackMessage = WM_MYHOOK .hIcon = Me.Icon .szTip = "SecRep File CleanUp" & Chr$(0) End With ShellTrayAdd = Shell_NotifyIcon(NIM_ADD, NID)
From: Karl E. Peterson on 30 Apr 2010 18:06 Norm wrote: > I have added the following code to my program, but I am not sure it is > correct, as I don't know exactly how to recreated the taskbar. Is this the > right way to implement this function? Well, yeah, it looks approximately right. What's with the WM_MYHOOK, and looking at lParam, though? All those messages under that SelectCase really ought to be coming in at the same level as the WM_QUERYENDSESSION one. > If it is the correct way to implement > this, what would happen if I run ShellTrayAdd function and the icon is there" I don't think anything will happen, in that case. Can't hurt to try it? -- ..NET: It's About Trust! http://vfred.mvps.org
From: Karl E. Peterson on 30 Apr 2010 18:25 Karl E. Peterson wrote: > Norm wrote: >> I have added the following code to my program, but I am not sure it is >> correct, as I don't know exactly how to recreated the taskbar. Is this the >> right way to implement this function? > > Well, yeah, it looks approximately right. What's with the WM_MYHOOK, and > looking at lParam, though? All those messages under that SelectCase really > ought to be coming in at the same level as the WM_QUERYENDSESSION one. > >> If it is the correct way to implement this, what would happen if I run >> ShellTrayAdd function and the icon is there" > > I don't think anything will happen, in that case. Can't hurt to try it? I just tried it (using all the same parameters, of course), and the second call to ShellNotifyIcon fails. No harm, no foul. -- ..NET: It's About Trust! http://vfred.mvps.org
From: Norm on 30 Apr 2010 18:38 "Karl E. Peterson" <karl(a)exmvps.org> wrote in message news:Op10PQL6KHA.6052(a)TK2MSFTNGP02.phx.gbl... > Karl E. Peterson wrote: >> Norm wrote: >>> I have added the following code to my program, but I am not sure it is >>> correct, as I don't know exactly how to recreated the taskbar. Is this >>> the right way to implement this function? >> >> Well, yeah, it looks approximately right. What's with the WM_MYHOOK, and >> looking at lParam, though? All those messages under that SelectCase >> really ought to be coming in at the same level as the WM_QUERYENDSESSION >> one. >> >>> If it is the correct way to implement this, what would happen if I run >>> ShellTrayAdd function and the icon is there" >> >> I don't think anything will happen, in that case. Can't hurt to try it? > > I just tried it (using all the same parameters, of course), and the second > call to ShellNotifyIcon fails. No harm, no foul. > > -- > .NET: It's About Trust! > http://vfred.mvps.org > > Thanks Karl, I will leave it as is and wait for Explorer to have a problem and reset, unless someone can think of a way to test this. I am running Windows 7 64 bit, but have other operating systems for testing. I just can not think of a way to make explorer reset the task bar. The part of the WinProc that you were asking about in the first post, was to have a small form show at the position of the mouse on the task bar, the form raises incrementally up from the task bar and then shows the progress of a function being run. When finished the form lowers into the task bar and then unloads. Thanks again for all the information. Norm
From: Karl E. Peterson on 30 Apr 2010 18:49 Norm wrote: > "Karl E. Peterson" <karl(a)exmvps.org> wrote... >> Karl E. Peterson wrote: >>> Norm wrote: >>>> I have added the following code to my program, but I am not sure it is >>>> correct, as I don't know exactly how to recreated the taskbar. Is this >>>> the right way to implement this function? >>> >>> Well, yeah, it looks approximately right. What's with the WM_MYHOOK, and >>> looking at lParam, though? All those messages under that SelectCase >>> really ought to be coming in at the same level as the WM_QUERYENDSESSION >>> one. >>> >>>> If it is the correct way to implement this, what would happen if I run >>>> ShellTrayAdd function and the icon is there" >>> >>> I don't think anything will happen, in that case. Can't hurt to try it? >> >> I just tried it (using all the same parameters, of course), and the second >> call to ShellNotifyIcon fails. No harm, no foul. > > I will leave it as is and wait for Explorer to have a problem and reset, > unless someone can think of a way to test this. I am running Windows 7 64 > bit, but have other operating systems for testing. I just can not think of a > way to make explorer reset the task bar. Just kill the explorer.exe process(es) in TaskMgr. :-) -- ..NET: It's About Trust! http://vfred.mvps.org
|
Next
|
Last
Pages: 1 2 3 Prev: Hey, what's the URL to that IEEE floating-point number page? Next: Is There An AC/Battery API Call |