|
Hi,
I have to write application to detect Disk configuration.
Is disk type is Basic or Dynamic?
I know Basic disk is supported by all windows versions, but dynamic is supported only by windows 2000, XP Pro, 2003 Server.
I am able to get the OS information but unable to get info for hard disk's.
Can anyone help me?
Thanks,
sanjay
|
|
|
|
|
Amazingly, this code seems to compile without errors in VC6. Are you able to repro this or am I doing something stupid?
#include "stdafx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
<code>
CWinApp theApp;
void foo
(CString str)
{
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
<code>
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) {
printf ("Fatal Error: MFC initialization failed");
return (1);
}
unsigned int x = 1;
foo (x); <code>
foo (1); <code>
return (0);
} /ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I would guess you are seeing an implicit constructor call, probably one of the CString(XCHAR c,int count = 1); variants.
Software Zen: delete this;
|
|
|
|
|
|
VC7.0 and VC7.1 add a macro (ATL_CSTRING_EXPLICIT_CONSTRUCTORS , or something like that) to force compile errors in this case.
Software Zen: delete this;
|
|
|
|
|
Hello,
I'm just curious why you define _tmain() in a MFC application?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
why you define _tmain() in a MFC application?
It's a console MFC app (specifically, a test framework for a lib that happens to link with MFC).
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
-- modified at 23:57 Monday 5th September, 2005
|
|
|
|
|
Hi,
I use webbrowser control in a vc project,and when navigate to a local file which contains ActiveXObject .Then it blocks .
How can i let the webbrowser direct shows the contenct without user allows it.
A example of it is the Directx Sample Browser .I want just the same .
Some one please help me. Thanks
|
|
|
|
|
I seem to have a compatibility issue with functions accessing the registry. All XP systems work well but 98 and 2K seem to decide they won't play. Its common to all Reg...Ex() functions. Anyone know how to solve this cross Windows issue before I start coding everything in 16bit.
Many thanks
<br />
bool WriteKey(char * key_type, char * key)<br />
{<br />
bool status = true;
<br />
LONG ret;<br />
<br />
HKEY kh1, kh2;<br />
<br />
DWORD disposition;<br />
<br />
char *buf1;<br />
char *buf2;<br />
<br />
buf1 = new char[256];<br />
buf2 = new char[256];<br />
<br />
<br />
ret = RegCreateKeyEx(HKEY_LOCAL_MACHINE, <br />
"SOFTWARE\\KEY1", <br />
0,<br />
NULL,<br />
REG_OPTION_NON_VOLATILE,<br />
KEY_ALL_ACCESS,<br />
NULL,<br />
&kh1,<br />
&disposition);<br />
<br />
ret = RegCreateKeyEx(kh1, <br />
"KEY2",<br />
0,<br />
NULL,<br />
REG_OPTION_NON_VOLATILE,<br />
KEY_ALL_ACCESS,<br />
NULL,<br />
&kh2,<br />
&disposition);<br />
<br />
<br />
if(ret != ERROR_SUCCESS)<br />
{<br />
MsgBox("WriteKey(): RegCreateKeyEx: Failed.");<br />
status = false;<br />
}<br />
<br />
ret = RegSetValueEx(kh2, key_type, 0, REG_SZ, (CONST BYTE *) key, strlen(key) + 1);<br />
<br />
if(ret != ERROR_SUCCESS)<br />
{<br />
MsgBox("WriteKey(): RegSetValueEx: Failed.");<br />
status = false;<br />
}<br />
<br />
ret = RegCloseKey(kh1);<br />
ret = RegCloseKey(kh2);<br />
<br />
if(ret != ERROR_SUCCESS)<br />
{<br />
MsgBox("WriteKey(): RegCloseKey: Failed.");<br />
status = false;<br />
}<br />
<br />
delete buf1;<br />
delete buf2;<br />
<br />
return status;<br />
}<br />
u6ik
|
|
|
|
|
Cracked it. Simple really...
<br />
<br />
ret = RegSetValueEx(kh2, key_type, 0, REG_SZ, (CONST BYTE *) key, strlen(key) + 1);<br />
<br />
if(ret != ERROR_SUCCESS)<br />
{<br />
ret = RegSetValue(kh2, key_type, (CONST BYTE *) key, strlen(key) + 1);<br />
}<br />
Just use the older code if the newer code fails. Bit of a faf, but it works.
u6ik
|
|
|
|
|
Hello.,
I developed an application which stores some data.
Next I create a setup file .
The SetUp file (If I installed in my Machine) works fine in my System, But It can not works fine in other machines.
=>Because I hard coded the DSN name as 'MyDSNName'
and Database Table as 'MyDataBase'
--
I wrote code like this.-=-->
-------------
CString sql,sDate;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "c:\\mydatabase.mdb";
CDatabase db;
sDsn.Format("ODBC;DRIVER={%s};DSN='MyDsnName';DBQ=%s",sDriver,sFile);
db.Open(NULL,false,false,sDsn);
CRecordset recset( &db);
------------
>>I want flexible code ,which works fine for all machines.,
Praveen Chowdam Kumar
|
|
|
|
|
parims wrote:
sDsn.Format("ODBC;DRIVER={%s};DSN='MyDsnName';DBQ=%s",sDriver,sFile);
You are using a DSN name that maybe it's not created in the others computers. This article[^]may help you.
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hi,
How can one the setupapi device driver removing?
What do I make wrong in my code?
Can anybody help me at the problem?
Thanks
Peter
<br />
#include "stdafx.h"<br />
#include <stdio.h><br />
#include <windows.h><br />
#include <setupapi.h><br />
#include "cfgmgr32.h"<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
<br />
PSP_DEVICE_INTERFACE_DETAIL_DATA pspdidd;<br />
SP_DEVICE_INTERFACE_DATA spdid;<br />
SP_DEVINFO_DATA spdd;<br />
HDEVINFO hDevInfo;<br />
DWORD dwIndex, dwSize, dwType;<br />
TCHAR szProperty[256];<br />
GUID ClassGUID;<br />
TCHAR ClassName[MAX_CLASS_NAME_LEN];<br />
LPTSTR INFFile = argv[1];<br />
CString strInfClassID;<br />
BOOL isInstall = FALSE;<br />
<br />
ZeroMemory(&spdid, sizeof(spdid));<br />
spdid.cbSize = sizeof(spdid);<br />
<br />
if(!SetupDiGetINFClass(INFFile,&ClassGUID,ClassName,sizeof(ClassName),0))<br />
{<br />
printf("GetINFClass");<br />
goto cleanup_DeviceInfo;<br />
}<br />
<br />
LPOLESTR InfBuffer;<br />
<br />
StringFromCLSID( ClassGUID, &InfBuffer );<br />
strInfClassID = InfBuffer;<br />
CoTaskMemFree(InfBuffer);<br />
<br />
<br />
hDevInfo = SetupDiGetClassDevs(&ClassGUID, NULL, NULL,<br />
DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);<br />
<br />
<br />
<br />
<br />
<br />
if(hDevInfo == INVALID_HANDLE_VALUE)<br />
{<br />
printf("SetupDiGetClassDevs nicht gefunden.\n ");<br />
goto cleanup_DeviceInfo;<br />
<br />
}<br />
<br />
<br />
<br />
for(dwIndex = 0; (SetupDiEnumDeviceInterfaces(hDevInfo,NULL, &ClassGUID, dwIndex,&spdid)); dwIndex++)<br />
{<br />
<br />
SP_REMOVEDEVICE_PARAMS rmdParams;<br />
<br />
rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);<br />
rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE;<br />
rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL;<br />
rmdParams.HwProfile = 0;<br />
<br />
if(!SetupDiSetClassInstallParams(hDevInfo,NULL,&rmdParams.ClassInstallHeader,sizeof(rmdParams)) ||<br />
!SetupDiCallClassInstaller(DIF_REMOVE,hDevInfo,NULL)) <br />
{<br />
printf("Driver not remove.");<br />
}<br />
else<br />
{<br />
printf("Driver remove.");<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
cleanup_DeviceInfo:<br />
<br />
SetupDiDestroyDeviceInfoList(hDevInfo);<br />
<br />
return 0;<br />
}<br />
<br />
<br />
|
|
|
|
|
I have got a handle of a Window and now I want to change color of that window. How do I set new Color for that Window at run-time ?
|
|
|
|
|
|
|
TCHAR* buffer = new TCHAR[1024];
UINT ret = pFile->Read(buffer, 1024);
while ( ret != 0 )
{
buffer[ret] = TEXT('\0');
strText = buffer;
OutWebResource += strText;
ret = pFile->Read(buffer, 1024);
}
pFile->Close();
|
|
|
|
|
I used this read UNICODE data, but It seemed that there is always mem uninitialized. what's the matter?
|
|
|
|
|
I don`t understand what u really want but after declaring TCHAR... do a memset( &buffer, 0, sizeof(TCHAR));
NG
|
|
|
|
|
I added a memset call. but i still get the src code above. this is just a piece of the src code in the middle.
I don't konw how this happen.
Thank u all here.
|
|
|
|
|
you have define UNICODE in your project
because TCHAR type will have a size of 2 bytes then....
an CFile will work different or u can send by mail(to me) your file to see where....
NG
-- modified at 10:27 Monday 5th September, 2005
|
|
|
|
|
You should allocate one more byte for '\0' char.
TCHAR* buffer = new TCHAR[1025];
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
If your pFile->Read call reads 1024 TCHAR 's, then ret has the value 1024. The line buffer[ret] = TEXT('\0'); will then overrun the end of buffer .
Software Zen: delete this;
|
|
|
|
|
when you see the content of a variable of type HWND in Watch, you see something like this: 0x00040222 {unused=???}
what is "unused"?
is HWND a class?
|
|
|
|
|
Hello,
HWND is a handle to an object managed by the OS. This means that you have no definition of the object, nor how it is implemented. This means that the object can be anything, an instance of a class, a normal struct, string, etc..
The reason why the watch has no information about the object, is because it doesn't know what to do with the handle, it doesn't know its type (handles are void* pointers). For that reason, { unused=??? } appears in the watch.
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|