|
Radhakrishnan G. wrote: DisplaySettingsPage* pDisplaySettingsPage = reinterpret_cast<displaysettingspage*>( GetWindowLong( hWnd_i, GWL_USERDATA ));
is there two different classes - DisplaySettingsPage & displaysettingspage? Or is it a typo while pasting the source code?
Whether DisplaySettingsPage::m_hWnd holds valid handle? Please check by using debugger. If that one doesn't give you any hint, please post code snippet for OnChangeColor() .
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
The crash occurs because you haven't set value of lpCustColors in the code.
COLORREF clrCust[16] = {0};
pstChooseColor->lpCustColors = clrCust;
ChooseColor( pstChooseColor );
Radhakrishnan G. wrote: Crash occured while displaying Color Chooser Dialog form a Property Sheet
1. Why did you say the crash is from property sheet?I think the crash should occur in all cases, not only when called from property sheet
|
|
|
|
|
Got the solution
code is updated with
CHOOSECOLOR* pstChooseColor = new CHOOSECOLOR;
COLORREF crCustomColorArray[ 16 ];
ZeroMemory( pstChooseColor, sizeof( CHOOSECOLOR ));
pstChooseColor->Flags = CC_RGBINIT;
pstChooseColor->lStructSize = sizeof( CHOOSECOLOR );
pstChooseColor->hwndOwner = m_hWnd;
pstChooseColor->lpCustColors = crCustomColorArray;
pstChooseColor->rgbResult = ConfigMgr::Instance().GetBkColor();
if( FALSE != ChooseColor( pstChooseColor ))
{
ConfigMgr::Instance().SetBkColor( *pstChooseColor->lpCustColors );
}
delete pstChooseColor;
pstChooseColor = 0;
Thanks
|
|
|
|
|
I know you've fixed your problem - just a comment on style. Why not use a locally declared CHOOSECOLOR rather than one on the heap? That way, you don't need to remember to delete it.
Your (fixed) code would look like this:
CHOOSECOLOR stChooseColor = { 0 };
COLORREF crCustomColorArray[ 16 ] = { 0 };
stChooseColor.Flags = CC_RGBINIT;
stChooseColor.lStructSize = sizeof( CHOOSECOLOR );
stChooseColor.hwndOwner = m_hWnd;
stChooseColor.lpCustColors = crCustomColorArray;
if( FALSE != ChooseColor( &stChooseColor ))
{
ConfigMgr::Instance().SetBkColor( *stChooseColor.lpCustColors );
}
I know it's not a big change, but using the stack for variable storage when possible makes memory management so much easier
One other thing - doesn't ChooseColor pass back the user's selected color in the rgbResult member, rather than in lpCustColors[0] , as you've used? That's what the documentation[^] says, anyway.
|
|
|
|
|
Yes thats was the Mistake in the code
I already corrected that..
Thanks.
|
|
|
|
|
Hey everybody!
I got a weird problem...
I wrote a service that in startup run CreateService to get handle to another service (which is a file system driver...).
For some weird reason the call halts for 2.5 minutes and continues successfully after that.
Does anyone have any idea what might be the problem?
THANKS!!!
|
|
|
|
|
What is the dwStartType of the service your creating? if its SERVICE_AUTO_START the documentation for the StartService Function[^] states:
A service cannot call StartService during initialization. The reason is that the SCM locks the service control database during initialization, so a call to StartService will block. After the service reports to the SCM that it has successfully started, it can call StartService.
As with ControlService, StartService will block for 30 seconds if any service is busy handling a control code. If the busy service still has not returned from its handler function when the timeout expires, StartService fails with ERROR_SERVICE_REQUEST_TIMEOUT. This is because the SCM processes only one service control notification at a time.
You stated that it hangs for 90 seconds which looks suspiciously like 3 blocked calls to StartService.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi all,
i am using a function to retrieve drive letter of a USB device from WMI witht he supplied device id ("USB\VID\_0930&PID_652A\0F70985022G8HI") in the format as shown.
using this device ID which i retrieve from win32_USBHub i have to get the drive letter for the USB device corresponding to the device ID.
so can i get some help on how to map the drive letter for the corresponding device id from WMI??
Thanks..
|
|
|
|
|
Check this![^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Did you see Win32_DiskDrive Class? of course its a thread but its vb[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
hi Experts,
I m working on fonts..
and i need to get all installed fonts on my machine or
the WindowsXp fonts(shown at fonts directory);
so is there any Class/Object/method/library function
so that i can get the list of all installed fonts and
I can check whether specific font is installed on my machine or not..
plz help me.....
thanx in advace..
waitng for ur reply........
regards,
Victory.......
|
|
|
|
|
|
Congratulations Mr.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Congratulations to you also. The mail from Chris was a surprise to me. I had no clue.
|
|
|
|
|
Naveen wrote: The mail from Chris was a surprise to me. I had no clue.
That's not really a surprise to me: you've been helping quite much in the C++ forum this year. Congrats to you !
|
|
|
|
|
Thanks Cedric.
BTW Congrats to you and to all other MVP's here...
|
|
|
|
|
Do you know that c++ forum has uppermost mvp on the codeproject?
btw Congrats to you again Cedric
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Exactly my first mail was of Chris and second mail was of Mr CPallini(where is he,he's sleep ?)
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hamid. wrote: where is he,he's sleep Laugh?
He can't be sleeping!
He know's when you've been skillful, he know's when you've been noobish...
Iain.
|
|
|
|
|
BTW CONGRATULATION Iain.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Aww group hug
Seriously though, congrats
Now that I'm a certified thread hijacker, I had to do it...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hamid. wrote: Btw did you see blog of pallini "The first THHB's member of the year: Mark Salsbery"
I did! That's why I had to hijack this thread
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh yeah
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Thanx 4 ur reply.
I have try this..but somewhree my logic or steps are incorrect..
can u plz send me an example sothat I can check my code...
my sample code is so confusing thats why i couldnt paste it here....
plz help me..
I need this deadly...
send me an step wise example of EnumFontFamiliesEx API to get
list of Installed fonts on my machine...
I m waitng for ur reply..
.........
victory
|
|
|
|