|
Wasn't standard MFC implementation enough? And what's difference between m_bSaveSinceLastChange and CDocument::SetModifiedFlag/IsModified?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I presume you're telling me MFC has a flag built in that does the same thing ? The difference then would be one of control, but I admit to having vague recollections of the flag you're talking about and not knowing about it at all when I implimented the code I posted.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Just call CDocument::SetModifiedFlag(TRUE) when your document changes and all saving/filename prompting will be done by MFC. It's already there.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hello all,
I am trying to capture desktop wallpaper into memory device context, but it wasn't successful. Here are the steps I did.
1: create a DC for the screen and create a compatible memory DC to screen DC
2: get screen resolution for bitmap width and height
3: create a bitmap compatible with the screen DC with width and height obtained from step 2
4: select created bitmap into memory DC as a drawing surface
5: create clipping region in the memory DC
6: paint the desktop pattern to the memory DC with PaintDesktop(HDC hdc) API function
7: copy the bitmap in the memory DC on to the clipboard, I got a black image when pasting it to WordPad.
Could you please give me some pointers for this problem? Did you spot any problems in the steps I performed? I can tell that PaintDesktop() didn't paint the desktop pattern into my memory DC. I really got stuck. Thank you very much for your help.
|
|
|
|
|
HKEY_CURRENT_USER\Desktop\Wallpaper will give you the path to the wallpaper file, then it would be easy to use ::LoadImage ( assuming a bmp ) to load it into a DC and copy it across to another if desired.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
PaintDesktop worked OK with memory device context in NT 4. In Windows 2000 it fails. The funny thing is that you can call PaintDesktop with HDC obtained using ::GetDC or CClientDC and it will work, even on Win2000.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hi there
how can i change the dialog dsplayed in the dialog bar while runtime. i want to change the dialog when the user hits a button.
how can i realize this in MFC...
thank you
|
|
|
|
|
Does anyone have any clue on how to create a "Hidden" view in a Multi-Paned MDI app?
I ahev an MDI multi-paned app and want to store Source of a document in a Hidden Edit View so I can use the Edit view to Print/Print Preview source of document.
NB: I do not have a pane dedicated to this view and therefore the "Hidden" request...
Paul McLeish, Senior Software Engineer
BELTEK, Inc
Beltek Drive & 3rd Street
P.O. Box 339
Hanna, WY 82327
Phone: 1-307-325-6776
Fax: 1-307-325-6785
mailto:paul@beltek-linkone.com
Visit our web site: http://www.beltek-linkone.com
This transmission is for the intended addressee only and
is confidential information. If you have received this
transmission in error, please delete it and notify the
sender. The contents of this E-mail are the opinion of
the writer only and are not
|
|
|
|
|
Try something like this. I haven't actually tried it but it (or something along these lines) should work:
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
SendMessage(WM_SETREDRAW, FALSE, 0L);
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
ShowWindow(SW_HIDE);
}
|
|
|
|
|
Hi,
I have an SDI application, and i created a pop up menu, but it doesn't work,
I believe that i have to call OnRButtonUp , :
void CEdgeView::OnRButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMenu *mMenu;
CPoint m_pPoint;
m_pPoint = point;
ClientToScreen(&m_pPoint);
// Get a pointer to the menu
mMenu = GetMenu();
// Get a pointer to the submenu
mMenu = mMenu->GetSubMenu(0);
// Open it as a context menu
mMenu->TrackPopupMenu(TPM_LEFTALIGN + TPM_LEFTBUTTON,
m_pPoint.x, m_pPoint.y, this, NULL);
CView::OnRButtonUp(nFlags, point);
}
does anyone know the correct codes???
Ehsan Behboudi
|
|
|
|
|
First, I generally add a message handler for WM_CONTEXTMENU (OnContextMenu) with the necessary code for the popup menu.
Next, I believe that the popup menu is a sub menu of a menu resource not the menu resource itself.
In other words you need to call GetSubMenu with the handle of the menu resource and position of the sub menu that will appear as the popup. The position will be zero if there is only one menu in the resource. GetSubMenu will return the handle of the popup menu which you then pass to TrackPopupMenu.
Hope that helps.
- Oliver Daniel
|
|
|
|
|
hi, thanks for you reply
can you please write me some source codes please, i'm a bit confused...
Ehsan Behboudi
|
|
|
|
|
I have a treelist view. (reused the class from Gerolf @ http://www.codeproject.com/treectrl/treelistctrlgerolf.asp)
When I edit the value (thus the label) of a list item, the value of its parent/ child item are also affected. these values are update din the document but not in the tree view. Only the change in the selected item is updated, not the parent or child item.
How can I make sure that all the affected list items labels are updated accordingly. If you have a sample code, it woudl be wonderful.
Thanks!
|
|
|
|
|
Hi
I have a problem with register ("Regsvr32.exe MyServer.dll") my automation server in Win98 NOT SE(In Win98 SE - succeed)
LoadLibrary return Error Code 31 :
"A device attached to the system is not functioning"
Thanx.
Ernst.
|
|
|
|
|
Hi,
I have two questions:
1-I have a SDI application, and I like to name is "TurboMech", I like to know how can i
have that name on top of the mainframe everytime i run the program.
i used the following code but it does work
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
Create(NULL,"TorboMech",WS_OVERLAPPEDWINDOW,rectDefault,NULL,NULL);
}
2-How can i get the file name (bmp file), beside the application name when i rn the program.
Thanks
Ehsan Behboudi
|
|
|
|
|
You should find the following to help.
1) Create a function "UpdateTitle" in your document class in which you set the document title to whatever you like.
eg. "TurboMech - Filename.bmp"
2) Override the OnUpdate(...) function of your view at the end of which call GetDocument->UpdateTitle()
Note: You can check the modified state of the Document and add a "*" at the end of the new title if it has been modified since the last save.
Hope this has been of some help...
Paul McLeish, Senior Software Engineer
BELTEK, Inc
Email: paul@beltek-linkone.com
|
|
|
|
|
thaks for you reply,,
in my UpdateTitle() function, how can i initialize the title???
Thanks
Ehsan Behboudi
|
|
|
|
|
The CDocument function SetTitle(sNewTitle) will allow you to set this.
Note: Your Document's UpdateAllViews should be called on initial update or by your app when you change data, which in turn calls your Views OnUpdate.
Paul McLeish, Senior Software Engineer
BELTEK, Inc
mailto:paul@beltek-linkone.com
|
|
|
|
|
What is the best way to close (i.e., destroy) a view from its OnUpdate operation?
I don't want to close the document.
Currently, I am aware of the following options. I am not sure if they'd all work, or which would work best.
1. CDocument::RemoveView()
2. Post WM_CLOSE
3. Post WM_DESTROY
Any help is much appreciated.
Marc
|
|
|
|
|
|
How can I change the value of my document data from another class?
in my sample MFC code in MyProjectView.cpp:
...
...
CMyObject* pPencil = GetDocument()->m_pPencil;
// the value of GetDocument()->m_pPencil->Length is 0
pPencil->Length = 2;
...
...
somehow when I execute this code, the value of m_pPencil->Length in the document is still 0. how can I change the document data from my project's View class?
|
|
|
|
|
Try this:
CMyView::
{
GetDocument()->m_pPencil->SetPencilLength( 1 );
}
or, even better, as the document should be responsible for managing the data defined within it
(as with any well designed object class )
CMyView::
{
GetDocument()->SetPencilLength( 1 );
}
CMyDocument::SetPencilLength( int length )
{
ASSERT( NULL != m_pPencil ); // And other appropriate checks!
m_pPencil->SetPencilLength( length );
}
|
|
|
|
|
Okay I'm trying to regulate how many messages get sent out of my Outlook box at once...now would it be easier to monitor some MAPI call? Or should I write a small "exchange agent" to do this??
I was HOPING to write a small piece of code that I could run as an NT service that would run independently of the email client..
Does anyone have any suggestions???
thanks in advance,
Erik
I hit faked him with my win32 API .chm and the peabrain goes for it. I follow it up with a salvo of left's and right's sending him down hard. It's lunch time and he's getting a Champ Sandwhich Special. I said, How's that Mr. VB?! Is that 'I wanna use COM in that Server enough for you?!'
...Ever since then, I've been the Champ.
|
|
|
|
|
Okay did some more perusing of the MAPI docs and found what I think I needed...a MAPI pre-processor DLL component which intercepts the messages before they hit the mail transport provider..
Has anyone here had any experience programming these MAPI preprocessor guys??
thanks again,
Erik
I hit faked him with my win32 API .chm and the peabrain goes for it. I follow it up with a salvo of left's and right's sending him down hard. It's lunch time and he's getting a Champ Sandwhich Special. I said, How's that Mr. VB?! Is that 'I wanna use COM in that Server enough for you?!'
...Ever since then, I've been the Champ.
|
|
|
|
|
Hi.
I need to access not only the sent data but the whole IP packets to analyze the headers (for a firewall-like app).
My problem is, that I can't find any entry point in the MSDN to learn about access to the low level network traffic.
How can I
1. get notified when a packet arrives ?
2. get the packet form the queue ?
3. put packets into the queue ?
I'd be happy to learn about a good website/tutorial about this issue...
|
|
|
|