|
Which components and controls? MSDN is the fountain of knowledge for all Microsoft controls and components.
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
When you select Project | Add To Project | Components and Controls.... I would like to know where is the documentation for those.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
The only documentation I'm aware of, is when you click the more info button. It will launch help files for those components which have help files. Sadly the documentation is very poor.
Do you need help with any particular one, or just a general overview?
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
Following para is copied from "Inside c++ ,Version 4.0",when i runing it in my test dialog based program,I cant't see icon(I have builted it well).Please help me,Thank you!
BOOL CListImageDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, TRUE); // Set small icon
// TODO: Add extra initialization here
//Following line is added by me
//*************************************************
HICON hIcon[8];
CImageList m_imageList;
int n;
m_imageList.Create(16, 16, ILC_COLOR16|ILC_MASK, 8, 8); // 32, 32 for large icons
hIcon[0] = AfxGetApp()->LoadIcon(IDI_ICON1);
hIcon[1] = AfxGetApp()->LoadIcon(IDI_ICON2);
hIcon[2] = AfxGetApp()->LoadIcon(IDI_ICON3);
hIcon[3] = AfxGetApp()->LoadIcon(IDI_ICON4);
hIcon[4] = AfxGetApp()->LoadIcon(IDI_ICON5);
hIcon[5] = AfxGetApp()->LoadIcon(IDI_ICON6);
hIcon[6] = AfxGetApp()->LoadIcon(IDI_ICON7);
hIcon[7] = AfxGetApp()->LoadIcon(IDI_ICON8);
for (n = 0; n < 8; n++) {
m_imageList.Add(hIcon[n]); }
static char* color[] = {"white", "black", "red",
"blue", "yellow", "cyan",
"purple", "green"};
CListCtrl* pList =
(CListCtrl*) GetDlgItem(IDC_LISTSSS);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
n=m_imageList.GetImageCount();
for (n = 0; n < 8; n++) {
pList->InsertItem(n, color[n%7], n%7);
}
//pList->SetBkColor(RGB(0, 255, 255)); // UGLY!
//pList->SetTextBkColor(RGB(0, 255, 255));
//**********************************************************
//Following line is added by me
return TRUE; // return TRUE unless you set the focus to a control
}
|
|
|
|
|
m_imageList is a local variable (not a member, which is what the m_ normally indicates). It gets destroyed at the end of the function, and destroys the underlying image list too.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.10414 AcidHelm
|
|
|
|
|
Michael Dunn:
Thank you very much,You are so kind and smart.
Thank you!
|
|
|
|
|
I have a function which takes the IShellFolder object for a folder as a parameter, and loops through all the items in the folder. If it is a file, it adds it to a ListView control, and if it is a folder it calls itself. But the first time the function encounters a folder and calls itself, the pIShell->EnumObjects returns the error code -2147023673 which, according to the Error Lookup, is "The operation was canceled by the user.".
Can anyone figure out what's wrong? Here's the code:
void AddFilesFromFolder(IShellFolder *pIShell)
{
if (pIShell)
{
IShellFolder *pBrowse = NULL;
LPENUMIDLIST pFolder = NULL;
LPMALLOC pMalloc = NULL;
ITEMIDLIST *pNewId = NULL;
STRRET strDispName;
LVITEM lvItem;
DWORD pActual = 0;
DWORD dwAttrib;
IShellFolder *CurrentFolder;
HRESULT err;
err = SHGetDesktopFolder (&CurrentFolder);
if (err == NOERROR)
{
SHGetMalloc(&pMalloc);
err = pIShell->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (err == NOERROR)
{
lvItem.mask = LVIF_IMAGE | LVIF_TEXT;
while (pFolder->Next(1, &pNewId, &pActual) != S_FALSE)
{
dwAttrib = SFGAO_FOLDER;
pIShell->GetAttributesOf(1, (LPCITEMIDLIST*)&pNewId, &dwAttrib);
if (!(dwAttrib & SFGAO_FOLDER))
{
pIShell->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
GetID3();
FillInfo();
ListAddItem();
}
if (dwAttrib & SFGAO_FOLDER)
{
CurrentFolder->BindToObject(pNewId, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
Add2(pBrowse);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
}
Thanks all!
-Rune Svendsen
|
|
|
|
|
I have a set of code in VC++ where I feel it takes time to populate the data. How to find out what code is taking lot of time. How to tune it? I don't have profile options in VC++.
|
|
|
|
|
Check out
http://www.codeproject.com/datetime/perftimer.asp#xx21598xx
I have a class which I use in one of my libraries to obtain performance data. All you do is istantiate the class at the beginning of every function call and it measures how long the function takes. My class, though, uses GetTickCount which does not have very good resolution. You might try combining my class with this performance timer.
If you want the class, I'll email it to you. Just drop me an email and I'll forward it to you.
|
|
|
|
|
How can I pass a struct to my thread with AfxBeginThread(..)???
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
take the address of your struct and cast it to a void* when you place it in the pParam parameter.
Then inside of your thread object cast it back to your struct type.
struct POINT
{
long x;
long y;
};
...
POINT pt;
...
afxBeginThread (..., (void*)&pt, ...);
POINT *ptInput = (POINT*)pParam;
The only gotcha, as with all pointers, is that you will want to make sure that the pointer pParam is not NULL before you try to dereference it.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Then I see why it didn't worked for me!
Thank you kilowatt!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
A piece of advice: don't pass the address of local variables, unless you are sure that they will live beyond the thread's life.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Michel Prévost wrote:
don't pass the address of local variables, unless you are sure that they will live beyond the thread's life.
Your right about that, I was simply trying to demonstrate how to pass the object.
Also if I allocated memory for a pointer to send I really wouldn't have felt good about showing how the pointer could be properly deleted as well and that was just more than I wanted to do
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I just wanted to point that out. You know, that's me
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
What do you mean?
I pass a local struct varible that will assign its two member varibles to two local thread varibles. What is bad with this, or what COULD be bad?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Your local struct can go out of scope before the thread starts using it.
Hence the pointer you send will point to garbage.
/Magnus
|
|
|
|
|
ummmm well i looked at ishelllink for quite some time and didnt see the start menu bit anywheres
if i'm stupid please forgive me ... am not being lazy
i need to create a start menu short cut from the app if there isnt one there ... didnt seem so hard an idea to implement until i started looking
*sigh*
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Try doing a search for CreateLink.
About 2/3 through this article is a sample function to Create a shell link, it should give you the answer you want. Of course you still have to find the StartMenu but that is just a call to SHGetSpecialFolderLocation with CSIDL_COMMON_STARTMENU or CSIDL_STARTMENU.
|
|
|
|
|
|
Lauren
You have to locate the start menu folder for the current user and create a short cut in that folder. It will not automatically put it in the right folder for you.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi.
I would like to know what function or message I need to implement to determine what item a user selects (if any) from a CListBox in a dialog box. I am referring to single and/or double click. I have implemented a solution for a problem similar to this one, but never in a dialog box.
Thanks,
Kuphryn
|
|
|
|
|
go to classwizard, select the list box you want to watch, and add a handler for the SELCHANGE event.
-c
Cheap oil. It's worth it!
|
|
|
|
|
|
Hi everyone,
I need some advice on a project that I am working on, here's my situation:
I have a Flat File(.txt) serves a my database, it has 3 colums Fld1,Fld2,Fld3, this Flat File contains about 10,000 Records(SORTED Ascending) My program receives a String as a parameter, I need to locate this string in the Flat File if it exist. Ex:
String1 = "MR. & MRS BUTCH"
//Extract each word in this string and search it in the Flat File
What is the fastest way to search each word of String1 in the Flat File? if I use line per line search I imagine how long it will take to move "M" to "B" right?
Please help I really need some advice on what to use and how to use it.
Thanks/Regards
Sidney
|
|
|
|