|
Hi Danny,
This is the way to minimize the window, but my problem remains... I need to know when to call ShowWindow(SW_MINIMIZE) and RESTORE, so when someone clicks on the button in the taskbar i need a way to catch that clicking.
Minimizing my application itself isn't the problem, but getting it on that taskbar click is
thanks for answering though!
|
|
|
|
|
Ah, I see. Sorry, I don't know about what you're looking for. Are you working with an SDI, MDI, or Dialog app? If a dialog, are you opposed to putting your own minimize button on the dialog. If SDI or MDI, can you put an entry in a menu or toolbar? Admittedly, this isn't as good of a solution as being able to do the common taskbar click, but as far as handling WM_LBUTTONDOWN messages, I think that only works within your own app, unless you don't release the mouse if it's clicked outside your app I suppose, (by overriding the WM_CAPTURECHANGE message?)
Or... why do you want the title bar gone? Just so the user can't move the window around? You can remove the user's ability to do this.
Danny
|
|
|
|
|
It's a Dialog and the reason for not having a normal titlebar with minimize-button (and thus the normal taskbar behaviour) is, that my boss wants a customized titlebar.
The Dialog has a button for minimizing and that works as planned, but it would be nice if the application would still behave like any other dialog does (so minimize when clicking on the button in the taskbar).
I can get a handle to the taskbar itself, but i dont know how to be able to hook on its messaging system to be able to react to those WM_... mouseactions myself.
i got the idea with SetWindowLong from this article: http://www.pocketpcdn.com/articles/close_app.html , but for GWL_WNDPROC under NT/2k/XP MSDN says: "You cannot change this attribute if the window does not belong to the same process as the calling thread."
-- modified at 10:21 Monday 19th September, 2005
|
|
|
|
|
Hi there!
I'm devolping an communication program, and sometimes I need to do some sleep's. The problem is that I use some external components that use the PostMessage API, and while the app is sleeping, the messages aren't dispatched..
I've developed a funcion with the folowing code:
void DispatchMsg()<br />
{<br />
MSG msg;<br />
DWORD dwi=GetTickCount();<br />
while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))<br />
{<br />
::TranslateMessage(&msg);<br />
::DispatchMessage(&msg);<br />
if ((GetTickCount()-dwi)>2000)
break;<br />
}<br />
}
But it seems that some time I get some repeated messages... I've also tried replacing the PM_NOREMOVE by PM_REMOVE parameter in the PeekMessage, but some times the app seems to hang...
Do you have any ideias?
Thanks all for your time.
ALMC
|
|
|
|
|
See MsgWaitForMultipleObjectsEx in MSDN.
"tous les sifflets des trains, toutes les sirènes des bateaux
m'ont chanté cent fois la chanson de l'Eldorado"
rechi+
|
|
|
|
|
How should I use it? Create a foo mutex or event?
I have a main wnd for the app, and a second wnd to receive messages from the comunication component.
I need to call the component api, wait some time so it can send messages to my wnd, and then process them...
ALMC
|
|
|
|
|
Do you want to freeze the window for a while, waiting for the api to throw a message to the queue?
"tous les sifflets des trains, toutes les sirènes des bateaux
m'ont chanté cent fois la chanson de l'Eldorado"
rechi+
|
|
|
|
|
That can be an option!
How do I use the API you've mentioned?
|
|
|
|
|
almc wrote:
How do I use the API you've mentioned?
No, sorry. I was thinking about your component's API
I don't know what your code is about but if you need to freeze the window - or just a part of it - then you might filter all the messages except those coming from the component and a timer which, when appropriate, signals the timeout as the moment of unblocking. If no freezing is required then you should do nothing, just pump the messages as usual.
Something like this...
"tous les sifflets des trains, toutes les sirènes des bateaux
m'ont chanté cent fois la chanson de l'Eldorado"
rechi+
|
|
|
|
|
Hello,
Since you use PM_NOREMOVE , the same message gets dispatched as long as 2 ms. You should remove the message for this purpose.
Since you do some communication, may I suggest that you do that in a seperate thread. This doesn't interfere with the GUI and enables you to program more flexible. This also saves you the DispatchMsg() function.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
It's not a very easy thing to do... I already have to many threads, and some more windows.
The idea is to give the component some time to post to my wnd the results...
Do you know why the PM_REMOVE sometimes hangs the application?
|
|
|
|
|
Hello,
Removing the message using PeekMessage probably doesn't hang your application. Your problem probably is that DispatchMsg() doesn't wait if there is no message available. That function should look like this:
void DispatchMsg()
{
MSG msg;
DWORD dwi=GetTickCount();
while ((GetTickCount()-dwi)<2000)
{
if (::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
else
{
::WaitForSingleObject(::GetCurrentThread(), 50);
}
}
}
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hey there,
I bought a microphone that isn't loud enough, so i decided to write a driver solely for increasing the microphone volume, other thing have not to be done.
Now my question, is it possible to write a driver that acts like beeing a normal windows driver, but instead only takes the signal from the original Soundcard driver, and increases the volume of the soundcard's microphone?
Is there any kind of "Wrapper" Driver already available?
Greets,
hircs
|
|
|
|
|
|
Hi Freinds,
I am working on a dialog based MFC application, i had some combo controls and edit controls added to this application and it was working fine .... now i have added one more combo control and since then i m not been able to execute the applctaion, even it doesnt give any error but also doesnt start at all.... and if i remove the newly added combo control... the applcation works pretty fine ...
Pls help me in this regard .... thanking you all in anticipation....
Mukhan
|
|
|
|
|
Is there anything special about the control? With the control intact, temporarily add the DS_NOFAILCREATE style to the dialog. Do the dialog and the control show up?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm currently developing the GUI for an application that interfaces to a hardware data acquisition device. I'd like a window on the GUI that displays read-only textual status information, much like the build/debug console at the bottom of the visual studio IDE. I've placed an Edit control on my dialog and attached a CString member variable to it with global scope. Every time I want to append a new line of text to the output window I append it to the CString member using +=. This way I retain previous output messages. Every time I append some new text I proceed this with SetDlgItemText() to update the edit control text. Ive added a vertical scroll to allow read access to text outside of the edit control window. I have the multi-line style selected
The problem I have is one of orientation. Clearly I want the most recently appended lines to be visible without having to touch the scroll bar, just like on Visual studio, and even the edit box Im entering this text into. However I can't find a way of arranging this. In my application the scroll bar sits at the top of the window by default so that the first few lines of text are visible and you have to scroll down to the more recently appended lines.
Any advice on resolving this problem is greatly appreciated.
Regards,
Adrian
|
|
|
|
|
m_MyEdit.SendMessage(WM_VSCROLL,MAKEWPARAM(SB_BOTTOM,0));
this is this.
|
|
|
|
|
Thanks for your reply.
Im using the code .....
CEdit* pMyEditCtrl = (CEdit*)GetDlgItem(IDC_MyEditCtrl);
pMyEditCtrl->SendMessage(WM_VSCROLL,MAKEWPARAM(SB_BOTTOM,0));
This seems to work, but I need to send the WM_VSCROLL message after each time I set the Edit control text with SetDlgItemText( ). I thought I would be able to set this bottom scroll property once and it would remain static.
Any thoughts??
|
|
|
|
|
adrian27 wrote:
I thought I would be able to set this bottom scroll property once and it would remain static.
Not quite. The code fragment doesn't set a property - it sends a message (i.e. instructs the edit control to scroll to the bottom).
See this[^] article for a self-contained solution.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
adrian27 wrote:
I've placed an Edit control on my dialog and attached a CString member variable to it...
Use a CEdit member variable instead. Global variables are rarely, if ever, needed.
For the rest, see here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I put a picture control (type:rect) in a dialog, and associated it with a CStatic object. I find it doesn't refresh itselt when a window uncovered it.
|
|
|
|
|
So what happens when the static control is uncovered?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
What I drew on the static's client is not refreshed, the client became what it was originally.
|
|
|
|
|
followait wrote:
What I drew on the static's client...
How and where are you drawing on the static's client?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|