|
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
|
|
|
|
|
Vaclav_Sal wrote: basic windoze question
Stop blaming Microsoft for your incompetency and read the documentation where you will find the SendMessage() API that blocks.
Hint: The next time you post your garbage "windoze" anti microsoft nonsense and I see it, I will surely flame you into a crispy critter.
led mike
|
|
|
|
|
Amendment One
Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the Government for a redress of grievances.
|
|
|
|
|
Huh? This is Code Project, not the USA...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|