|
I would have thought that each individual #pragma switch would apply to the translation unit(s) in which it appears.
False. The compiler would have to perform additional pass just to find #pragma.
#pragma warning should appear before code that causes warnings. If you're #including STL headers in stdafx.h, put the #pragma at the top.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
You could also push the warning level to 2 before including the STL headers, then pop it back again after the includes...
#pragma push and pop
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
How I can get m_viewList from MainFrame window class.
I call GetFirstView(). But it genaret error.
Please Help me.
|
|
|
|
|
GetActiveFrame ->GetDocument -> GetFirstViePos GetNextView
|
|
|
|
|
A Question About Asynchronous Property
I use a asynchronous property in my ActiveX control to implement the background of my control.
In the "OnDraw" function, I use the following tactic:
if(GetReadyState()==READYSTATE_COMPLETE)
{
//draw with the background picture
... ...
}
else
{
//draw without the background pictrue
... ...
}
In the "OnDataAvailable" function:
I check the status. If the status is "BSCF_LASTDATANOTIFICATION", I will set the status of the control to "READYSTATE_COMPLETE" and force the control to redraw itself(invalidaing the control).
In the "Set" function of the property:
I just use the function "SetModifiedFlag".
My Question is:
If I changed the value of the asynchronous property, can the background of the picture redraw automatically? Shall I add a statement to reset the status in the "Set" funtion of the property?
Thanks.
Maer.
|
|
|
|
|
Hi there,
I have a dialog box class that is suppose to show various kinds of messages. The reason I don't want to use MessageBox is because I like to have a more colorful message box.
I was wondering how I can adjust my dialog box to handle varying sizes of strigs?
|
|
|
|
|
Look at TcxMessageBox on this site.
|
|
|
|
|
Look at TcxMessageBox on this site.
|
|
|
|
|
Hello,
How can I catch CTRL key combinations in a CEditView? I want to catch CTRL-0 through CTRL-9. Thanks!
Joseph LeBlanc
unixd0od@hotmail.com
|
|
|
|
|
|
I have created a modaless dialog box, that needs to retain the focus, ie I don't want people to be able to click on the main frame, while this dialog box is up. I can't seem to find the style marker or whatever needs to be set to do this.
|
|
|
|
|
A modal dialog box won't suffice. I need the rest of my application to continue running, where-as a modal dialog box suspends the rest application until that dialog box is closed.
|
|
|
|
|
I would do this by checking the variable that holds the modeless dialog when my main app recieved focus, and if it was non-NULL ( the dialog existed ), set the focus back to the dialog.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I just attempted to over-ride the WM_SETFOCUS message for my CMainFrame class. When I received it, I checked a boolean variable I created to determine whether the dialog was still "alive" and if it was, I called the ::SetFocus() function to give the focus back to that dialog. This created a bad flickering. Each time I tried to revert the focus back, the program then tried to give the focus back to the main frame (i'm not sure why), and thus I had an endless loop. I also tried to over-ride the WM_LBUTTONUP message, but for some reason I could never get into that function.
Any more help would be great.
- John
|
|
|
|
|
Hmmm... Here's a thought. When you create the dialog, call SetCapture() so that your dialog recieves all mouse messages first, and then you can catch and kill anything that occurs outside your dialog. That's better - the solution is contained in the dialog where it should be.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Ok. Here's the trouble with that. It does capture all the mouse input, but the dialog does not respond to it. No matter where I click or what I try to drag, nothing happens. If I click outside the main frame, then whatever app that was in the back ground get the focus, which is fine. However, when I bring my app back up, I can click on the main frame and such all over again, and SetCapture has been invalidated or something.
|
|
|
|
|
I remember having trouble like that. I did a colour picker dialog and made it so you could click anywhere on the screen to select colours. I'm loading the code right now to see what I did.
I set a timer in OnInit to go off twice a second and then do this:
if(nIDEvent == 42)
{
CPoint pt;
GetCursorPos(&pt);
CRect rc;
GetWindowRect(&rc);
if (!rc.PtInRect(pt))
SetCapture();
}
CDialog::OnTimer(nIDEvent);
In MouseMove I do this:
CPoint pt;
GetCursorPos(&pt);
CRect rc;
GetWindowRect(&rc);
if (rc.PtInRect(pt))
ReleaseCapture();
Essentially I found I had to release capture every time the mouse was in the dialog, and set it before it left, releasing it when people click.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Just an idea...
Create a second thread that shows a modal dialog...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I have a need for this quite often, and while I haven't gotten around to writing my own class to do it, I know of one that works very well. It's called PassiveDialog and comes with the ITCLib package(http://devcentral.iftech.com). If I look at the code (just to get ideas) I find they've overridden the DoModal function:
...
TRY
{
// create modeless dialog
AfxHookWindowCreate(this);
if (CreateDlgIndirect(lpDialogTemplate, CWnd::FromHandle(m_hWndParent), hInst))
{
if (m_nFlags & WF_CONTINUEMODAL)
{
m_nFlags |= WF_MODALLOOP;
ShowWindow(SW_SHOWNORMAL);
UpdateWindow();
Pulse();
}
}
}
...
And created a new Pulse function to pass messages back to the calling code:
...
// Check to see if we can do idle work
while (bIdle && !::PeekMessage(pMsg, NULL, NULL, NULL, PM_NOREMOVE))
{
if (!(dwFlags & MLF_NOIDLEMSG) && m_hWndParent && lIdleCount == 0)
{
::SendMessage(m_hWndParent, WM_ENTERIDLE,
MSGF_DIALOGBOX, (LPARAM)m_hWnd);
}
if ((dwFlags & MLF_NOKICKIDLE) ||
!SendMessage(WM_KICKIDLE, MSGF_DIALOGBOX, lIdleCount++))
{
bIdle = FALSE;
}
}
...
For more info, just go download the library. Keep in mind, though, that the code is ©. Hope this helps!
-Dave
|
|
|
|
|
hi all....
i have a problem... if I want to use the Right key or Up key....:
switch (nChar)
{
case VK_LEFT:
MessageBox("Left");
break;
case VK_RIGHT:
MessageBox("Right");
break;
case VK_UP:
MessageBox("Up");
break;
case VK_DOWN:
MessageBox("Down");
break;
}
so... why does VK_RIGHT and VK_UP not work? Is my Code right?
I'm a newbie.... please help.... or is my System not compatible?
|
|
|
|
|
Where are you catching this message ? I just did up a test app to see what would happen and in WM_KEYDOWN the above code worked perfectly.
You don't have accelerators attached to right and up, do you ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
ohh.. accelerators... no problems... no more
|
|
|
|
|
ALl toda today the Go To Definition fucntion in VC++ has been screwed up. It fails to find my new classes, and is often wrong about the location of other classes. It appears that whatever this info is stored in is no longer being updated.. but ic an't figure out what that is. I've tried doing a Clean, deleting the .ncb file, rebuilding from scrath, etc. No help.
On a related note - the same function frequently gets confused about teh locations of certain definitions. For example, it can't find the SFGAO_ flags - define in shlobj.h; it often takes me to some other location in my code, rather than to the actuial definition.
|
|
|
|
|
I have no idea what is wrong with your configuration/build. But the browse information is contained in the *.bsc file NOT the *.ncb.
Matt
------
Accept that some days you are the pigeon and some days the statue.
|
|
|
|
|
Tnanks for the tip. I was able to fix it by deleting EVERYTHING in the debug directory. I thought that Clean would do that - guess not.
|
|
|
|