|
I don't see any reason why it would not be able to see the struct, it is defined in the right place... I did check show as is That's the entire error message, and the entire line of code.
Okay, I just tried doing a CArray with CString, and then with int, and I get the same error... I don't know what's going on here. There must be some other problem.
|
|
|
|
|
Dan Savilonis wrote:
I did check show as is
Maybe later, the < > was not there when I first read the post
Anyhow, I think the second parameter may need to be a pointer to the object, or a reference. I forget, like I said, CArray is crap and I don't use it.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Problems of this kind usually are usually caused by the line of code immediately above the one highlighted. I copied your code as shown, and it compiled fine for me, so my suspect is the code above the CArray line.
I sometimes experience similar problems when the compiler cannot find the CArray definition. In those case, I just include "afxtempl.h" in the header.
btw Parameter passing in your array won't be efficient because you are passing by value rather than by reference/pointer.
|
|
|
|
|
I think you're right on about that...
I didn't actually try your suggestion because I already coverted to vectors. However, when I initially tried vector<>, I found that I had the same exact error if I did not explicitly say std::vector<arg>.
|
|
|
|
|
CArray may be crap, but some of us have no choice, due to history and company policy, i.e. "Everyone else uses CArray, so you should too. After all, we include all the MS dlls with the installation"
In any case, you can only learn how crap CArray is by actually using it.
|
|
|
|
|
I am using CListCtrl . I want to select complete row in clistctrl. how should I do it?
|
|
|
|
|
HWND hWnd = myListCtrl.GetSafeHwnd();
ASSERT (hWnd != NULL);
DWORD dwStyle = ListView_GetExtendedListViewStyle (hWnd);
dwStyle |= LVS_EX_FULLROWSELECT;
ListView_SetExtendedListViewStyle (hWnd, dwStyle);
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
After the control is created, (like inside initdialog) call this:
m_MyListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
HTH
|
|
|
|
|
Who can tell me how to solve this problem?
How to realize a Sequential-Verify test on floppy disk in VC?
Thank you!
LeonOrient
|
|
|
|
|
In MDI program , five documents have beed opened , Now the current document is fifth , How do I change the current document is first or else , of course I mean that I use program to do it ,not mouse . in a word ,I want to realize the WINDOW menu function.
Thank you !
|
|
|
|
|
You need to call MDIActive() on the view of the document you want to be active. If your in doc5, you can get a pointer to doc1 through the CDocTemplate object
CDocTemplate *pTemplate = GetDocTemplate();
iterate it to get the correct document pointer using GetFirstDocPosition() and GetNextDoc(). From there you can use the GetFirstViewPosition() and GetNextView() to get the view for the document you want to active. If you use GetParent() on this and cast it to a CChildFrm object I think you can call MDIActivate on that.
This is all from memory, so some or all of the steps may be slightly incorrect.
Hope its of help.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
|
I created an ActiveX control including a property sheet in it.
in the method COleControl::OnCreate()
I create a property sheet with 3 pages as child and show it.The property sheet is not wizard-mode.
When I use the control in a modal dialog,the dialog cannot DoModal() and the control is dead.When in a modaless dialog,the control displays right ,but if I use a method of the control ,it is dead again!
why???
|
|
|
|
|
Hi,
How can I show the progress ( of a series background operations )on child dialog with progress control bar, after I press a start button in parent dialog?
(that means the child dialog will pop up after pressing the "start" button in parent dialog)
thx
|
|
|
|
|
What are the series background operations, such as...
Do you mean your own function operations or others?
|
|
|
|
|
I mean there is a function like uploading a file to ftp.
|
|
|
|
|
If the child dialogue is a modal dialogue, here are two ways to realize that(I think so):
1.Do with the propress control in the parent dialogue. Since the modal dialogue monopolizes your processing time, you maybe create a new thread to handle the progress event, that is to set the position of the child parent' progress control when necessary.
2.Do with the propress control in the child dialogue. This way needs you to get the parent's vars and then get the state of operations by the parent class, finally you can set the position of the progress control in child dialogue.
How do you think about these two ways?
|
|
|
|
|
I prefer second way as it can seperate the progress from parant and set the status in a new dialog, but I don't know where to start the function (uploading file) where can show its progress.
[i.e how can i start a function automatically after the child dialog is displayed, and show the status in child dialog]
|
|
|
|
|
I want to know where you upload the file to,the file type,whether you do read the file's content into your control or another file. Above all, what's your aim to upload the file?
I will upload the file a block and a block, so I can know the uploading progress.
|
|
|
|
|
o i c
thx
|
|
|
|
|
Does anyone have any idea why EnableMenuItem in case seven is being totally ignored? I get a beep when I put one there. The code is being reached but calls to it are returning zero and nothing is happening. All the menu selections appear enabled and won't grey out no matter what I do. GetMenuItemID is actually getting a value. I'm a bit lost on this....
void CSacmanSetupApplicationView::OnRclickSetupTree(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
int x=0,y=0,index = 0;<br />
<br />
CString itemText;<br />
<br />
DWORD mousePosition;<br />
DWORD itemData;<br />
<br />
<br />
mousePosition = ::GetMessagePos();<br />
<br />
x = GET_X_LPARAM(mousePosition);<br />
y = GET_Y_LPARAM(mousePosition);<br />
<br />
<br />
CMenu newMenu;<br />
CMenu *submenu;<br />
CGate* pGate = NULL;<br />
<br />
itemData = this->m_ctrlSetupTree.GetItemData(this->m_ctrlSetupTree.GetSelectedItem());<br />
this->SetSelectedTreeItem(this->m_ctrlSetupTree.GetSelectedItem());<br />
<br />
itemText = this->m_ctrlSetupTree.GetItemText(this->m_tiSelectedItem);<br />
<br />
switch(itemData)<br />
{<br />
<br />
case 7:<br />
<br />
newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
submenu = newMenu.GetSubMenu(7);<br />
<br />
pGate =this->m_oCanalManager.GetGate(itemText);<br />
<br />
if(pGate)<br />
{<br />
<br />
if(pGate->IsPiped())<br />
{<br />
Beep(444,44);<br />
<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(0),MF_BYPOSITION||MF_GRAYED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(1),MF_BYPOSITION||MF_GRAYED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(2),MF_BYPOSITION||MF_GRAYED);<br />
}<br />
else if(pGate->IsRectangular())<br />
{<br />
<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(0),MF_BYCOMMAND||MF_ENABLED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(1),MF_BYCOMMAND||MF_ENABLED);<br />
submenu->EnableMenuItem(submenu->GetMenuItemID(2),MF_BYCOMMAND||MF_ENABLED);<br />
<br />
}<br />
}<br />
<br />
submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);<br />
<br />
break;<br />
<br />
case 8:<br />
<br />
newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
submenu = newMenu.GetSubMenu(5); <br />
submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL); <br />
break;<br />
<br />
case 9:<br />
<br />
newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
submenu = newMenu.GetSubMenu(8); <br />
submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);<br />
<br />
break;<br />
<br />
default:<br />
Beep(999,99);<br />
break;<br />
<br />
}<br />
<br />
*pResult = 0;<br />
}
What's up with that???
|
|
|
|
|
|
A while back I read your MFC FAQ page and I followed your advice about using UPDATE_COMMAND_UI feature. After a few days of struggling with this feature, I was not able to enable or disable menu items through UPDATE_COMMAND_UI. Actually I could disable them but I couldn't get them to appear as grayed. On the other hand CCmdUI has only 5 member functions, and none of them offers the option of graying out the menu.
MFC provides CMenu and if you can't use this class to enable and disable menu items then what good is this menu class for? It would really help if you could elaborate a little bit more on this topic on your FAQ page, because to this day I am still confused.
Personally I use:
GetMenu()->EnableMenuItem( ID_OF_MENU_ITEM, MF_GRAYED );
GetMenu()->EnableMenuItem( ID_OF_MENU_ITEM, MF_BYCOMMAND | MF_ENABLED );
and these calls work just fine for me.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hi. I am trying to get the cut, copy, and paste commands on a toolbar to update (enable and disable) whenever those options are usable or not. I can handle the checking part of it, i just don't know where to put it. Is there some sort of function that gets called whenever something changes in the CEdit control?
-- Steve
|
|
|
|
|
One solution is to add a handler for ON_UPDATE_COMMAND_UI of one menu item. Another solution is ON_UPDATE_COMMAND_UI_RANGE for multiple menu items.
ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy)
void SomeClass::OnUpdateEditCopy(CCmdUI* pCmdUI)
{
...
}
Kuphryn
|
|
|
|