|
Hello I need your expert help. I am trying to make my app to auto hide on start up. Here are part of the code..
CTestDlg.h
----------
I put this on the message map.
afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
CTestDlg.cpp
------------
I put the following line in BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
ON_WM_WINDOWPOSCHANGING()
And have the following function
void CTestDlg::OnWindowPosChanging (WINDOWPOS* lpwndpos)
{
CDialog::OnWindowPosChanging(lpwndpos);
if (lpwndpos->flags & SWP_SHOWWINDOW) {
lpwndpos->flags &= ~SWP_SHOWWINDOW;
}
}
It compile without any error but when I run the program the dialog are still visible. Any ideas?
Thank you very much.
|
|
|
|
|
Try to change flags before call to base class function.
|
|
|
|
|
In OnInitDialog try:
if(!this->ShowWindow(SW_HIDE))
{
<code>
...
}
to show it again:
if(!this->ShowWindow(SW_SHOW))
{
<code>
...
}
Nitron
_________________________________________--
message sent on 87% post consumer electrons.
|
|
|
|
|
This is not very fast solution.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Mazdak wrote:
This is not very fast solution.
um... ... ok...
So how do you show/hide a modeless dialog?
A show/hide cycle on my machine took about 12.679709572027 ms over 1000 samples.* That would be 6.3398547860135 ms to show or hide. I don't know about you, but I'm sure I can't distinguish the difference between 1/158th of a second or 1/200th of a second.
* Measurements acquired via timer class found here[^].
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
Well for the modeless dialog you have to do that.In slow machines if you do your way,the main dialog or window maybe become visible for a very short time.Thats why I say it is slower.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Here's a simpler way:
1. Uncheck the "Visible" checkbox from the dialog resource.
2. Construct the dialog box modelessly:
In your CWinApp-derived class, replace the code in your InitInstance (after Enable3dControlStatic) with something like this:
static CYourDlg dlg;
dlg.Create(CYourDlg::IDD);
m_pMainWnd = &dlg;
return TRUE;
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
|
|
|
|
|
I am trying to modify the message map at run-time, to create new handles.
Everything lokks fine, but i get this error
Compiler Error C2276 'operator' : illegal address of bound member function expression
when I try to assign the handle function "MaximizeDialog"
AFX_MSGMAP_ENTRY newEntry;
newEntry.nMessage = WM_COMMAND;
newEntry.nCode = CN_COMMAND;
newEntry.nID = (WORD)nID;
newEntry.nLastID = (WORD)nID;
newEntry.nSig = AfxSig_bw;
newEntry.pfn = (AFX_PMSG)(BOOL (AFX_MSG_CALL CCmdTarget::*) (UINT))&MaximizeDialog;
_messageEntries[i] = newEntry;
What can I do ? thanks !
-----
Mit freundlichen Grüssen/Best Regards/Un cordial saludo.
Ing. José Manuel Hostalet Wandosell, Fraunhofer IPA, Abt.323/Robotersysteme
Nobelstrasse 12, D-70569 Stuttgart (Germany)
mailto:jose.hostalet@ipa.fhg.de, http://www.ipa.fhg.de
|
|
|
|
|
Here's a quick stab at your problem: try removing the "&" from the front of MaximizeDialog.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
|
|
|
|
|
Thank you !
But I still dont understand, why this '&' is in the definition of windows
#define ON_COMMAND_EX(id, memberFxn)\
{ WM_COMMAND, CN_COMMAND, (WORD)id, (WORD)id, AfxSig_bw, \
(AFX_PMSG)(BOOL (AFX_MSG_CALL CCmdTarget::*) (UINT))&memberFxn },
and works when i use the original macro.
-----
Mit freundlichen Grüssen/Best Regards/Un cordial saludo.
Ing. José Manuel Hostalet Wandosell, Fraunhofer IPA, Abt.323/Robotersysteme
Nobelstrasse 12, D-70569 Stuttgart (Germany)
mailto:jose.hostalet@ipa.fhg.de, http://www.ipa.fhg.de
|
|
|
|
|
|
When I loaded up VC++ 6.0 today and went to my resource editor to edit a dialog box in my project, every time I double clicked on a part of it the MFC Class Wizard popped up and told me to add the dialog to a class. I am not using MFC, I have no idea how this setting got turned on and more importantly I don't know how to get rid of it so I can get on with my project. Someone please tell me how to de-activate this feature it is driving me nuts Thanks!
|
|
|
|
|
Tools - Options - Compatibility - uncheck "Double-click in Dialog editor edits code (MFC only)".
By this way feature is deactivated completely. I really don't know what to do if you want to deactivate it only for non-MFC projects.
|
|
|
|
|
Thanks a lot, that did the trick.
|
|
|
|
|
Hi all,
I developped a MDI application that shows a timetable for an appointment system. It basically show staff members and the appointments they are assigned. Each appointment is represented using a derived CWnd object. You get information on appointments by hovering on them using another CWnd derived object.
My problem is that I've got a lot of flicker when i'm dragging appointments or when I hovering on appointments. It really flicker when there's a lot of appointments showing up.
I tried implementing double-buffering but it didn't change anything, any idea?
Pyt
|
|
|
|
|
Try to show the information by testing for a time lag
of say about 500 ms to 1 sec.
I think windows tooltips are also implemented in this manner
|
|
|
|
|
You can should draw at first to a memory dc and the draw to the screen.
Another solution is to use timers for redrawing.
My experience is also if it doesn´t work, may be there an conceptional mistake.
(Oversized solution)
IMHO: that each appointment is a CWnd seems to be no good idea. I would internally work with an array and access it via the screen coordinates. The output would be simple Retangles.
Try it @ home. (B&B)
|
|
|
|
|
Hi,
The thing is that my controls are drawing themselves and that I already implemented a memory dc in the drawing code.
Could the problem be that my view is not actually drawing the controls, but just sending a WM_PAINT message to each of my derived CWnd controls ?
|
|
|
|
|
You´re right. You have understood the principle architecture of the Windows API.
My suggestion implies that the area would be drawn by the "containing" window.
Try it @ home. (B&B)
|
|
|
|
|
Thanks for the info, i'll give it a go.
Pyt
|
|
|
|
|
|
By the way, did you know that 'flicker' is dutch 'slang' for a homosexual guy?
Imagine what MS-Word said a few years ago when I typed in a meeting report that one of our applications had a flicker-problem...
(I know this really belongs in the lounge-forum, but I couldn't resist, sorry).
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Is there a way to find the minimum necessary size for the buffer argument of vsprintf before making the call?
rechi
|
|
|
|
|
sprintf works by calling a the low-level output function (_output) with a stream handle. that same output function handles all printf-style output (printf, sprintf, fprintf, etc). the output function simply outputs to a stream, which can grow as large as necessary.
so... to simulate it... run down the format string, parse it, add up the size of all the output specs. not easy.
-c
A conclusion is simply the place where someone got tired of thinking.
|
|
|
|
|
Use _vsnprintf and if it returns -1, your buffer is too small.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|