|
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...
|
|
|
|
|
You have to write a packet driver. To do that you need the DDK (Driver Development Kit) for win9x. (download from MS)
There is a demo driver, in the DDK, that can do a lot of the things that you want
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hello,
I seem to be having a problem with my message queue. I am working on a data aquisition app (multi-threaded). The data aquisition thread(s) post messages to the MFC gui thread when data is received and when the graph needs to be refreshed. Occasionally, the graph stops displaying data until the refresh occurs (rather than as it is received). When this happens, all of the buttons in the dialog become inoperable. Is there a way to do something with the message queue? I'd like to be able to see if it's getting full and, perhaps, increase its size.
Thank you.
Paul Ebert
|
|
|
|
|
Hi.
Perhaps you should try to prevent the message queue from getting overload.
I assume you don't need more than a few refreshs in a second?! So you can implement a global thread-safe bool which
- is set when a message is sent to the GUI.
- is reset by the paint reoutine after completion.
The threads only send a refresh request, when the bool is not set.
Hope it will help you.
Karl
|
|
|
|
|
In Windows 3.1 there was SetMessageQueue function that made increasing the queue size possible, but it's obsolete now - they probably made it a no-op call.
Do you really have to post multiple messages from data acquisition thread? Before posting you could check if GUI is already refreshed. If not, no need for second PostMessage.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
If you need a utility that generates a windows help file automatically from
a type library, you might want to take a look at Oberon TLB Tools utility:
http://www.vakcer.com/oberon/products/tlbtools/
This utility includes 3 tools:
TLB2HLP - generates a complete WinHelp project containing .rtf, .cnt, .prj,
and other files ready to be compiled into a .hlp file. The .rtf file
contains help topics on each objects, method, properties, etc. with
descriptions, place holders for code samples, etc. A good start to create
full online help for a COM object model or ActiveX control properties.
TLB2HTML - creates an HTML file containing all type information from a type
library with cross-references, object index, and so on...
TLB Compare - compares two type libraries and writes differences as an HTML
file.
You can find examples of how each of the tools work on the web page given
above...
I hope this is helpful...
--
Alex
----
Do you still use a stopwatch to track your project time?
Why not try a completely automatic time tracking and billing
application for Windows - VAKCER Project Tracker v2.1?
Get your free trial copy today at http://www.vakcer.com
|
|
|
|
|
I am interesting in using Mr. Naughter CCPUTicker, but I want to use it as accurately as possible.
Is there a way to place a "lock," something like a semaphore, around a set of C++ instructions, and stop all other messages from being serviced during this time?
In other words, can I change
foo(a);
bar(b);
to
BEGIN(lock)
foo(a);
bar(b);
END(lock)
and know that foo and bar were executed sequentially? For CCPUTimer, this would allow me to time between to calls as accurately as possible.
Thanks,
Ryan
|
|
|
|
|
Remember that 32-bit Windows systems use preemptive multitasking. You can't ensure that your process is utilizing all CPU resources all the time.
You can of course ensure that other thread from your process is not called during foo and bar. Is your application multithreaded?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
No, I am not using a multithreaded application.
Would CWinThread::SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL) be the closest I could get to locking out the other processes? I realize windows is not a RTOS, but thought it might be possible to force a process to "utilize all CPU resources" for a short time.
-Ryan
|
|
|
|
|
Yeah, SetThreadPriority and SetPriorityClass will make your process real resource hog
If your app is singlethreaded, don't worry about message pump - it's running in the same thread. Just don't call PeekMessage/GetMessage manually inside foo and bar.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hmmm... I'm looking at Richter's Advanced Windows, chapter 4, and it looks like if you were to get really piggy you could SetPriorityClass for the process to REALTIME_PRIORITY_CLASS and SetThreadPriority to THREAD_PRIORITY_TIME_CRITICAL to give it a level of 31.
31 is the maximum. 31 is extreme. 31 will never yield. 31 can alter the fabric of the space time continuum as we know it.
Well, thats the impression I get anyway.
On NT you'll need the Increase Scheduling Priority privilege.
|
|
|
|
|
I have been programming C++ for about a year, and have learnt quite a lot. However, moving to Visual C++ has really created problems for me. I understand most things, I can deal with messages properly, interact with UI elements etc, but it still seems a long way off that I would be able to put together a complex application or game. How did you guys learn, and what is the best way for me to go from here?
|
|
|
|
|
designing software to implement is the vision thing ... it takes a bit longer to do architecture but keep plugging away and you'll get there
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I need to draw transparent rectangle (will have only BOUNDING LINES VISIBLE) above existing drawing. Rectangle will be drawn in real time by the user. No part of drawing underneath must be destroyed. Is there any smart way of how to save & restore overlaid parts of the existing drawing?
I am relatively new to GDI.
Thanks in advance.
|
|
|
|
|
Hold the two images in different bitmaps and merge them in OnPrepareDC or OnPaint direct to the screen.
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.
|
|
|
|
|
Thanks, I'll keep it in my mind. Any other ideas?
|
|
|
|
|
Use DrawFocusRect. Or set the ROP2 mode to R2_NOTXORPEN, brush to NULL_BRUSH and draw whatever you want. To remove drawn rectangle, repeat the steps - since you're XORing the pixels, second pass will restore them to initial values.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
If I draw black (black pen, black brush) rectangle with R2_NOTXORPEN, will it appear all black? Where are stored pixels of original drawing in this case? Where is stored this information? I must restore them from somewhere.
|
|
|
|