|
if you mean you want to reproduce MessageBox-like Classes, CDialog seem to be a good class...
otherwise, please precise a bit more what you want.
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Yes, I want to create a MessageBox-like class with extended features. But, why not CWnd class instead CDialog?
|
|
|
|
|
because CWnd is not a class for dialogs... or you recreate your own CmyDialog !!??!! i advise you not to... lol
use CDialog to create dialog boxes...
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
ell, thanks you.
I'll think about this.
|
|
|
|
|
Is there a trick displaying large document with ScrollView in SDI MFC?
Currently my text display stutters and scroll lags behind when I scroll the document.
|
|
|
|
|
Yogi Berra: "Only draw what needs to be drawn"
Use CDC::RectVisible/PtVisible/GetClipBox/etc to determine which part of the viewable area of screen is marked for redraw, and only draw the part of the document that resides within it/intersects with it.
Drawing the entire document each time is a sure fire bog down.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Here is what I changed so far
pDC->GetClipBox(RectClip);
ScrollClip=GetScrollPosition();
begin=ScrollClip.y/18;
zone=(RectClip.bottom)/18+1;
pos = DataList.FindIndex(begin);
mPt.y=ScrollClip.y;
for(i = begin; (i < (begin+zone)) && (i< nbrData); i++){
pPairing = (CData*)DataList.GetNext(pos);
mPt.x=0;
prefix.Format("%d: ", i);
pDC->TextOut(mPt.x, mPt.y, prefix+pPairing->PrintOut());
mPt.y+=18;
}
The scroll bar still lags a little but at least it's more responsive now. The other problem I have is if I scroll too fast the display will overlap.
|
|
|
|
|
Is there any way to call the CWinApp::OnFileNew except from cliking on the menu item with the default ID_FILE_NEW ;
Because Of the fact the CWinApp::OnFileNew is a protected member function of CWinApp i Couldn't call AfxGetApp()->OnFileNew()
Then I tried
ON_REGISTERED_MESSAGE(MY_REGISTERED_MESSAGE,CWinApp::OnFileNew) and i posted the message from my CView function but didn't work as i expected.
So maybe i was thinking I could fake the effect of cliking on the the menu or pressing the accelerator combination so that i can have the result something like you know FireCommand(ID_FILE_NEW); then the handler of CWinApp ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew) does the required job
Is there any way to get around this
|
|
|
|
|
|
Get a pointer to your document template, and call OpenDocumentFile(NULL) on it. This will create a new document.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a dialog app. In my main window I have the application icon. I wrote a dialog with property sheet and did this:
m_psh.dwFlags |= PSP_USEHICON;
m_psh.dwFlags ^= PSH_HASHELP;
m_psh.hIcon = AfxGetApp()->LoadIcon(IDI_PROPSHEET);
I think I can change this icon when I load each property sheet but I do not need to. What I do need is that now my apps other dialogs do not have an icon. So how am I to put an icon on the corner of each of my other dialogs?
Thank you
|
|
|
|
|
If your dialog is a CDialog, its base class is CWnd so you can call the SetIcon() member function and don't forget to destroy the icon once you've finished with it.
HTH
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
BOOL CmyDialog::OnInitDialog() {
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); <font color=#008000>
SetIcon(m_hIcon, FALSE); <font color=#008000>
}
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Hi
I have an MDI application which deal with 3 types of document: let's say IMAGE, TEXT, SHEET. this is a classical doc/view architecture with multidoct emplate.
I'd like to have an modeless dialog which execute (when a button in this dialog is clicked) an action on the current topmost visible mdi child, only if it is an image. That means, if the current open window is a TEXT window, the button does nothing. But if it is a IMAGE window, it runs the process. How to get the actual topmost MDI view and its type? (in fact, I need a pointer to the actual topmost ImageView window)
BTW I've tried to maintain a ImageView pointer, called *currentView, which is set to the actual active ImageView but it does not work well because when the user closes the ImageView, the pointer is not set to the next open ImageView window (in this case we suppose there are several imageview window open).
Please, Help, I can't find a solution for those pb.
Thank you very much in advance
regards
Guy LECOMTE
|
|
|
|
|
The line
CView* pView=((CMDIFrameWnd*)AfxGetApp()->m_pMainWnd)->MDIGetActive()->GetActiveView(); gives you a pointer to the active view. Then, you can check wether the view is of IMAGE type with something like:
if(pView->IsKindOf(RUNTIME_CLASS(CImageView))){
} For this last check to work, CImageView must have a runtime-type declaration using DECLARE_DYNAMIC or a similar macro from several MFC provides you with: possibly, the MFC wizard has already done that for you (I don't remember), but in any case you'd better check it out.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thanks a lot!
That helped me and it solved my problem...partially.
I explain: when I click the dialog button, now, everything is ok. I get the good window pointer etc...Fine.;)
I call this sollution "from dialog to CView".
Now I have the other problem "From CView to dialog". A modeless dialog is open and displays automatically some info of the current active topmost CImageView. What I need is to automatically maintain the current CImageView pointer and notify the dialog when this pointer changes. For example, when the user closes a CImageView window (and assuming there are several open CImageView and other CView windows) I'd like my dialog to be automatically notified by the new CView window and if it is a CImageView window the dialog should update its info.
It is longer to explain than to see, but I'm sure you get it.
Thank a lot in advance
Guy LECOMTE
|
|
|
|
|
Hello,
who can explain me the following problem :
I have a dialogbox where I display a movie and receive sometimes Windows messages from others applications, everything's perfect. But when I stop my movie and start again another one I don't receive any longer my windows messages ...
It's like if theses messages don't come to my window !
Thanks a lot for help and have a nice evening,
alain
There is no way to happiness, happiness is the way !
|
|
|
|
|
Ok....forgive my ignorance...I'm a relative newbie in VC++....I've done a little, but that's about it.
I have a dialog/propertysheet that has 3 tabs (propertypages). When it comes up it is on the first tab. If I click on the third tab, I get an error during one operation because its trying to access a control within the 2nd tab's window and apprently it doesn't instantiate until clicked on.
If I click on the 2nd tab first, then run that operation, it works like a champ. But if not, the pointer to that propertypage is still null.
How can I instantiate that propetypage when the program starts up, regardless of whether it was clicked or not. If there's a way, I may as well instantiate all proppages at once.
Any suggestions are appreciated.
|
|
|
|
|
If you are setting the property sheet up correctly then they should all load with no problems at all. If you are just clicking on the tab itself and you're running into problems, then something is wrong with the way you added pages to the property sheet. Maybe if you posted a code snippet of when you instatiate the property sheet, it would help.
As far as the problem with the third tab error, you can't access a control on the other tab. It's exactly the same as having a dialog that's not open yet. The control isn't there, so you can't access it.
Hope that helps. Can't really tell you much more since I don't know exactly what you're doing.
|
|
|
|
|
Mike Danberg wrote:
As far as the problem with the third tab error, you can't access a control on the other tab. It's exactly the same as having a dialog that's not open yet. The control isn't there, so you can't access it.
Hope that helps. Can't really tell you much more since I don't know exactly what you're doing.
Well....I was trying to find a way to make sure the dialog "was there" so I could access the control.
Here's more on the problem (fixed now btw) just for information...I couldn't post a code snippet as it is a work project (IP and all that crapola ya know).
It is a power pnael interface for a test station and one tab is a "health monitor" and the two other are two seperate "power" panels for powering up power supplies. The health monitor needs to inactivate monitor controls for power supplies that are not powered. the logic was there for them to safely not run, but I wanted to make the controls visibly disabled to show that they weren't evens selectable while power supplies were not powered up (checkboxes).
However, OnSetActivate() was just the trick I needed (and didn't know). I overrode that function and now when that tab is pressed (instead of during the other tab's processing), I can deactivate the controls.
Thanks.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
Hi,
I am trying to use thread sync functions such as CCriticalSection or CMutex and the compiler just don't recognize them ?
Should I #incluede anything speciel ?
This is a standrd wizard generated dialog app.
BTW, I do get a warning like this one, is that the reason :
LINK : warning LNK4089: all references to "SHELL32.dll" discarded by /OPT:REF
This warning didn't break or hurt anything els
Thanks,
Shay
|
|
|
|
|
Is this an MFC application? If not then they will not work...
If so then you must use the following include:
#include <afxmt.h>
John
|
|
|
|
|
Bingo !
Thanks a lot.
I was sure this will be included in MFC by default.
Shay
|
|
|
|
|
Hi,
I used CDialog in a com ( atlCom dll) . When exiting dlg.DoModal() i have assertion failure.
The assertion is in CWnd::DestroyWnd (Assert(m_hWnd == hWndOrig)in Wincore.cpp line 986.
Thanks ahead.
|
|
|
|
|
Hi!
I have a dialog based application..using MFC in Visual C++ .Net.
I don't really know how to use the
#using namespace System::security::cryptography;
when I add the above #using statement in my code.. I got error..
what should I add/do inorder to use the member functions of cryptography class ?
Thank You
|
|
|
|