|
No, W will not be enough: the windows that are created w/o the W are non-unicode windows (there is a special API to check the Unicodeness of a window), and they cannot accept unicode strings in menus and other places; the system standard controls, like editbox or button, do support unicode, but the top level windows and dialogs must be created differently.
Cheers,
Alex
|
|
|
|
|
Thank you for the information provided
- NS -
|
|
|
|
|
i am developing a small dialog based application where in i am stuck at someplace. just wanted to know how do i display the directories of a system in a combo box. it would be great if i get a solution as soon as possible
Thanks in Advance.
Chandru080
|
|
|
|
|
use _chdir(),_findfirst(),_findnext() etc
in proper combination to achieve your task.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Chandrasekharanp wrote: just wanted to know how do i display the directories of a system in a combo box.
Look up DlgDirListComboBox .
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
See CComboBox::Dir
- NS -
|
|
|
|
|
use the following code.Here m_letter is the member variable of combo box.
int k = 0;
DWORD MaxDriveSet, CurDriveSet;
DWORD drive, drivetype;
TCHAR szBuf[300];
HANDLE hDevice;
PSTORAGE_DEVICE_DESCRIPTOR pDevDesc;
for(k=0; k<26; k++)
szMoveDiskName[k] = '\0';
k = 1;
// Get available drives we can monitor
MaxDriveSet = CurDriveSet = 0;
MaxDriveSet = GetLogicalDrives();
CurDriveSet = MaxDriveSet;
for ( drive = 0; drive < 32; ++drive )
{
if ( MaxDriveSet & (1 << drive) )
{
DWORD temp = 1<<drive;
_stprintf(="" szdrvname,="" _t("%c:"),="" 'a'+drive="" );
="" m_letter.addstring(szdrvname);
="" switch="" (="" getdrivetype(="" szdrvname="" )=""
="" {
="" case="" 0:="" the="" drive="" type="" cannot="" be="" determined.
="" 1:="" root="" directory="" does="" not="" exist.
="" drivetype="DRVUNKNOWN;
" break;
="" drive_removable:="" can="" removed="" szmovediskname[k]="chFirstDriveFromMask(temp);
" szmovediskname[0]="k;
" k++;
="" drive_cdrom:="" is="" a="" cd-rom="" drive.
="" drive_fixed:="" disk="" sprintf(szbuf,="" "\\\\?\\%c:",="" 'a'+drive);
="" hdevice="CreateFile(szBuf," generic_read,
="" file_share_read="" |="" file_share_write,="" null,="" open_existing,="" null);
="" if="" (hdevice="" !="INVALID_HANDLE_VALUE)
" {
="" pdevdesc="(PSTORAGE_DEVICE_DESCRIPTOR)new" byte[sizeof(storage_device_descriptor)="" +="" 512="" -="" 1];
="" pdevdesc-="">Size = sizeof(STORAGE_DEVICE_DESCRIPTOR) + 512 - 1;
if(GetDisksProperty(hDevice, pDevDesc))
{
if(pDevDesc->BusType == BusTypeUsb)
{
szMoveDiskName[k] = chFirstDriveFromMask(temp);
szMoveDiskName[0]=k;
k++;
}
}
delete pDevDesc;
CloseHandle(hDevice);
}
break;
case DRIVE_REMOTE:// The drive is a remote
drivetype = DRVREMOTE;
szMoveDiskName[k] = chFirstDriveFromMask(temp);
szMoveDiskName[0]=k;
k++;
break;
case DRIVE_RAMDISK:// The drive is a RAM disk.
drivetype = DRVRAM;
break;
}
}
}
|
|
|
|
|
Why this much since there is a simple solution available?
- NS -
|
|
|
|
|
i do understand that CComboBox::Dir works. but it working only for the current working directory.. i wnat to list out the total number of directories available on the system.
|
|
|
|
|
ya.For that only i have used the above code even though it is little bit lengthy.But it works perfectly.
|
|
|
|
|
But it is only for getting the drives, not directories. Am I right?
- NS -
|
|
|
|
|
ok.. will try that.. but u will have to tell me where to put that piece of code.
|
|
|
|
|
Chandrasekharanp wrote: but it working only for the current working directory..
That's wrong. Try this...
m_combo.Dir( DDL_EXCLUSIVE | DDL_DIRECTORY, "C:\\Windows\\*.*" );
Chandrasekharanp wrote: i wnat to list out the total number of directories available on the system.
For this case, AFAIK, you have to enumerate the directories. CFileFind class can help you.
- NS -
|
|
|
|
|
nothing is getting displayed in the combo box if i put the piece of code which u gave me.
|
|
|
|
|
That is awesome... that is a test code.
Anyway can you please show me the code segment? I need to know where and how you used it.
- NS -
|
|
|
|
|
it is working. but it is giving all the files and directories that is available in C. my requirment is not that. for example if there are 4 drives..ie(A,C,D,E). i need to print that A.C.D.E in the combo box. nothing else.
|
|
|
|
|
What I gave you is only an example. You can call it for any drive. Each call will add the list of directories to the existing list in the combo. If you need to get all the directories, as I said earlier, use CFileFind class recursively.
If you need only drives, specify the attribute as DDL_DIRECTORY.
- NS -
|
|
|
|
|
NS17 wrote: If you need only drives, specify the attribute as DDL_DIRECTORY.
Wrong. You should use DDL_DRIVES if what you want are drives.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: You should use DDL_DRIVES
Ooops... That's what I intended... Sorry for my careless typing (copy-pasting).
- NS -
|
|
|
|
|
Chandrasekharanp wrote: i need to print that A.C.D.E in the combo box.
These are drive designators, not directories (as your subject implies).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Send it a CB_DIR message. Use DDL_DIRECTORY | DDL_EXCLUSIVE for the WPARAM argument. If you are using MFC, the solution is even simpler.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes i am using MFC. how will i do it in MFC??
|
|
|
|
|
Did you overlook this?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can we get the starting date from which history of IE is displayed in the history folder programatically.
|
|
|
|
|
FindFirstUrlCacheEntryEx/FindNextUrlCacheEntryEx specify URLHISTORY_CACHE_ENTRY, you'll have to check every entry and examine the times in the INTERNET_CACHE_ENTRY_INFO to find the earliest time.
|
|
|
|