|
Let the m_list be the object of the list control.
You get the Extended style of the list control and check it as in the If statement....
m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_CHECKBOXES );
if(m_list.GetExtendedStyle() & LVS_EX_CHECKBOXES)
{
AfxMessageBox("LVS_EX_CHECKBOXES Set");
}
else
{
AfxMessageBox("LVS_EX_CHECKBOXES Not Set");
}
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Hello All,
I have an MFC application. In my application I create an instance of IE, and browse to some link, say "www.Adserver.com".
After hitting to this link, I always receive an image from the "www.Adserver.com", I will get different image everytime I hit this URL.
I need to display this image on one of my dialog in my application, hence I need the handle to URLCacheEntry maintained by window for IE.
To get this handle I can use the function GetUrlCacheEntryInfo( IN LPCSTR lpszUrlName,...); however the input parameter to this function "IN LPCSTR lpszUrlName" is something I need to extract from the running instance of IE, which is displaying this image.
We can assume that always there will be a single image displayed in IE.
Thanks in advance for your replies.
Suyash
|
|
|
|
|
when source pass with null value the len will be 0.
but due to effect of that tempOutFile create the garbage value I need to clear it with null value.
<code>
string Utility::ConvertWCHARToString(LPCWSTR source)
{
try
{
size_t len = wcslen(source) * sizeof(LPCWSTR);
char* tempOutFile= new char[len];
WideCharToMultiByte(CP_ACP,0,source,-1,tempOutFile,(int)len,NULL,NULL);
string s = tempOutFile;
if(tempOutFile)
{
delete[] tempOutFile;
}
return s;
}
catch(exception ex)
{
throw ex;
}
}
I have try to intialize the value explicitly but it didn't work(crash application).
like
if(len==0)
tempOutFile=NULL;
|
|
|
|
|
amitmistry_petlad wrote: char* tempOutFile= new char[len];//tempOutFile=Garbage valve need tempOutFile =""
Modify this to,
char* tempOutFile = NULL;
if (len)
{
tempOutFile = new char[len];
}
|
|
|
|
|
This is for my master
I did it but it gives bad pointer and application crashed!!!
|
|
|
|
|
You are not supposed to use code following , if len in question is 0 .
|
|
|
|
|
yes ,i have do it. I had compare when got NULL then return s="".
|
|
|
|
|
Then, its definitely due to code, you have not shown here. Can you explain, how you are using this function, and where you are facing problem.
|
|
|
|
|
I think you also have a problem here:
size_t len = wcslen(source) * sizeof(LPCWSTR);
wcslen(source) should give you the length you need - but then you are multiplying it by sizeof(LPCWSTR) which is 4 bytes since it's a pointer. That really isn't necessary.
You should then be able to wrap the rest in an if:
if (len > 0)
{
char* tempOutFile= new char[len];
WideCharToMultiByte(CP_ACP,0,source,-1,tempOutFile,(int)len,NULL,NULL);
string s = tempOutFile;
if(tempOutFile)
{
delete[] tempOutFile;
}
return s;
}
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi friends,
What is the Max limit of the number of bytes copied from Source to Destination in mempcy ??
Thanks in advance.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
Hi,
The maximum limit is mostly compiler dependent.
It will be the maimum size of "size_t" .
i.e : "size_t" is an alias of "unsigned long" , so the maximum size of "unsigned long" is ULONG_MAX
Note : ULONG_MAX is 4294967295
Regards,
vinsankar
|
|
|
|
|
Vinod A Sankaranarayanan wrote: It will be the maimum size of "size_t" .
that's right
Vinod A Sankaranarayanan wrote: i.e : "size_t" is an alias of "unsigned long"
wrong here. unsigned long is always 4 bytes, even on 64 bits systems; size_t is 8 bytes on 64 bits systems
|
|
|
|
|
toxcct wrote: unsigned long is always 4 bytes, even on 64 bits systems;
Actually, unsigned long is 8 bytes on most 64-bit Unix systems; the Standard does not specify the size of unsigned long
|
|
|
|
|
Nemanja Trifunovic wrote: the Standard does not specify the size of unsigned long
doesn't it ?
AFAIK, only [signed | unsigned] int s weren't specified...
short and long still length to 2 and 4 bytes respectively
|
|
|
|
|
toxcct wrote: doesn't it ?
Nope[^], it pretty much guarantees only minimal sizes for integer types. As I said, on most 64-bit Unix systems, long is 64 bits.
|
|
|
|
|
I always thought it was that way too
Either I was always wrong or the C standard has been changed since I first learned this.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
the game seems to be over for us... let's go back to school ! lol
|
|
|
|
|
|
Thanks everyone..
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
I have a call to WaitForMultipleObjects() which waits for any of 4 events to happen ...but the statements after the call to WaitForMultipleObjects() are not executed.
i am not able to debug and get wat value is returned by the call WaitForMultipleObjects()
thanks in advance
|
|
|
|
|
What does your code look like?
Post the call to WaitForMultipleObjects() and its surroundings and please use <pre> / </pre> tags when posting code.
Are you absolutely sure that WaitForMultipleObjects() is called? Place a breakpoint on it to verify this.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Shaileshhex wrote: but the statements after the call to WaitForMultipleObjects() are not executed.
Even if you use a timeout value? If you never get past a wait function then none of the objects
were signalled.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
hi...
Thanks for ur replies...
i think ur right may b the event is not signalled.... code is as below
aslso its not my code and, event created is ITC_APP_EVENT_RIGHTSCAN...i have no idea where ITC_APP_EVENT_RIGHTSCAN comes from.....
hCenterDelta=CreateEvent(NULL, FALSE, FALSE, _T("ITC_APP_EVENT_CENTERSCAN"));
hCenterState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_CENTERSCAN"));
hRightDelta=CreateEvent(NULL, FALSE, FALSE,_T("ITC_APP_EVENT_RIGHTSCAN"));
hRightState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_RIGHTSCAN"));
hLeftDelta=CreateEvent(NULL, FALSE, FALSE, _T("ITC_APP_EVENT_LEFTSCAN"));
hLeftState=CreateEvent(NULL, TRUE, FALSE, _T("ITC_APP_STATE_LEFTSCAN"));
hIRDAReset=CreateEvent(NULL, TRUE, FALSE, _T("NOTIFICATION_EVENT_WAKEUP"));
h = CreateEvent( NULL, TRUE, FALSE, EVENTNAME_KEYBOARD_CHANGE );
if ( h != INVALID_HANDLE_VALUE ) {
SetEvent( h );
CloseHandle( h );
} // end if
//the closed event
hClosed = CreateEvent(NULL,TRUE,FALSE,_T("RfidCloseEvent"));
HANDLE hObjectList[] =
{
hClosed,
hCenterDelta,
hRightDelta,
hLeftDelta,
hIRDAReset
};
while (1)
{
DWORD wc = WaitForMultipleObjects(
sizeof(hObjectList)/sizeof(HANDLE), // number of handles in array
hObjectList, // object-handle array
FALSE, // wait option
(DWORD) INFINITE // time-out interval
);
//THE breakpoint holds at this point...
switch ( wc)
{
WAIT_OBJECT_0 + 2: //Center button
if (WaitForSingleObject(hRightState,0)==WAIT_OBJECT_0)
{
//some code
}
etc..etc..
}
}
LET ME KNOW UR THOUGHTS
bye
|
|
|
|
|
The only thing I see in your code sample is
WAIT_OBJECT_0 + 2: //Center button
WAIT_OBJECT_0 + 2 corresponds to the hRightDelta event handle, not the hCenterDelta event handle.
Remember the array is indexed from 0
If you put a breakpoint on the switch ( wc) line and execution never pauses there then none of the
five events eing waited on are getting signalled.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
hi Mark...
I found that the events ITC_APP_EVENT_RIGHTSCAN etc ..were not present in the devices registry...so i added these events ..but still that event does not get signalled ....
my device uses WIN CE 3.0...but the event gets signalled for another device which has WINCE 4.2
does this mean that 3.0 does not recognise ITC_APP_EVENT_RIGHTSCAN??...if so then how do i find which is the correct event
thanks
|
|
|
|