|
Do you want to call a dialog of other dialog?
|
|
|
|
|
actually i want to call a menu window from one to another..
thanks a lot from u for my queries..
|
|
|
|
|
After reading about WIN32_FIND_DATA I managed to write the following little program:
#include<iostream><br />
#include<fstream><br />
#include<string><br />
#include <Windows.h><br />
<br />
using namespace std;<br />
<br />
void main()<br />
{<br />
WIN32_FIND_DATA FindFileData;<br />
string sdir;<br />
cin>>sdir;<br />
HANDLE hFind=FindFirstFile((sdir+"\\*.txt").c_str(),&FindFileData);<br />
<br />
if (hFind == INVALID_HANDLE_VALUE) <br />
{<br />
cout<<"Error"<<endl;<br />
return;<br />
} <br />
string fname=FindFileData.cFileName;<br />
cout<<fname<<endl;<br />
while (FindNextFile(hFind, &FindFileData) != 0) <br />
{<br />
fname=FindFileData.cFileName;<br />
cout<<fname<<endl;<br />
}<br />
}
It reads the names of txt files in a given folder and prints them out, although it works fine, I am suspecious that there might be possible bugs or runtime errors, any comments or suggestions?
|
|
|
|
|
Do you get any error or warning?
|
|
|
|
|
This works aswell ...
HANDLE hFile;
WIN32_FIND_DATA FileInformation;
TCHAR m_szPath[MAX_PATH];
TCHAR m_szFolderInitialPath[MAX_PATH];
TCHAR wildCard[MAX_PATH] = "\\*.*";
hFile = ::FindFirstFile(m_szFolderInitialPath, &FileInformation);
if(hFile != INVALID_HANDLE_VALUE)
{
do{
if(FileInformation.cFileName[0] != '.')
{
strcpy(m_szPath,m_szFdPath);
if(FileInformation.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY)
{
::SetFileAttributes(m_szPath,FILE_ATTRIBUTE_NORMAL);
}
else
{
::SetFileAttributes(m_szPath,FILE_ATTRIBUTE_NORMAL);
}
}
}while(::FindNextFile(hFile, &FileInformation) == TRUE);
::FindClose(hFile);
DWORD dwError = ::GetLastError();
if(dwError == ERROR_NO_MORE_FILES)
{
}
}
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
No it doesn't display any warnings, thanks for your replys.
|
|
|
|
|
Programm3r wrote: This works aswell ...
...assuming the OP wanted to set the attributes of a file.
"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
|
|
|
|
|
Hi,
I have an old program without and try/catch statements. Now I'm trying to handle some exceptions . However, I don't want to add any try/catch pieces in the code - it's big work. So, I hope to use a API:
SetUnhandledExceptionFilter()
to handle all exceptions and jump into my handle function. However, the handle function must return one of these:
EXCEPTION_EXECUTE_HANDLER
EXCEPTION_CONTINUE_EXECUTION
EXCEPTION_CONTINUE_SEARCH
This is boring, the exception will still be thrown.
I hope to hide exception in my filter handle function. How can I do that?
|
|
|
|
|
|
|
|
|
please give me some hint
hi
|
|
|
|
|
See this[^] thread does helpful?
|
|
|
|
|
|
I require a monitor tool which does following,
a. attach to a running process
b. list out windows api calls and non-windows function calls with module
name called in order
c. list out what are the function parameters, input to the function,
output from the function, return value from the function
d. changes color if a function is in error state
Do anyone know any such tool exist?
Your knowledge is appreciated
|
|
|
|
|
I dont think you can find this program can you explain why do you need to this program?
|
|
|
|
|
how can i convert ms-word to bmp by program???
|
|
|
|
|
Not sure that you can, except by launching word and doing a screen capture
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I am using sendASPI32Command for writing data to CD. But for a particular size of data sendASPI32Command returns SS_ASPI_IS_BUSY error. The error occurs when writes the last track data.
Could u pls tell in which condition this case occurs.Please help..........
AJay
|
|
|
|
|
How can i detect if a user logoffs or switches ?
Thankl you very much...
|
|
|
|
|
Is the ISensLogon interface of any help?
"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
|
|
|
|
|
How can i do this in Win32API ?
Thank you very much...
|
|
|
|
|
GetDriveType will help you get some of that information, but I doubt you'll be able to easily get more than that.
After all, Win32 doesn't have any knowledge of how the device driver is working between the Write/Open/IoCtl command and its physical workings. Any driver can call CreateDoSdevice et al to create a file endpoint....
Sorry to not give you exact help.
Iain.
|
|
|
|
|
It's not simple but it can be done. I can't give you the code because it's owned by my employers but these basic steps should help you along.
Start by getting the drive type from your drive letter as previously suggested. For USB drives this will always be DRIVE_REMOVABLE or DRIVE_FIXED, anything else and it can be discarded at this stage.
Then you need to open a handle to the Volume with CreateFile and a file name like \\.\E:
(remember to double the slashes when you put this in a C++ string)
You can use the returned device handle to get a VOLUME_DISK_EXTENTS structure for the volume using DeviceIOControl with a IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS control code.
In the Disk Extents structure there is a DiskNumber you can now associate this with the drive letter you started with and remember it.
Now the hard part, is it USB?
The next step is to enumerate all the USB devices attached to the system using SetupDiGetClassDevs with &GUID_DEVCLASS_USB and SetupDiGetClassDevs with &DiskClassGuid to get all the disk devices. For each device use the returned handle to get Device information with SetupDiEnumDeviceInterfaces and SetupDiGetDeviceInterfaceDetail. You end up with a SP_DEVICE_INTERFACE_DETAIL_DATA structure which contains a device path. Open this path with CreateFile which gives you a device handle.
Use the device handle with DeviceIoControl and IOCTL_STORAGE_QUERY_PROPERTY and cast the result to a PSTORAGE_ADAPTER_DESCRIPTOR. This contains a BusType which will be 0x7 for USB
You can use the same device handle you called CreateFile with to do a DeviceIoControl with IOCTL_STORAGE_GET_MEDIA_TYPES_EX. Cast the returned buffer to a PGET_MEDIA_TYPES to get a structure with DeviceType. If DeviceType == FILE_DEVICE_DISK then you have a USB disk but you still don't know which drive letter it corresponds to. To determine this you need to pass the same device handle to DeviceIoControl with IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS and compare the DiskNumber in the result with the pair of DiskNumber and Drive letters that you worked out in the first step.
If this sounds like a joke it is not. I don't know any easier way to do this (took 2 weeks to develop) although I'd like to. You will need some headers from the Windows 2000 or later DDK as well for some of the GUIDS and constants. This will not work before Windows 2000. Good luck
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|