|
Hi All,
In my application i need to identify the drives available in my PC and the type(Ex: USB Floppy / Removable Disk etc -- The same way as shown in "MyComputer")
But while using the "GetDriveType" API, it returns only the type as DRIVE_UNKNOWN / DRIVE_REMOVABLE etc., But here i should know whether its a USB floppy or a removable one. Can anyone of you help me?
Thanks in advance.
Thanks & Rgds,
Sri..
|
|
|
|
|
Hi,
Hope this helps ...
Take the following into consideration, and then have a look a the function _getdrive() on MSDN.
curdrive = _getdrive();
for( drive = 1; drive <= 26; drive++ )
{
if( curdrive == drive )
{
sprintf(lpdrive, "%c:\\", drive + 'A' - 1 );
sprintf(szDirPath,"%s",lpdrive);
CreateDirectory(szDirPath, NULL);
}
}
Regards,
-- modified at 5:53 Tuesday 27th March, 2007
Sorry didn't read the whole question ... thus my answer won't help, seeing that you want the physical name.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
"QueryDosDevice" API shall be used for getting the deivce path name. And after that we can search for the string "floppy" in the return string of QueryDosDevice.
Thanks & Rgds,
Sri..
|
|
|
|
|
PSrividya wrote: Can anyone of you help me?
Lots of information here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
what is the difference bet these throw.
void Fun() throw();
void Fun() throw()=0;
void Fun() throw(bad_alloc)=0;
<\pre>
<div class="ForumSig">VIBIN
"Fool's run away,where angle's fear to tread"</div>
|
|
|
|
|
vibindia wrote: void Fun() throw(); //can throw any exception,I think
Yes.
See Steve's reply for this.
vibindia wrote: void Fun() throw()=0;void Fun() throw(bad_alloc)=0;
I guess, there should be virtual specifier mentioned.
These are pure virtual functions(assuming virtual specifier).
-- modified at 1:56 Tuesday 27th March, 2007
-- modified at 2:01 Tuesday 27th March, 2007
|
|
|
|
|
prasad_som wrote: vibindia wrote: void Fun() throw(); //can throw any exception,I think
Yes
This actually means that the function does ***NOT*** throw any exceptions. On a compiler that supports exception specifications if the function does try to throw one std::unexpected is called which usually terminates the program.
Steve
|
|
|
|
|
Thanks for correction !
|
|
|
|
|
ya now i got it. They are having virtual keyword.(pure virtual function>
i was confused with that throw() in betweeen
virtual void Fun() throw();
virtual void Fun() throw()=0;
virtual void Fun() throw(bad_alloc)=0;
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
|
See here[^] for the details on exception specifications.
|
|
|
|
|
Hi
All
I want to use Dialog as MessageBox in my project, so i want to load error icon,exclamation mark icons on my dialogBox. I want to do this at run time so how can i do it?
Thanks in Advance
Atul
Atul
|
|
|
|
|
If you wanted these icons in message box, then you can mention it while displaying message box only.
e.g.
AfxMessageBox(_T("Error message"),MB_ICONERROR);
AfxMessageBox(_T("Error message"),MB_ICONEXCLAMATION); In other places see following methods.
M. Atul wrote: i want to load error icon
Use IDI_ERROR .
M. Atul wrote: exclamation mark icons on my dialogBox.
Use IDI_EXCLAMATION .
Use LoadIcon[^] and SetIcon to load these predefined icons.
|
|
|
|
|
Thanks
Prasad
But i want to Load it at run time, in which event of DialogBox i have to write code. plz explain some more code.
Atul
|
|
|
|
|
M. Atul wrote: But i want to Load it at run time, in which event of DialogBox i have to write code.
As explained earlier, AfxMessageBox should suffice you if you are not doing any customization with it.
Otherwise, Override OnInitDialog to look it something similar to,
BOOL CMyDlg::OnInitDialog()
{
...
SetIcon(LoadIcon(NULL,MAKEINTRESOURCE(IDI_ERROR)),FALSE);
return TRUE;
}
|
|
|
|
|
Hai,
Iam using this line for getting the commandline argument.
The error iam getting is:
wchar_t** szArglist = ::CommandLineToArgvW( ::GetCommandLineW(), &numArgs );
error C2039: 'CommandLineToArgvW' : is not a member of '`global namespace''
error C2065: 'CommandLineToArgvW' : undeclared identifier
error C2440: 'initializing' : cannot convert from 'int' to 'unsigned short ** '
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast.
Can anyone suggest how to rectify this error..
Thanks & Regards,
Harshadha
|
|
|
|
|
Add a #include <shellapi.h>
Steve
|
|
|
|
|
Hai Steve,
I have included the needed header files and Lib file(Shell32.lib).Actually my code is working in VC++ but the same code is not working in EVC.
Thanks For Spending Your Precious Time by Replying...
Thanks & Regards
Harshadha.
|
|
|
|
|
harshadha wrote: but the same code is not working in EVC.
Its no supported on that platform.
|
|
|
|
|
Hai,
Do you have any idea how to use that in EVC
Thanks
Harshadha
|
|
|
|
|
harshadha wrote: Do you have any idea how to use that in EVC
No.
Possibly, you can get help from mobile development[^] forum.
|
|
|
|
|
Q1:
if(action&ODA_FOCUS)
{
CBrush brush(RGB(255,0,0));
pDC->FrameRect(&rectItem,&brush);
}
I wonder why I do this in DrawItem,when I ran the program and clicked the item which is not the first one,the first item's edge turned red too?
Q2:
What is difference between ODA_FOCUS and ODA_SELECT?
Q3:
As I click an item in a listbox,and then I click another control,does combination of (state & ODS_SELECTED)&& !(action&ODA_FOCUS) correspond to the item I clicked firstly?
|
|
|
|
|
No one is interested in this problem?~~~
|
|
|
|
|
Hi all,
I have some problem in prev button in my print preview page. Actually i have a MDI and when i entered print prview page, the display is fine (Next button enabled and Prev button disabled). but when i press the next button, the prev page button is still disabled (But it is supposed to be enabled).
So could you please anyone tell me how to control this buttons display properties, such enabling and disabling.
Thank you in advance.
Regards,
Ram
|
|
|
|
|
I have an executable with an exported function like this:
__declspec(dllexport) const wchar_t * UniqueID( void );
...
const wchar_t *
UniqueID( void )
{
return( L"XYZ00001" );
}
I then do the following in another executable:
typedef const wchar_t * (*pfnID)(void);
pfnID GetUniqueID;
HMODULE hMod = LoadLibrary( L"foo.exe" );
GetUniqueID = (pfnID)GetProcAddress( hMod, "UniqueID" );
const wchar_t * id = GetUniqueID(); // Returns a valid address but data is zero
This above code fails by returning a pointer from GetUniqueID() but the data is all zero'd out.
When I rebuild foo.exe to be a dll (foo.dll) the above code works fine.
Is it possible to use LoadLibrary() to open an executable and get an exported function? The docs say it's possible but I'm wondering if the loader isn't doing proper fixup when LoadLibrary() is called on an EXE.
I notice when I step into the code the value stuffed into @eax looks like the static address of "XYZ00001" and not the fixed-up virtual address I would expect. For example, LoadLibrary returned 0x010f0000 and my function address is at 0x011b614a but the address returned from GetUniqueID() is 0x006595a0.
When I rebuild foo.exe as foo.dll I see LoadLibrary returns 0x10000000, GetProcAddress returns 0x10001000, and GetUniqueID() returns 0x101178ac. In this instance the data is correct.
Any ideas?
|
|
|
|