|
you need to handle ON_UPDATE_COMMAND_UI.
|
|
|
|
|
m_YourTB.EnableButton(ID_LINK_BUTTON, TRUE);
Regards,
Paresh.
|
|
|
|
|
When I call SetNewView, it's ok ,and the new formview (A) can receive message. But then I press a button in the view, and it called SetNewView to change to another formview (B), it looks ok, but B can't receive its messages, instead A receives, also, A's buttons will appear when I click on that area.
Here is how to do with CViews instead of CFormViews
http://msdn2.microsoft.com/en-us/library/s199bks0(VS.80).aspx#vcconswitchingfunctiona4[^]
BOOL CMyAlbumEditorApp::InitInstance()
{
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings();
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyAlbumEditorDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMyAlbumEditorView));
AddDocTemplate(pDocTemplate);
EnableShellOpen();
RegisterShellFileTypes(TRUE);
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
InitViews();
SetNewView(m_pStartView);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
void CMyAlbumEditorApp::InitViews()
{
m_pNativeView = ((CFrameWnd*)m_pMainWnd)->GetActiveView();
CDocument* pCurrentDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument();
CCreateContext newContext;
UINT viewID;
CRect rect(0, 0, 0, 0);
m_pStartView = (CView*) new CStartForm;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
viewID = AFX_IDW_PANE_FIRST;
m_pStartView->Create(NULL, "StartFormViewName", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
m_pStartView->SendMessage(WM_INITIALUPDATE, 0, 0);
m_pAlbumPropertyView = (CView*) new CAlbumPropertyForm;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
viewID = AFX_IDW_PANE_FIRST;
m_pAlbumPropertyView->Create(NULL, "AlbumPropertyFormViewName", WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
m_pAlbumPropertyView->SendMessage(WM_INITIALUPDATE, 0, 0);
}
void CMyAlbumEditorApp::SetNewView(CView *pNV)
{
#ifndef _WIN32
::SetWindowWord(m_pNativeView->m_hWnd, GWW_ID, ::GetWindowWord(pNV->m_hWnd, GWW_ID));
#else
::SetWindowLong(m_pNativeView->m_hWnd, GWL_ID, ::GetWindowLong(pNV->m_hWnd, GWL_ID));
#endif
((CFrameWnd*) m_pMainWnd)->SetActiveView(pNV);
((CFrameWnd*) m_pMainWnd)->RecalcLayout();
pNV->ShowWindow(SW_SHOW);
}
modified on Tuesday, December 04, 2007 9:25:01 AM
|
|
|
|
|
If the area is cover by the previous formview, then messages in that area is handled by the previous formview, otherwise, it receives the message.
How strange! Why?
|
|
|
|
|
All CFormViews have the same ID, does it cause the problem?
viewID = AFX_IDW_PANE_FIRST
But if I change them to value other than AFX_IDW_PANE_FIRST, the view is even not changed.
How to do?
|
|
|
|
|
Mr followait,
you've been on this forum long enough to know the posting rules here.
1) when you post a code sample, you must use <pre></pre> tags rather than <code></code> .
2) you must post a relevant piece of code, NOT a whole huge file.
3) you're aware already of the Edit link at the bottom of your messages. instead of reposting a new message, edit the first ones.
4) don't just ask people "what's wrong". it's YOUR code, so YOU have to search what's wrong. at least, you have to prove that you tried it, by providing your debugging steps and the results, problems you encountered then.
|
|
|
|
|
1) ok
2) In fact, I had thought before post the piece of code, the context is needed, and it is only the framework, it is easy to read
3) ok, I just don't want people who had read the long message to search again for what I edited. next time, I'll be care
4) I've tried. I will add a line "with a CView, it works".
|
|
|
|
|
2) He didn't say it was difficult. He said it as a lot. You can try to find out which lines are giving the problem and comment a bit what is done before them, put the relevant code and put a comment with what you are trying to make.
3) When you edit a message it comes an auto "modified on .... at .... am/pm" so if u are adding you can put it below that line, if not you can always say "EDIT: I have changed...."
About your question of the Resource ID it has nothing to do. I have a programm with 1 main view (scroll view) and up to 63 secondary views derived from 5 different CFormViews (so the repettion index is 24x, 12x, 12x, 12x, 2x, 1x) and I dont change the resource name of the CFormView at all.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi,
I need to develop an editor, which need to support auto completion(like intellisense). Can any of you, suggest me which one is better to take up for implementation of intellisense in VC++,C#.
Any suggestions will be appreciated.
sree
|
|
|
|
|
I'm certain there is at least one article on CP about that.
and I'm also certain someone else suggested having a look at Scintilla[^].
|
|
|
|
|
How to copy a file from pocket PC to destktop PC.I want to get the best method.Please help me.Thank you!The follow is my code,but I need the better measure.Which fuction can do it?
CString strFileNamePC=_T("d:\\nini.txt");
CString strFileNamePPC=_T("\\nini.txt");
CFile oldFile;
oldFile.Open(strFileNamePC, CFile::modeWrite|CFile::modeCreate|CFile::typeBinary);
BSTR bstr = strFileNamePPC.AllocSysString();
SysFreeString(bstr);
CeRapiInit();
HANDLE h;
h = CeCreateFile(bstr, GENERIC_READ, 0/*cannot be shared*/, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
char cTemp[BUFFER_SIZE];
DWORD nbytes;
CString s;
int iTotBytes = 0;
DWORD n=CeGetFileSize(h,NULL);
if(h!=INVALID_HANDLE_VALUE)
{
AfxMessageBox("??");
while(CeReadFile(h, cTemp, (DWORD)n, &nbytes, NULL)&&nbytes>=1)
{
//if(nbytes>=1)
oldFile.Write(cTemp,n);
}
}
CeCloseHandle(h);
oldFile.Close();
CeRapiUninit();
Yunasheng Ni
|
|
|
|
|
I Want to work with word 2003,2007 in my mfc app .what file do i need?
i need to include msword.h but mfc i dont find msword.h
|
|
|
|
|
have you installed the Office SDK ?
|
|
|
|
|
|
|
But there isn't any Office word or something like that...
The Only thing is Word 2003 XML sdk
|
|
|
|
|
|
Can you send sdk link download for me?
thank you...
|
|
|
|
|
can you send office sdk download link ?
|
|
|
|
|
javad_2005 wrote: ...i dont find msword.h
If you have added Word to your application via its type library, you will see the .h and .cpp files as part of the project.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
tools/options/Project and Solution
VC++ Directories
[Include files]
[Library files]
Could somebody tell me where is the setting file?
|
|
|
|
|
in the solution (.sln) i believe.
i don't remember, but you can simply edit it, it's just XML inside.
if it's not there, maybe it's in the project files...
|
|
|
|
|
This info isn't attached to each solution since it's an app-wide setting.
Search for VCComponents.dat in your system application data folders
(for example, on my Vista machine, it's at C:\Users\Mark\AppData\Local\Microsoft\VisualStudio\9.0).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
pAdCn is an object of CADOConnection.
CADOConnection::CADOConnection ()
{
m_Con.CreateInstance("ADODB.Connection");
m_cmmd.CreateInstance("ADODB.Command");
}
void CADOConnection::vdTest ()
{
m_cmmd->CommandText=_bstr_t(_T("BB"));
m_cmmd->Parameters->Refresh();
m_cmmd->Parameters->Item[_variant_t (_bstr_t ("aaa"))]->Value=_variant_t ("aaa");
m_cmmd->Execute (NULL, NULL, adCmdStoredProc);
}
void CADOConnection::vdTest ()
{
m_cmmd->CommandText=_bstr_t(_T("BB"));
m_cmmd->Parameters->Refresh();
m_cmmd->Parameters->Item[_variant_t (_bstr_t ("aaa"))]->Value=_variant_t ("aaa");
m_cmmd->Execute (NULL, NULL, adCmdStoredProc);
}
i create a thread:
UINT pRunThread (void * p)
{
if (pAdCn->Open ("xxxxx")) //has connected!!
while (1)
{
pAdCn->test (); // why the memory is rising unstop. about 4k every 2 or 3 minutes. i am very hurry. thanks
Sleep (5000);
}
return 0;
}
godsun
|
|
|
|
|
I have class called 'CWizardSheet'
I want to access it's members in class say 'CWizardPreview'
So I included the file as "WizardSheet.h" in file 'WizardPreview.h'
and I am creating member variable as pointer as
CWizardSheet *ptrWizard;
So it gives error as
error C2143: syntax error : missing ';' before '*'
error C2501: 'CWizardSheet' : missing storage-class or type specifiers
error C2501: 'pWizardSheet' : missing storage-class or type specifiers
i have checked semicolan also
please help me to solve this error...
|
|
|
|
|