|
Check CYourApp::InitInstance. You should see at least one call to AddDocTemplate. What's the 3rd parameter?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Eeeessshh....
Ok your gonna hate me for this.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_MYDOCTYPE,
RUNTIME_CLASS(CCoMagTestDoc),
RUNTIME_CLASS(CMDIChildWnd),
RUNTIME_CLASS(CCoMagTestView));
AddDocTemplate(pDocTemplate);
This is the a DocTemplate that I added so I could turn my lowly SDI program into an MDI program with a preprocessor definition _MDI. This way it's my choice to make it SDI ro MDI. That obviously is why I don't have a ChildFrame class like the way NORMAL MDI programs do.
So you think maybe I should add a new class entirely?
Thanks,
NickOne
|
|
|
|
|
CMDIChildWnd is an MFC class. You should derive new class from CMDIChildWnd and customize its behavior (by adding WM_CLOSE handler, for example). Then, replace RUNTIME_CLASS(CMDIChildWnd) with RUNTIME_CLASS(CYourMDIChildWnd).
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Sweeeeeeeeeeeeet!!!
Ok this I can definately do. But just to be sure I am going to do this:
1) Add a new class on the File View. Then create a new MFC class that has a base class of CMDIChildWnd.
2) Add all the fun stuff I want to it, since now I will be able to do see the options like WM_CLOSE.
3) Switch the RUNTIME statements the way you said.
Thanks a whole bunch, you have been really helpful!
NickOne
~Yeah! We gon' rock it 'til the wheels fall off~
|
|
|
|
|
NickOne wrote:
1) Add a new class on the File View.
I'm not sure what do you mean by this. In VC6 there's 'New class...' option under 'Insert' menu. There should be some equivalent functionality in VC.NET.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Dear Sir,
I would like to request your help and guidance in the following matter. I have seen one interesting thing while I was trying to delete a file on my 100MB Iomega Zip drive. Instead of regular windows message box saying "Are you sure you want to send "xyz.doc" file to Recycle Bin", it shows Iomega's own message. This gave one good idea . If we can add this behavior to the file operations like open ,delete,move, then we can show our dialog boxes which may contain some password mechanism which user tries to open a file. Of course , password protected document ".doc" files have the facility, but if we can extend this facility to some our important files. Isn't it?. Does shell function like SHFileoperation() come to rescue?.
Kindly let me know if you have any idea.
regards,
T.S.V.R.NAGESWARA RAO,
teli_sha2002@yahoo.co.in
Hydearabad, India
|
|
|
|
|
I can't be certain, but I'm pretty sure that the message box you got was built into the driver software for the zip drive, meaning if you wanted to do similar things on normal drives, you'd have to do it at the driver level.
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Have anybody try to instantiate array of MFC controls? Can u let me know how you do handle the messages to appropiate control ( like passing index of the control). I have tried in Visual Basic before and easily been done. But I have never try to use in Visual C++ and I don't know how. Thx a lot!
NB : The most confusing thing for me is the messaging
|
|
|
|
|
I'm working a lot with arrays of Ctrls:
lets say you have a Ctrl "CHoverButton", then I use the following lines:
CHoverButton *hover[20];
for(...)
hover[i] = new CHoverButton;
hover[i].Create(....,PREDEFINED_ID+i)
with PREDEFINED ID I mean you define some ID's in advance for the Buttons you'll create.
in the class CHoverButton add Handler for WM_LEFTBUTTONUP.
then you add to this handler a
GetParent->SendMessage(WM_YOURCUSTOMMESSAGE,MAKEWPARAM(GetDlgCtrlID(),0),0);
and in the dialog where your controls is positioned a handler for WM_YOURCUSTOMMESSAGE. WM_YOURCUSTOMMESSAGE is just a new Resource-Symbol you have created.
Then add a handler for WM_YOURCUSTOMMESSAGE in your dialog by putting the following lines:
ON_MESSAGE(WM_YOURCUSTOMMESSAGE,Handlecustom(WPARAM w, LPARAM l) (Message Map!)
in the .h file:
afxmsg void Handlecustom(WPARAM w, LPARAM l)
and in the .cpp file:
void DlgClass::Handlecustom(WPARAM w,LPARAM l)
{
switch(w)
case ID_BUTTON1: do something
} and so on
you can also send something else to the parent window - I use the DlgCtrlId because it's then easy to modify the control by using
GetDlgItem(ID)->dosomething()
hope this helps you
silver
I don't want achieve immortality through my work - I want achieve it through not dying - Woody Allen
|
|
|
|
|
You may have a look at ON_CONTROL_RANGE and ON_COMMAND_RANGE macros.
Best regards,
Alexandru Savescu
|
|
|
|
|
can i use both modeless and modal dialogs in a dialog based appication in VC++?
kalyan
|
|
|
|
|
yes, of course. there is nothing about an application type that determines the kinds of dialogs you can use.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Where can I get help html creation program at?
|
|
|
|
|
http://www.microsoft.com
in search type in " html help workshop"
then download the it and install it.. after that
1) open html help workshop program
2) create a new project. which will create yourhtml.hhp and yourhtml.chm
3) write your html pages.....
4) use shellexecute to call yourhtml.chm
hope it helps.
|
|
|
|
|
Theres no onInitialUpdate sort of function in the doc class. SO where does one initialize doc variables? I am thinking I'll do it in a view class through the doc pointer, but surely it can be directly??
Thanks,
ns
|
|
|
|
|
Inside OnOpenDocument() and/or OnNewDocument() . These get called when the document is opened or created. Similarly, document cleanup should occur in DeleteContents() .
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If you have MDI app, put the init code in the constructor. SDI reuses CDocument-derived object, so you have to override OnNewDocument/OnOpenDocument/DeleteContents.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks very much for the ideas. According to MSDN,
"CDocument::OnNewDocument. This method is called by the framework as part of the File New command."
SInce in my MDI app, there is no File/New button or menu item by design, I did not know if I could use it. I like the constructor idea so I think I'll use it since thats always guaranteed to run in MDI. I just dont know if OnNewDocument is called automatically, or only when the user presses File/New.
about this.
Thank you for the replies.
ns
|
|
|
|
|
How to put the desktop into a device-context ??
|
|
|
|
|
Try PaintDestkop function. However, it will not work with memory DCs on 2K/XP.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Well , i need it to w2k and above .. why it will not work ? any other ideas? thanx
|
|
|
|
|
adara wrote:
why it will not work ?
I have no idea. It works on 2K/XP when you pass client (not memory) DC to PaintDesktop. Maybe they've decided that this will be some security hole
You may try GetDesktopWindow and WM_PRINT instead.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Straight from the SDK sample Switcher:
if (hdc = CreateDC (TEXT("DISPLAY"), NULL, NULL, NULL))
{
int xSize = GetSystemMetrics(SM_CXSCREEN);
int ySize = GetSystemMetrics(SM_CYSCREEN);
StretchBlt(memDC, 0, 0, destW, destH,
hdc, 0, 0, xSize, ySize, SRCCOPY);
DeleteDC(hdc);
}
|
|
|
|
|
Hi all!
Does anyone know if there is a way to override the default project settings in VC.NET or VC60?
By this I don't mean the manual tackling with Project/Settings dialog. To make myself clear I'll give a little example: When you create a new Win32 project, it defaults to use single-threaded run-time libraries, but almost all my projects are multi-threaded. So, after creating the project, I *always* have to go to Project/Settings dialog and make appropriate adjustments. It would be nice to be able to override these default settings for good, so every new project will be automatically set to use multi-threaded run-time libraries.
I tried to automate this task using IDE VB macros in VC60 but I didn't succeed.
Thanks for any help
Pankaj
Without struggle, there is no progress
|
|
|
|
|
This maybe lame help... but I think you may want a 'custom application wizard'... or something like that. I have not done this yet... but I really should.
|
|
|
|