|
I want to migrate a MFC doc/view application to an activex control. I create the CMainFrame(inherited from CMDIFrameWnd) object when the activeX control is Created. but when i open a document, access violation occured in user.dll and no source code. i found the error is from CMDIChildFrame::OnSize. the following is my code :
BOOL CMultiDocOCXCtrl::CreateMDIFrame()
{
if(m_pFrameWnd != NULL)
return FALSE;
CRect rc;
GetClientRect(&rc);
CMultiDocTemplate* pDocTemplate = new CMultiDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDocument),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyView));
AfxGetApp()->AddDocTemplate(pDocTemplate);
//
CString sClassName = AfxRegisterWndClass(CS_DBLCLKS);
CMainFrame * pFrame = new CMainFrame;
if(!pFrame->Create(sClassName, NULL, WS_CHILD|WS_VISIBLE, rc, this,
MAKEINTRESOURCE(IDR_MAINFRAME), 0, NULL))
{
delete pFrame;
return FALSE;
}
pFrame->ShowWindow(SW_SHOW);
pFrame->RecalcLayout();
//
m_pFrameWnd = pFrame;
//
AfxGetApp()->m_pMainWnd = m_pFrameWnd;
theApp.OnNewFile();
//
return TRUE;
}
Is anybody know how this problem occur?
c++ : my dream
|
|
|
|
|
hi, guys
Is there any functions in Visual C++ which have the same function like DoEvents in VB or doEvents in Java?
I have to make the program get response to a windows message when it is running in a infinite loop.
Is there any fuction can achieve this?
thank u very much in advance!
|
|
|
|
|
Create a secondary (worker) thread and run the infinite loop in there.
|
|
|
|
|
The following implemented VB DoEvents function:
<br />
BOOL DoEvents()<br />
{<br />
static MSG msg;<br />
while (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) {<br />
if (!AfxGetApp()->PumpMessage()) {<br />
::PostQuitMessage(0);<br />
return FALSE;<br />
} <br />
}<br />
return TRUE;<br />
}<br />
|
|
|
|
|
I am writing a software about tape backup.When u write the data into the tape, u can use the file mark to partiton the file.
But I don't understand the file mark.Who can tell me what the long file mark and short file mark are?How can I use them?
|
|
|
|
|
From MSDN:
A short filemark contains a short erase gap that cannot be overwritten unless the write operation is performed from the beginning of the partition or from an earlier long filemark.
A long filemark contains a long erase gap that allows an application to position the tape at the beginning of the filemark and to overwrite the filemark and the erase gap.
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
And I also read these information.I have uesd the file mark to realize the R/W code of the tape backup.I use the file mark to do it.Now I want to know the advantage of the long file mark and the short file mark.Then how to use them.I can use the file mark to realize the function.If I use the long file mark and the short file mark,what benefit can I get?Thanks!
|
|
|
|
|
I'm thinking that the long filemark would enable you to append to a file without rewriting the entire partition, while the short one will require you to rewrite everything. This would be handy if the files you are backing up grow over time, but rarely change existing information. I know I'm reading a lot into a few descriptive lines here, since I've never worked with this function before, but it seems to me that the short filemark would be used for a full backup, and the long one for incremental backups.
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
Hi,
I am using CFtpConnection class to deal with FTP server.
I am able to Get file from and Put file into the Root Directory.
Now, I want to access the sub-Directory under Root Directory for that I m using FtpConnection::SetCurrentDirectory() function but it always return FALSE.
I have tried out to use the CFtpConnection::Command() function , but that is not supported by my VC++ 6.0 version. Why this is so, Does any one know?
Below is my code snippet:
CInternetSession sess(_T("MyProgram/1.0"));
CFtpConnection* pConnect = NULL;
pConnect = sess.GetFtpConnection(_T("ftp.corsoft.com","UNIVERSE\UserName","Password",21));
BOOL ret = pConnect->SetCurrentDirectory("/kothi/cc/");
Please give me appropriate solution or Is there any other alternative to set the Current Directory.
|
|
|
|
|
A couple of thoughts occur to me, though I haven't tried using this function...
The documentation isn't clear whether the leading / in "/kothi/cc/" is required, or forbidden - it's possible that the current directory to which this would be appended may already include that character. Instead of using a relative path you might want to try using GetCurrentDirectory() first, then appending your target information to it and calling SetCurrentDirectory with the absolute path. Failing that, use GetLastError to find out what is going wrong. It may be that the target server doesn't have the correct permissions set on the subdirectories, too. Not all servers default to inherited permissions from parent directories.
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
Help, anyone...I need to know the syntax to search for all files that start with any 10 characters and have a DLL extension. I know the *.dll but what do I put for the 10 characters?????????
Thanks in advance
|
|
|
|
|
|
thank you very much....that was what I thought
|
|
|
|
|
Hi there,
I wish to read a character from an input file one at a time, then process the character and finally write the processed character back to the place where it is initially read from (ie from the same input file, and same location in the file).....
how can i do that (preferably with not much too advance command as I am only a beginner )
Thanks very much...
|
|
|
|
|
|
if you use CFile Class, try CFile::Seek(-1,CFile::current)
|
|
|
|
|
Hello,
I'm new to MFC. I'm having 2 document type. Is there a way to have them both created when a user press file new, without that dialog asking which type the user want?
Thanks
|
|
|
|
|
Handle the OnFileNew() function with the code:
[firstDocTemplateName].OpenDocumentFile(NULL);
[secondDocTemplateName].OpenDocumentFile(NULL);
That should also stop the dialog from coming up.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
|
Using the Forms of Visual C++, I have designed
the appearance of an application
having menus, buttons, progression, etc.
I would like to put on this interface
three sizeable windows. In each window
a thread will display a .avi file.
How should I proceed?
Thanks for any advice.
Dr. Pastor.
|
|
|
|
|
Hello,
this might be simple, but i haven't found how to do it. I've got to disable a menu item from the ***View.cpp of my mfc app.
i don't know how to use EnableMenuItem as i don't have the variable for the menu around. I have the ids of the menu options in resource.h, that's all i know.
I don't know how to use ON_UPDATE_COMMAND_UI. I think that's the way to go, but i've read about it and didn't understand what it was about. Anybody would care to explain or link me to a nice place to find about how it works and how to use it? your help will be really appreciated
thanks!!
|
|
|
|
|
|
Try:
CWnd *pWnd;
pWnd = (CWnd*)GetDlgItem(YOUR_RESOURCE_ID);
pWnd->EnableWindow(FALSE); //or TRUE
ON_UPDATE_COMMAND_UI works on itself. eg.:
void CYourClass::OnUpdateYourMenuItem(CCmdUI* pCmdUI){
pCmdUI->Enable(NAME_OF_BOOL);
}
then you can set your NAME_OF_BOOL to true or false and (in my app) it magically works
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
thanks for the tips V.
they really helped!!
|
|
|
|
|
I must urgently develop a listener which will catch tooltips (or focus) and will return their text/information to me. The thing I want to do is to get the text and use it to identify where my current tab/mouse/focus stands. Using MFC but any application sample/code/suggestion is acceptable. Thanx in advance.
|
|
|
|