|
Is it a regular DLL or an ActiveX/COM dll.
If it is an ActiveX dll, you can use #import
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I am using CListCtrl. I want to display yhe icon along with the item I have done it in following way But it is not displaying the image What could be the problem?
HICON hIcon;
CImageList m_imageList;
m_imageList.Create(16, 16, 0, 1, 1);
hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
m_imageList.Add(hIcon);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
pList->InsertItem( 0, "RED", 0 );
|
|
|
|
|
Perhaps the icon is not a 16x16 icon? Try using a 16x16 bitmap resource instead.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I have made a struct as shown below, and I want to create an array of this struct
struct PASSACCOUNT {
CString sGroupName;
CString sAccountName;
CString sUsername;
CString sPassphrase;
CString sAccountNotes;
CString sUrl;
CTime ctCreationDate;
CTime ctExpiresDate;
CTime ctModifiedDate;
};
When I attempt to declare it: CArray<PASSACCOUNT,PASSACCOUNT> pg; I get the error:
error C2059: syntax error : '<'
Is it possible to create an array of a struct this way? Is there an alternative way, if not?
Thanks.
|
|
|
|
|
A struct is just a class with default access of public, so there's no reason for this not to work. CArray does no sorting, so it can't need operator <, therefore the problem is probably with the code that I can't see because you didn't tick 'show this message as is' below. My suspicion is that your CArray can't see the definition of the struct.
CArray is, in any case, crap. You should use std::vector by preference and CArray only if you have a compelling reason to ( I can't imagine what that would be ).
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
|
|
|
|
|
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
|
|
|
|