|
Hi,
This link below talks about how to build a MFC Activex control from the
popular MFC doc / view sample Scribble.
http://www.microsoft.com/mind/0497/mfc.htm
I wanted to enhance this to support multiple documents at the same time..So
I could add methods like ActivateDoc(index) to the control which would then
activate the correct window..I have been trying to do this with MDI Frames
and MDI Child Frames but I manage to keep my control crashing...
Then I was trying to not have my Frame Window derive from CMDIChildWnd but
just CFrameWnd, but keep a list of pointers as I do OpenDocumentFile() each
time...But how do I activate the correct frame?
Can somebody help me with what I am doing?
Eventually what I want to do with this is build an ActiveX control that is a
Active Document container ( like the Web browser control ) to open Office
Documents. I need to use this in a Vb app and I would have used the Web
browser control except that I can only have one Office document open then. i
need to have multiple docs open.
I have a long way to go I think...Some help will help me get there faster
( if at all I am in the correct direction)
Thanks in advance
Rajesh
|
|
|
|
|
How can I prevent SetWindowText triggering EN_CHANGE?
Code:
____________________________________________________
CEdit m_Edit1;
void CMyDlg::UpdateEdit1
{
m_Edit1.SetWindowText("BLABLA"); //This triggers EN_CHANGE
}
void CMyDlg::OnChangeEdit1() // EN_CHANGE message handler
{
UpdateEdit1();
}
|
|
|
|
|
some thoughts
first ... why are you doing the two events like that?
second ... if you must then either use UpdateData(FALSE) to set the edit control text
third ... you could use a flag in the en_change event to mask out things you don't want to fire
if it's special formatting you want to do there is probably a better way with one of the many edit box enhancements here on code project
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Flags solved the problem.
However if I had found a way to suppress EN_CHANGE message generation, my code would be more poetic.
|
|
|
|
|
i failed to display hex numbers with zeros in the left side.
i use FORMAT to change the numbers to the CString .
but the numbers with different lengths can not arranged in a column.
|
|
|
|
|
UINT uHex = 0x124AB;
CString str;
str.Format ( "%08X", uHex );
str is now "000124AB". The 0 before the 8 means to pad leading space with 0's.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
--Buffy
|
|
|
|
|
How do you tell how much memory a specific program is using?
|
|
|
|
|
use the process viewer app that ships with visual studio
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
I want to place some controlls on Rebar (Progress, etc.) and then i want
to manage these controlls.
Thanks.
|
|
|
|
|
i am designing a program.i need a lot of dialogs to recieve user's input.example: the first dialog is be displaied to get user's information,the second dialog or the third dialog would be display based the first dialog.
how can i do ? please tell me ,thanx
|
|
|
|
|
Why not use wizard style property sheet+pages!
Like the one used with the VC++ app wizard! If the user misses or leaves an important entry point blank, then they cannot proceed unless returned and filled it!
Good Luck!
" I love water, but hate to drown! "
-- Masoud Samimi
Website: www.geocities.com/samimi73
|
|
|
|
|
Masoud Samimi:
Thank you for your reply.I have used wizard and property page style
|
|
|
|
|
it sounds to me like your app might be a "do this then do this then do this then do this etc" type of app ... maybe thats not the way to write windows apps ... a redesign of the structure of the app flow might be in order
if it's just a part of the program that needs the sequential dialog boxes then try using either proprty pages or a wizard
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
What are some functions I could use to monitor how much memory is in use on my system or even how much memory each program is using so I could run through each program and add the total up myself.
|
|
|
|
|
I'm having trouble getting my CView window to act as a drop target. I've added the line:
m_pMainWnd->DragAcceptFiles(TRUE);
to my CMyApp::InitInstance() function and I've added a handler for the WM_DROPFILES message. However, the no drop cursor still comes up when I try to drag a file over the window. Does anyone know what I have to do?
Greg J. Hedlund
SuperStar
|
|
|
|
|
|
Hi All,
I'm Having trouble with this message "User breakpoint at 0x.." (some memory location) during the debugging of my project, even when i do not have any breakpoints in my project, and lands me between mysterious assembly code.
Does anyone understand what this message means???And if yes, then how to get rid of this??? This has been very aggravating for me for the last couple of days. It would not let me debug my actual program.
Any suggestions are welcome. Thanks for your time.
Sean
|
|
|
|
|
This is the message you get when the instruction pointer lands on an int 3. This is a single-step trap, or user breakpoint, which you can code in VC with _asm int 3; .
Typically, debug builds use padding to allow space for things to grow, enabling incremental linking and such. And what sort of data would they use for such 'padding'? You guessed it, int 3!
You may even not have stumbled into this kind of padding - I think there is code in some of the debug heap allocations that will force one of these. I'd suggest viewing the call stack <alt-f7> and seeing just how you got there.
Wish I could remember an example. Two things you might try are rebuild all and seeing if a release build has the same problem.
|
|
|
|
|
as far as i know when this happens to me it means that i've caused a memory access violation by writing over memory i haven't allocated or trying to free a null pointer before it is allocated to a block of memory
in release builds you get a system message and the app closes ... check your allocations and make sure you're not writing to more than you have allocated ... also check all your pointers are assigned to a valid memory block before accessing what they are supposed to point at
usually in the output window you get a "first chance exception" message generated too
have fun
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Hi Sean,
When writing code in VC++ you can manually insert DebugBreak()'s. This can be very useful at times for unexpected situations like MessageBox("Should not get here ") and other crap things.
However it sounds like you have one of these being included somewhere in your code. The most likely case is a debug library, if you are using supplied libraries and are including the debug version you should also include the .pdb and the source code. If you don't have these then either the DebugBreak was left in by accident and you should just use the Release version. There is a chance that it was put there on purpose so just to be sure you should bring up the CallStack window and look back to where your code ends (and the assembly starts) and verify your parameters.
If you don't have a Release build and can not arrange to get one then you can attempt to hack the binary. This is a LAST RESORT. You can open the lib in VS however you are going to have to locate the DebugBreak and replace those instructions with noops. But make sure you COPY the lib first!!
The other possible location is in included code. Sometimes VS needs to have the code added to the project before it automatically goes there. If you can navigate down your include tree and add all these things then you might get taken to the line of code. Then you can either fix the problem (what ever it is) or comment out the DebugBreak() and making a note to restore it later!
Jules
|
|
|
|
|
Thankyou everyone for the comments and suggestions.
After reading all of your comments, looking more carefully at my call stack and the situations when i hit this "User breakpoint..", I removed all the PostMessage() WINAPI function calls in my project and the "User Breakpoint..." problem is GONE. Maybe i was calling this function with bad Data.
It seems to me that the "User Breakpoints" are set in the Windows .lib or .dll files(ntdll, kernel32, user32 etc.) in the form of DebugBreak() statements. Am I Right???
But what i still do not understand is why are these DebugBreak() statements present in the Windows API? How can i look at the .lib or .dlls to find these DebugBreak() statements?
Thanks Again for your time.
|
|
|
|
|
Does anyone know how to actually see how much memory Win2k and all processes are using? I like task manager however when I add up the "Mem Usage" column it never equals the "Mem Usage:" in the Task Manager Status Bar. So my question again is, if Task Manager says in the Status Bar "Mem Usage: 135424K / 307728K" where can I go to see who's hogging the memory? I've played with pview.exe and it's ok but very cryptic. I know something in Win2k has a massive memory leak especially since installing MS.Net Beta 1. And I'm tired of rebooting to reclaim my memory. I've also tried utilities like MemTurbo2.0 but that just seems to take the ram it freed up and put's it in the swap file. Any help here would be nice.
|
|
|
|
|
i'm on thinnish ice here but my understanding of the task manager memory view only reflects static memory allocations for each of the apps it lists ... if an app allocs memory dynamically it won't show in that list all of the time ... if i got this wrong someone please correct me
also using a beta 1 of anything is guaranteed to have problems and memory leaks is one of the usual suspects ... specially considering the automatic garbage collection features that might just be as finely tuned as they could be at this release version
you should also check what apps you have running at startup and try not running each of them to see if the memory usage goes down drastically ... it might just be that some other company's software has bugs in it besides microsoft ... stranger things have happened
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Thanks for your response. I'd agree with you about beta 1 if I were only seeing the problem when or after I ran it. However that's not the case. The only other part of beta 1 that may be causing the problem is that it had some huge "windows component update". That my definitely be causing the problem. I've also looked at my startup apps etc and see no problems. so i guess by your response you dont know how to see how much memory is allocated and who is allocating it? That's what I want to drill down on. If i can see that it's some some m$ thing then i have to rebuild, if it's something else i can just uninstall. what's weird is it's unpredictable so far. when i boot i'm using around 95mb of ram, a little while later i'm up to 130mb, a while later i'm at 170mb and it's time to reboot.
|
|
|
|
|
Something to keep in mind is that the apps are not the only thing using memory. The OS itself uses memory.
If you look on the performance tab of the NT TaskManager, you'll see a few things that are important:
Physical Memory-> File Cache. This is the amount of physical memory allocated to file cache. This number is not included in the MemUseage because. Also, look at Kernel Memory. This is the memory being used by the kernel and all installed drivers. This must be included in your memory calculations.
For instance, on my system, total memory allocated is 73928K. Kernel memory is 29868, and the apps listed in TaskManager add up to 43168. Together, these numbers add up to a number very close to all memory allocated. The remaining memory is the memory below 1MB system area (which is still retained for compatibility reasons.
|
|
|
|