|
hello,
i got an example project from this site that makes window hooks on all windows and add an option at the context menu for traying it.
every window event will fire the following callback function:
LRESULT CALLBACK InitMenuHookProc(int nCode, WPARAM wParam, LPARAM lParam)
I'm needing to do a program that trays windows which title contains "Mozilla Firefox" whenever it's minimized and untrays when it's resized/maximized.
I tried programs like spy++ to get the values of wParam and lParam, but I got completely stuck.
Any help would be appreciated
Best Regards.
|
|
|
|
|
|
also tried that... i would not be asking at forums before searching in google, msdn, etc, but i could not find much information on the subject.
at the code there is:
CWPSTRUCT *wps = (CWPSTRUCT*)lParam;
so i use
if (wps->message==WM_SIZE) {//here should be another instruction to test if the window has been minimized, maximized or restored }
the part of testing this is what i cannot find
BUT i think i can do a workaround on this using wps->hwnd to determine the hwnd state... just need to look out for the right API for this
sorry for bothering and thanks for the time
|
|
|
|
|
marcio k wrote: also tried that
and what happened?
led mike
|
|
|
|
|
I could not found much at microsoft documentation... but this workaround fits like a glove for the problem
|
|
|
|
|
marcio k wrote: but this workaround fits like a glove for the problem
Ah, yes
If it works, do it[^]
led mike
|
|
|
|
|
great pdf!
do someone know any api to get the window state (maximized, minimized, restored) through the hwnd?
thanks
|
|
|
|
|
marcio k wrote: do someone know any api to get the window state (maximized, minimized, restored) through the hwnd?
Umm yeah, the one I already provided to you does.
led mike
|
|
|
|
|
sorry... i was a little "sleep-deprivation drunk" :x
|
|
|
|
|
Hi,
I am trying to create a tray icon. I downloaded Chris Maunder's project and it works for me in my test dialog which is modal. Now I am trying to get it to work in a modeless dialog that ultimately I want to be hidden. I cannot get the tray icon create logic to work. The call to ::Shell_NotifyIcon() fails but I have no idea why. The NOTIFYICONDATA struct seems to be filled in correctly and GetLastError() returns 0. I have tried it with and without a visible modeless dialog. I need the tray icon only to let my user know that my service is running. My code is below:
<br />
m_tnd.cbSize = sizeof(NOTIFYICONDATA);<br />
m_tnd.hWnd = pParent->GetSafeHwnd()? pParent->GetSafeHwnd() : m_hWnd;<br />
m_tnd.uID = uID;<br />
m_tnd.hIcon = icon;<br />
m_tnd.uFlags = NIF_ICON | NIF_TIP;
m_tnd.uCallbackMessage = uCallbackMessage;<br />
_tcscpy(m_tnd.szTip, szToolTip);<br />
<br />
VERIFY(m_bEnabled = ::Shell_NotifyIcon(NIM_ADD, &m_tnd));<br />
Any help appreciated
|
|
|
|
|
Why does the dialog need to be modeless?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This dialog must be modeless because it is to be displayed by a Windows service and I don't want my service to hang or be killed by the OS. This dialog will appear only if the user attempts to shutdown the system if my service is still doing critical processing.
|
|
|
|
|
Royce Fickling wrote: This dialog will appear only if the user attempts to shutdown the system if my service is still doing critical processing.
I've written many Services down through the years and never even considered doing something like that. I'm not even sure if it makes sense in the larger scheme of things. I'm also not sure it is supported during shutdown because as I stated I would never even consider doing something like that.
led mike
|
|
|
|
|
Does GetLastError() give you any useful info?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not according to his post. I did not find anything on MSDN that says GetLastError() is even used.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
What are you doing looking at newer documentation, Mark?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Heh that's the least of my problems....I need to read the posts more closely!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I know that, Mike. I was looking at my Oct '01 copy of MSDN. It's a bit aged.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry, I would not have posted if I had seen Marks, I got web lagged.
led mike
|
|
|
|
|
Royce Fickling wrote: Now I am trying to get it to work in a modeless dialog
When are you running the code you posted?
m_tnd.hWnd = pParent->GetSafeHwnd()? pParent->GetSafeHwnd() : m_hWnd;
I assume a valid HWND is required, have you checked that you have one?
led mike
|
|
|
|
|
Yes, the dialog's hwnd is valid. I have called the icon create method from OnInitDialog() after the CDialog::OnInitDialog() call. I have also called it from OnShowWindow(), but both fail.
|
|
|
|
|
|
PostMessage puts a message in windows queue and does not wait for it to be processed.
I know that windoze will not keep same message in the queue; however, I cannot make the following work:
PostMessage(NULL,WM_STATUS, 1, 1);
... process something
PostMessage(NULL,WM_UPDATE, 1, 1);
Only the first message gets processed - in my case by
CMainFrame::PreTranslateMessage(MSG* pMsg)
I just want to change status bar text “before and after” lengthy process.
Could anybody explain to me why the second message gets ignored please?
Do I have to use different method to accomplish this?
Thanks for your time
Cheers
Vaclav
|
|
|
|