|
Hi.
How can I Toggle views?
I use SplitterWnd (2x1), and want to toggle view in pane(0,0).
I made button for toggle, andthen, using flag for setting current-view state.
But, can't redraw view.(because that's Split-window?)
Followings: in this I use 2x1 and 1x2 splitterwnd.
CRect rect;
GetClientRect(rect);
if(!m_wndSplitter1.CreateStatic(this,2,1))
return FALSE;
m_wndSplitter2.CreateStatic(&this->m_wndSplitter1, 1, 2, WS_CHILD | WS_VISIBLE, m_wndSplitter1.IdFromRowCol(1,0));
m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CDvMenu),CSize(rect.right,58),pContext);
m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CDvView),CSize(rect.right/2,rect.bottom),pContext);//pic viewer
if(flag != 0)//flag for current view state
m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CDvOpenGL),CSize(rect.right,rect.bottom),pContext);//opengl viewer
else
m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CDvView),CSize(rect.right,rect.bottom),pContext);//pic viewer
SetActiveView((CView*) m_wndSplitter2.GetPane(0,1));
return TRUE;
~~~
void CDvMenu::OnToggle()
{
// TODO: Add your control notification handler code here
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CDvDoc* pDoc = (CDvDoc *)pFrame->GetActiveDocument();
BOOL toggle = ((CMainFrame*)pFrame)->flag;
if(toggle)
((CMainFrame*)pFrame)->flag = 0;
else
((CMainFrame*)pFrame)->flag = 1;
-------------> Here, what should I do? plz, help.
}
|
|
|
|
|
You should call CFrameWnd::SetActiveView().
|
|
|
|
|
Hi.
I'm trying to write a program that would act like a banner. Here are the requirements:
. sit on a screen edge (top, bottom, left or right)
. restrict all other windows to the part of the screen not used by the banner
. run under Win98 and above
. should be written using Visual C++
I have no idea on how to limit the other programs to use the area of the screen not covered by the banner. Any help ?
thank you
Milonius
|
|
|
|
|
What you're thinking of is an app bar. Check out MSDN as there are a few pages on writing them. I've also seen articles in past MSDN magazines with MFC code for writing them too.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
My project needs to split a 20 page pdf file to 20 single page pdf files, I don't have any clue in doing it, could anyone help me in accomplish it, thanks in advance.
|
|
|
|
|
or: is it a bug?
We develop with .net 2003 & develop services.
Services run a long time, and occasionally crash.
We are having a heck of a time getting DrWatson to work for us. He was our friend, before we moved onto C++ .NET2003 but seems not to like us anymore.
Anyhow, we're clueless on the matter.
I'd like to know your strategy for dealing with an application that needs to be up and running all the time, and when it crashes we need to record it and restart it.
Anyhow, once we started to use .net/2003 we lost this. We never used the first .net either.
We need to automagically record dump files and be able to interpret later.
Help!
Thanks in advance.
P.S. Ship day in 2 days.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
|
|
Hi,
In this situation I would use the SetUnhandledExceptionFilter API to set up an exception filter and then within your exception filter function you can use MiniDumpWriteDump to write a dump of your problem service. You can then open the mdmp file up in VS.NET press F5 and you will be at the point where your program crashed.
Hope this helps
Ceri
|
|
|
|
|
Hey y'all....
Thanks for the info. We ended up going for the auto-minidump thingy. We like this since it doesn't matter whether DrWatson is installed....
Anyhow, thanks, 2 days to ship, and we've got one more weapon for finding crashes!
Thanks.
P.S. If you wanna beta test our stuff -- High-class audio/video/text/appsharing from a windows client -- come visit our beta site www.videomonkeys.com[^]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Does anyone know how to make this in assembler, you know using the asm partialy in the c++ file:
#include <iostream>
#include <iomanip>
#include <ctime>
using namespace std;
main()
{
int a = 1;
int b = a+1;
int c = b+1;
int d = c+1;
int e = d+1;
int f = e+1;
time_t start;
time_t end;
time(&start);
for (a=1;a <= 47;a++)
{
for (b=a+1;b <= 48;b++)
{
for (c=b+1;c <= 49;c++)
{
for (d=c+1;d <= 50;d++)
{
for (e=d+1;e <= 51;e++)
{
for (f=e+1;f <= 52;f++)
{
// cout << setw(8) << a << setw(8) << b << setw(8) << c << setw(8) << d << setw(8) << e << setw(8) << f <<endl;
}
}
}
}
}
}
time(&end);
system("cls");
cout << "started:" << ctime(&start);
cout << "ended:" << ctime(&end);
system("pause");
return 0;
}
I only need the looping in assembler.
NOTE: DON'T DO THIS IF YOU DON'T WANT TO!!!
OR IF YOU DON'T HAVE TIME!!!
Old United Airlines Brochure:
If you cannot read this please ask a superintendent to help you... LOL, for real!!!
|
|
|
|
|
Why Assembler?
The performance problem is the endl. They are very slow since they also flush the IO stream.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I just want to know how much faster is assembler.
Old United Airlines Brochure:
If you cannot read this please ask a superintendent to help you... LOL, for real!!!
|
|
|
|
|
Due to the i/o, any performance increase in assembler will be negligable. For simply logic like you're doing, a performance increase is unlikely. It may actually be slower due to lack of pipeline optimization.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Well, doing the looping in assembler isn't that hard, and here's a tip: to see how to do new things in assembler, just write what you want in C++, run it in the debugger with a breakpoint on the first line, right-click and select "View Disassembly". Then you can see what the compiler does. But anyways, here's how to do a basic loop in inline assembler (x86):
int main( int argc, char * argv[] )
{
int i = 0;
int j = 1;
__asm
{
mov i, 0
loopstart:
cmp i, 5
jge loopend
mov eax, [dword ptr j]
imul eax, 2
mov [dword ptr j], eax
inc i
jmp loopstart
loopend:
}
return 0;
}
Anyways, the other guys are probably right. Don't try to optimize what you don't need to, but if you are just curious about assmebly, then by all means keep learning. I just wanted to actually answer your question.
Chris Richardson
|
|
|
|
|
Thankyou very much, I wanted to see which one would be faster just for fun since I never got to learning assembler and would just see if I would have missed anything but I guess not, I just wanted to see for real if assembler was as fast as it was supposed to, thankyou for taking the time to answer the question. :p
Old United Airlines Brochure:
If you cannot read this please ask a superintendent to help you... LOL, for real!!!
|
|
|
|
|
Snyp wrote:
I just wanted to see for real if assembler was as fast as it was supposed to, thankyou for taking the time to answer the question
The endl is certainly the problem, as has been said. I just wanted to add that ALL code is assembler, it just gets generated by the compiler. So it's only faster when a human can write assembler better than the compiler can.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
How can you make a start up program?? I just don't know where to start...
Old United Airlines Brochure:
If you cannot read this please ask a superintendent to help you... LOL, for real!!!
|
|
|
|
|
Hmm..
I can't really understand what you mean. If you want to create a program that runs automatically at start-up, you just build the program and add it's shorcut to the 'Startup' folder of your Start->Programs.
Alternatively you can write a registry entry to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run. See the example entries in that key and create a new key for your program.
If you are planning to create a Win32 service, which starts on an NT/2k/XP (or networked 98/Me) machine before the user logs in, then I can point you to a starting location. The easiest way is to follow the guidelines of Xiangyang Liu's article Start Your Windows Programs From An NT Service[^]
Otherwise, you might want to look up other articles in the MFC/C++->System->Services section of CodeProject.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
No I'm trying to make a startup manager program. You know a program to manage which program starts up and which doesn't, I know you do this through the registry though and the startup folder in the main menu.
Old United Airlines Brochure:
If you cannot read this please ask a superintendent to help you... LOL, for real!!!
|
|
|
|
|
Ahh, ok..
Following the same ideology: create a program that accesses the registry, reads and alters the values of the key mentioned in my previous post.
To utilize the registry, you can either use Platform SDK's registry functions (Search 'Registry Functions' from MSDN), or alternatively, use ATL and it's CRegKey class.
You don't need to fiddle with the StartUp folder if you use the registry entries. Remember that doing this may cause your program to function funnily, so always take a backup of your registry before using the registry functions
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
i wanna get the first sector of hard disk ? which function can i use to appoarch this.
thanks.
|
|
|
|
|
Check out CPhysicalDiskFile, part of the Win32 Foundation Class (WFC). See links below.
www.samblackburn.com/wfc/CPhysicalDiskFile.htm
www.samblackburn.com/wfc/
Mike
|
|
|
|
|
i wanna create 100 buttons in dialog with code and when clicking one button, it will display a message with the content is the id of the button.
help me please
|
|
|
|
|
can you please explain a bit furthur...
Old United Airlines Brochure:
If you cannot read this please ask a superintendent to help you... LOL, for real!!!
|
|
|
|