|
I have a dialog box, not a doc/view architecture.
|
|
|
|
|
This solution isn't dependent on doc/view. If you want to add MRU to dialog box, use simply CYourDialog instead of CMainFrame
Robert-Antonio
"Love without sex is like a fish without antlers"
|
|
|
|
|
Thanks a lot.It works.But I have another problem.
When I open the first file from MRU menu it works,but if i want to open the rest of 4 files I get an assert:appui.cpp line 130,ASSERT(m_pRecentFileList != NULL);
But I don't have anything with BOOL CWinApp::OnOpenRecentFile(UINT nID).
I did my own function.
void CMyRtfDlg::OnFileMruFile1()
{
OnOpenRecentFile(ID_FILE_MRU_FILE1);
}
// added on 22 Apr 2004
void CMyRtfDlg::OnUpdateFileMruFile1(CCmdUI* pCmdUI)
{
m_pMRU->UpdateMenu(pCmdUI);
}
// @added on 22 Apr 2004 from appui.cpp
// @for MRU
BOOL CMyRtfDlg::OnOpenRecentFile(UINT nID)
{
ASSERT(m_pMRU!= NULL);
ASSERT(nID >= ID_FILE_MRU_FILE1);
ASSERT(nID < ID_FILE_MRU_FILE1 + (UINT)m_pMRU->GetSize());
int nIndex = nID - ID_FILE_MRU_FILE1;
ASSERT((*m_pMRU)[nIndex].GetLength() != 0);
TRACE2("MRU: open file (%d) '%s'.\n", (nIndex) + 1,
(LPCTSTR)(*m_pMRU)[nIndex]);
OnFileOpen((*m_pMRU)[nIndex]);
return TRUE;
}
|
|
|
|
|
Hi,
I am parsing serveral avi files and displaying the data frame by frame in
a CListCtrl. I am using the Replace function to replace each consecutive image.
How can I speed this operation up? Most of the time is spent copying the data into the
ListCtrl and the internal BitBlt which it is doing.
Regards,
|
|
|
|
|
Hi
In my aplication I am using a thread that waits for processes to signal their kernel objects while exiting.
I want to add the objects in the wait aray in WaitForMultipleObjects in run time dynamically.
Currently I am using the poor design that I kill the wait thread, update the array and start new thread again
Any good or better suggestion.
Rajeev
|
|
|
|
|
Cant you allocate the array using calloc and reallocating it at need using realloc while updating the count?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You can insert a Manual Event (probably at the beginning of the signal array. Then signal
this event to stop the Wait. Detect that it was your "Ahem, I want to change things" event,
rebuild the array, and loop back to the wait....?
Something like...
Rebuild_Event_Array ();
while (1)
{
dwWait = WaitForMulti (pSyncObjects, nSyncObjects, INFINITE);
if (dwWait == WAIT_OBJECT_0)
{
Rebuild_Event_Array ();
}
else if (dwWait > WAIT_OBJECT_0 && dwWait < (WAIT_OBJECT_0 + nSyncObject) )
Dispatch_Custom_Event ();
else
{
HandleError ();
break;
}
}
etc.
where Rebuild_Event_Array () puts together an array with your Rebuild event at
the beginning.
Iain.
|
|
|
|
|
I'm haveing a lot of weird problems with a new app. I tried to create CComboBox controls and was able to add strings which I could cycle through with the arrow keys. However clicking on the arrow on the right of the box would not drop down the list so I switched to a list box. It works but for some strange reason, calling the ResetContent() method doesn't clear the items in the list box. Oddly, calling the GetCount() method shows the correct value before (n=3 or something.) and after (n = 0). The result is a list box with duplicate entries in the list box.
The code snippet is below.
Something I'm doing wrong?
{
// populate the databases ListBox
vector <cstring *=""> v;
vector <cstring *="">::iterator i;
n = _mlbDBListBox.GetCount();
_mlbDBListBox.ResetContent();
n = _mlbDBListBox.GetCount();
v = _myDBBrowser->GetDBs();
for (i = v.begin(); i != v.end(); i++)
_mlbDBListBox.AddString((*i)->GetString());
_mlbDBListBox.SetCurSel(0);
}
Using Visual Studio .Net 2002 (VC++ 7.0)
|
|
|
|
|
Are you sure that the vector does not contain the duplicates?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes, I thought about a corrupted vector or a problem with the vector iterator but I got the same behavior even when I added strings by hand i.e. _m.AddString("One") _m.AddString("Two"), etc.
|
|
|
|
|
So by simply calling AddString() once, two entries are added to the listbox?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry, I was confusing the CComboBox/ListBox behavior. The list box worked correctly when initially loaded with strings, either by hand or from the vector. When I tried to refresh the data in the list box, I called the ResetContent method of the list box. It returned values that indicated all the items had been deleted. The I added new items but it then displays two sets of items.
|
|
|
|
|
Very strange. Can you create a new dialog-based application that mimicks this behavior? Trying to scale the problem down to just a few relevant lines of code is sometimes very helpful.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Got it worked out. Weird. I was creating controls at work on an XP machine. Carried it home to my 2000 machine and the controls were all created correctly except that they had zero sizes. Once I went in and "resized" them with the InterfaceBuilder everything was fine.
Thanks
|
|
|
|
|
Dear all,
I writting an application using MFC.
Now I need to access to the View object from the App class.
Could you please tell me how.
Thanks a lot in advance.
-Kien Bui
|
|
|
|
|
In SDI app: ((CFrameWnd*)AfxGetMainWnd())->GetActiveView()
In MDI app: ((CMDIFrameWnd*)AfxGetMainWnd())->GetActiveFrame()->GetActiveView()
Robert-Antonio
"Love without sex is like a fish without antlers"
|
|
|
|
|
Thank you very much!
-Kien Bui
|
|
|
|
|
How to get 'IRowsetFind' interface in oledb sdk !
dear all:
i will use following code in my program(C++) :
discover 'pICommandProperties->SetProperties(1,rgInitPropSet);' return failed code 'DB_S_ERRORSOCCURRED'
so 'pIRowset->QueryInterface(IID_IRowsetFind,(void **)&pIRowsetFind);' return failed!
dear all, please help me! how to get 'IRowsetFind' interface in oledb sdk , and how to use 'IRowsetFind->FindNextRow()'
InitProperties[0].dwPropertyID=DBPROP_IRowsetScroll;
InitProperties[0].dwOptions=DBPROPOPTIONS_REQUIRED;
InitProperties[0].dwStatus=DBPROPSTATUS_OK;
InitProperties[0].colid=DB_NULLID;
InitProperties[0].vValue.vt=VT_BOOL;
InitProperties[0].vValue.lVal=VARIANT_TRUE;
InitProperties[1].dwPropertyID=DBPROP_IRowsetFind;
InitProperties[1].dwOptions=DBPROPOPTIONS_REQUIRED;
InitProperties[1].dwStatus=DBPROPSTATUS_OK;
InitProperties[1].colid=DB_NULLID;
InitProperties[1].vValue.vt=VT_BOOL;
InitProperties[1].vValue.lVal=VARIANT_TRUE;
rgInitPropSet[0].cProperties=2;
rgInitPropSet[0].guidPropertySet=DBPROPSET_ROWSET;
rgInitPropSet[0].rgProperties=InitProperties;
hr=pICommandText->QueryInterface(IID_ICommandProperties,(void **)&pICommandProperties);
hr=pICommandProperties->SetProperties(1,rgInitPropSet);
if (DB_S_ERRORSOCCURRED==pICommandProperties->SetProperties(1,rgInitPropSet))
cout<< "test";
if(FAILED(hr))
{
cout<< "OLEDB Error !\r\nExecute Failed To Set Rowset Properties";
}
hr = pIRowset->QueryInterface(IID_IRowsetFind,(void **)&pIRowsetFind);
if(FAILED(hr))
{
cout << "Failed to get IID_IRowsetFind interface.\n";
cout << endl;
} //end if
Laker
|
|
|
|
|
Hi guys
I'm having troubles with resources in w98 and one of the questions is the following.
I'm using a resource meter to know the GDI resources available, and when I open a CDialog with a lot of controls (>100), the resources go down and when I close it the resources don't raise again until I close the app.
Is this normal? If not, what can be the cause?
I'm using a lot of CLabel controls (derivesd from CStatic controls classes get it here in codeproject)
Best Regards
Doc
|
|
|
|
|
No, it's a memory leak. Some of your controls are creating resources and not cleaning them up. From the sound of it, probably fonts.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Without using MFC how can I tell if the mouse is over my buttons?
I've tried WM_NCHITTEST and WM_MOUSEMOVE along with stuff like ScreenToClient, GetDlgItem, GetDlgCtrlID, ChildWindowFromPoint, ect, but nothing seems to be working.
Any Ideas? Some code would help me out, thanks.
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
Just do subclassing for CBUtton
e.g
CYourButton : public CButton
{
.
.
};
and AAdd message Handlers
ON_mouse_Move
regards
Balkrishna Talele
|
|
|
|
|
Can't do that, I'm using pure WIN32 API, no MFC (if I wanted something like MFC I would use VB).
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
may i know , what are you using. is it SDK , and if so you might have register the class, in WinProc you will receive all the messages
|
|
|
|
|
You do not need MFC to subclass button controls. You write your button's window procedure and use SetWindowLong() with the GWL_WNDPROC index to subclass the button.
LRESULT CALLBACK MyButtonWindowProc(HWND hWnd, UINT nMsg, WPARAM wp, LPARAM lp)
{
switch (nMsg)
{
case WM_MOUSEMOVE:
default:
return DefWindowProc(hWnd, nMsg, wp, lp);
}
return 0;
}
SetWindowLong(ButtonHwnd, GWL_WNDPROC, (LONG)MyButtonWindowProc);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|