|
Clist is declared as
typedef CList<userdefinedtype> _lllist;
thanks
|
|
|
|
|
Clist is declared as
typedef CList<userdefinedtype> _lllist;
|
|
|
|
|
Clist is declared as
typedef CList<userdefinedtype , &userdefinedtype> _lllist;
|
|
|
|
|
and what is the "userdefinedtype" in your case? Check the destructor of it.
Greetings from Germany
|
|
|
|
|
hi all,
i am placing here a piece of code which was a function used to retrieve the drive letter of a USB from the corresponding device ID.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL GetSpecificDrive(LPTSTR lpDevID, TCHAR* DrvName)
{
DebugLog("entered GetSpecificDrive");
HDEVINFO hVolInfo;
GUID guid;
BYTE buffer[BUFFER_SIZE];
DWORD dwRequiredSize ;
TCHAR buf[BUFFER_SIZE],buf1[BUFFER_SIZE];
DEVINST devInstParent;
DWORD dwIndex;
TCHAR volume[BUFFER_SIZE];
int nLength;
DWORD size;
ULONG Status,Problem;
SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail;
SP_DEVICE_INTERFACE_DATA devInterfaceData;
SP_DEVINFO_DATA devInfoData,devInfo;
PSP_DEVICE_INTERFACE_DETAIL_DATA pDevDetail;
TCHAR TargetPath[BUFFER_SIZE]= {0};
if(!lpDevID)
{
DebugLog("!lpDevId");
return 0;
}
// GUID_DEVINTERFACE_VOLUME is interface Guid for Volume class devices.
guid = GUID_DEVINTERFACE_VOLUME;
// Get device Information handle for Volume interface
hVolInfo = SetupDiGetClassDevs(&guid, NULL, NULL,
DIGCF_DEVICEINTERFACE |
DIGCF_PRESENT);
if(hVolInfo == INVALID_HANDLE_VALUE)
{
DebugLog("hVolInfo == INVALID_HANDLE_VALUE");
return 0;
}
// Loop until device interfaces are found.
for(dwIndex = 0; ;dwIndex ++)
{
ZeroMemory(&devInterfaceData, sizeof(devInterfaceData));
devInterfaceData.cbSize = sizeof(devInterfaceData);
// Get device Interface data.
char errorCondition[100] = {0};
if(!SetupDiEnumDeviceInterfaces(hVolInfo, NULL, &guid,dwIndex,&devInterfaceData))
{
sprintf(errorCondition,"error code returned : %d ",GetLastError());
DebugLog("!SetupDiEnumDeviceInterfaces");
DebugLog(errorCondition);
break;
}
ZeroMemory(&devInfoData, sizeof(devInfoData));
devInfoData.cbSize = sizeof(devInfoData);
pDevDetail = (PSP_DEVICE_INTERFACE_DETAIL_DATA)buffer;
pDevDetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
// Get device interface detail data to get
// Device Instance from SP_DEVINFO_DATA and
// Device Path from SP_DEVICE_INTERFACE_DETAIL_DATA
if(!SetupDiGetDeviceInterfaceDetail(hVolInfo,
&devInterfaceData,
pDevDetail, // SP_DEVICE_INTERFACE_DETAIL_DATA
BUFFER_SIZE,
&dwRequiredSize,
&devInfoData)) // SP_DEVINFO_DATA
{
char errcndn[100] = {0};
sprintf(errcndn,"error code returned : %d",GetLastError());
DebugLog(errcndn);
DebugLog("!SetupDiGetDeviceInterfaceDetail");
break;
}
// Get the device instance of parent. This points to USBSTOR.
DebugLog("CM_Get_Parent call");
if(CM_Get_Parent(&devInstParent,devInfo.DevInst, 0) != CR_SUCCESS)
{
DebugLog("CM_Get_Parent failed");
}
// Get the device instance of grand parent. This points to USB root.
DebugLog("CM_Get_Parent 2 call");
if(CM_Get_Parent(&devInstParent,devInstParent, 0) != CR_SUCCESS)
{
DebugLog("CM_Get_Parent 2 failed");
}
// Get the device ID of the USB root.
DebugLog("CM_Get_Device_ID call");
if(CM_Get_Device_ID(devInstParent, buf,BUFFER_SIZE,0) != CR_SUCCESS)
{
DebugLog("Cm_Get_Device_ID failed");
}
DebugLog("Buf value grandparent :::::::::::::::::");
DebugLog(buf);
DebugLog(lpDevID);
if( buf1 != NULL && _tcscmp(lpDevID,buf1) == 0)
{
// Append \ to the DevicePath of SP_DEVICE_INTERFACE_DETAIL_DATA
nLength = (int)strlen(pDevDetail->DevicePath);
pDevDetail->DevicePath[nLength] = '\\';
pDevDetail->DevicePath[nLength+1] = 0;
char dev[260] = {0};
sprintf(dev,"%s",pDevDetail->DevicePath);
DebugLog(pDevDetail->DevicePath);
DebugLog(dev);
// Get Volume mount point for the device path.
char errorReport[50] = {0};
if(GetVolumeNameForVolumeMountPoint(pDevDetail->DevicePath,volume,BUFFER_SIZE))
{
if(GetVolumePathNamesForVolumeName(volume,TargetPath,BUFFER_SIZE,&size))
{
_stprintf(DrvName,"%s", TargetPath);
DebugLog(DrvName);
DebugLog("entered GetSpecificDrive 1");
return 1;
}
else
{
DebugLog("Error");
DebugLog("exiting GetSpecificDrive 0");
return 0;
}
}
else
{
sprintf(errorReport,"Error Code returned is %d",GetLastError());
DebugLog("!GetVolumeNameForVolumeMountPoint");
DebugLog(errorReport);
}
}
}
SetupDiDestroyDeviceInfoList(hVolInfo);
DebugLog("exiting GetSpecificDrive");
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
this code is works fine when it is used in development for win-xp.
windows vista has got some other thigs to go. this code doesnt work.. the functions cm_get_parent encounters an error in retrieving the grandparent device id . as i looked upon i found that in vista there is no parent child concept and in vista USB devices are no longer handled as removable device instead they are handled as fixed drives.
i am stuck up here in this part of my code as without getting the drive letter, i cant proceed further.
what changes can i make or is there any other code which can replace the above code for getting the same functionality/??????????????????
|
|
|
|
|
- Please do not shout(i.e. do not use bold and bigger fonts.)
- Please format your code using code block button at the bottom
Regards,
Sandip.
|
|
|
|
|
Hi All
How can i set image on button?Plz help me
|
|
|
|
|
Hi,
Here is good tutorial for using bitmap button
Bitmap Button[^]
Also don't forget to look at Button Controls[^] section of CP.
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
MFC library provides the CBitmapButton [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am using CopyMemory to transfer AVI video data into bitmap.
My problem is that AVI data is in RGB 24 bit format and my bitmap is 32 bit - RGB plus reserved 8 bits word.
The bitmap displays OK in MFC view however I like to “insert” the reserved word into the bitmap data to make it real.
Any constructive suggestion is welcome.
Thanks for reading.
Vaclav
|
|
|
|
|
If the source and destination formats don't match then you
can't use CopyMemory().
Loop through the data and copy it correctly!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am getting the following error message when I link my MFC application:
1>uafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
1>C:\c++.dev\rCalc\Debug\rCalc.exe : fatal error LNK1169: one or more multiply defined symbols found
None of the classes that I define, define an operators. Therefore, I do not understand why I am getting this message. I am hoping that somebody can tell me what I am missing.
Thanks
Bob
|
|
|
|
|
This is because you are using different type of CRT (C Run Time libraries). Make sure all the projects in the solution using same CRT.
-Saurabh
|
|
|
|
|
After doing some more internet searches, I found that this was a known issue with the Visual C++. However, there is an easy work around. You must make sure that afxwin.h is the first header file included in every file in your program. After modifying my code so that afxwin.h was the first header file included in every module. My problem went away.
Bob
|
|
|
|
|
Hi all,
I am newbie in C++, i have a project to check the stuck key of keyboard using VC++ MFC Dialog. Only one key can be press at same time.
example:
I pressed and hold 'a' and then press 'b'. It should prompt out an error message regarding there was more than 1 key pressed.
Below is my coding, i only able to detect a key pressed. If the 'a' key haven't release, 'b' key pressed, it will go in the sub-program and display 'b' key pressed.
What pragrameter i should using in MFC library to check there is more than 1 key pressed?
Thanks.
[code]
BOOL Test_0Dlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
MSG* msg=(MSG*)pMsg;
if(pMsg->message==WM_KEYDOWN)
{
// sub-program
}
return 0;
}
[/code]
|
|
|
|
|
See GetAsyncKeyState 's documentation [^] (for code samples [^]).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Well if you would post an actual question, maybe someone can help you.
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
Pissedoffmathematician wrote: I need help writing a program for decryption from ASCII
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Pissedoffmathematician wrote: I need help writing a program for decryption from ASCII.
Since when is ASCII encrypted?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: Since when is ASCII encrypted?
YshldknwASCsncryptblmyfrnd
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Pissedoffmathematician wrote: I hate programming and am a mathematics student
Sounds like an oxymoron.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Try to make that task with a mate from your class. First develop the mathematical logic for the decrypting and than look for the coding.
You like mathematics and hate programming? I find that obscure.
You have a bad attitude in doing "your job"!!!
SCNR
Greetings from Germany
|
|
|
|
|
Hello all,
I'm facing a problem with CHttpFile, and exactly with its QueryInfo method. I'm trying to connect to a server which gives an id to the 'conversation' that will take place; so I POST some data, and it responds me with an HTML page with an id that I can later reuse for asking more data.
The problem is that this id has been put in the HTML header, and the HTML data is empty. So after I called
CHttpFile *file=myConnection->OpenRequest and everything went allright, file->Read doesn't return anything.
I had instead to make something like this:
CString headers;
file->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF,headers);
to get the headers and then parse them to find the id I'm searching.
Well, now the problem is that this id has been put in the Content-type header; intercepting the raw HTML data, I saw things look like: "Content-type: multipart/x-mixed-replace\r\n\r\nid=the_id_i_want_to_have\r\n".
Sorry to say, but headers comes out to be "HTTP/1.0 200 Push Service\r\nContent-type: multipart/x-mixed-replace\r\n\r\n"; it ends exactly at the beginning of the section I'm interested to.
I tried all I could to get the whole headers out of a CHttpFile, using all the HTTP_QUERY_XXX constants, but with no success.
Can somebody help me?
Thank you very much,
Piero.
|
|
|
|
|
I writing some application that need to run until the machine is shutdown.
This application need to run like service but without been a service.
I dont know what technics to use to let the application run all the time without stop ( when return from the main thread ).
I can use GUI application and not show the main dialog - but i prefer some other technique.
|
|
|
|