|
There is a general database forum where you might get help.
I certainly have no clue about your problem... And as I am the bestest ever expert at C++, noone else will.
(Ok, they might...)
Iain.
|
|
|
|
|
OK. This time you've hit the target [^].
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]
|
|
|
|
|
CPallini wrote: This time you've hit the target
Iain, The Masterful Visionary Potentate.
|
|
|
|
|
A database column with a font?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: A database column with a font?
The last resort to evangelize software developers.
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]
|
|
|
|
|
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 )
|
|
|
|
|
I am using the picture control as horizontal line in my dialog with height 2 pixel.
How to change its color?
Advance thanks for help!!
|
|
|
|
|
Handle the WM_CTLCOLORSTATIC message and return the required brush.
« Superman »
|
|
|
|
|
The color is changed only after I changed Picture control type to image.
Thanks
|
|
|
|
|
I think it desont work if you change type of static control to horizontal.
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 )
|
|
|
|
|
Hai All
Crash occured while displaying Color Chooser Dialog form a Property Sheet
CHOOSECOLOR* pstChooseColor = new CHOOSECOLOR;
ZeroMemory( pstChooseColor, sizeof( CHOOSECOLOR ));
pstChooseColor->Flags = CC_RGBINIT;
pstChooseColor->lStructSize = sizeof( CHOOSECOLOR );
pstChooseColor->hwndOwner = m_hWnd;
pstChooseColor->rgbResult = ConfigMgr::Instance().GetBkColor();
ChooseColor( pstChooseColor );
called from the DialogProc of PropertyPage
case WM_COMMAND:
{
int nCtrlCode = LOWORD( wParam_i );
if( IDC_BTN_CHANGE_COLORS == nCtrlCode )
{
pDisplaySettingsPage->OnChangeColor();
}
}
break;
Please help
|
|
|
|
|
Use your debugger to track the problem more in detail. Where does the crash occur exactly ? What does the call stack look like ?
|
|
|
|
|
COMDLG32! 763bdbd2()
COMDLG32! 763bdf24()
USER32! 77d48709()
USER32! 77d551cd()
USER32! 77d54af2()
USER32! 77d54d1c()
USER32! 77d48709()
USER32! 77d487eb()
USER32! 77d4b743()
USER32! 77d558ef()
USER32! 77d56877()
USER32! 77d568cc()
COMDLG32! 763bedf2()
COMDLG32! 763bf019()
DisplaySettingsPage::OnChangeColor() line 91 + 12 bytes
DisplaySettingsPage::DisplaySettingsPageDlgProc(HWND__ *
May be useful
|
|
|
|
|
Radhakrishnan G. wrote: May be useful
Not really for us. In fact for these kind of problems, you'll have to find the root cause yourself and fix it. There's no magic way of solving the problem. Use the call stack to locate the problem in your code, put breakpoints before the crash occur and inspect the different variables.
The exception means that you are trying to access an invalid memory region (e.g reading or writing to a NULL pointer, ...)
|
|
|
|
|
Radhakrishnan G. wrote: pDisplaySettingsPage->OnChangeColor();
I saw the callstack and could you please check whether pDisplaySettingsPage a valid pointer when the function is being called?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Here is the code of Dialog Proc
INT_PTR CALLBACK DisplaySettingsPage::DisplaySettingsPageDlgProc( HWND hWnd_i,
UINT uMessage_i,
WPARAM wParam_i,
LPARAM lParam_i )
{
DisplaySettingsPage* pDisplaySettingsPage = reinterpret_cast<displaysettingspage*>( GetWindowLong( hWnd_i, GWL_USERDATA ));
switch (uMessage_i)
{
case WM_INITDIALOG:
{
pDisplaySettingsPage = reinterpret_cast<displaysettingspage*>( lParam_i );
if( 0 != pDisplaySettingsPage )
{
SetWindowLong( hWnd_i, GWL_USERDATA, lParam_i );
pDisplaySettingsPage->m_hWnd = hWnd_i;
pDisplaySettingsPage->OnInitDialog();
}
return TRUE;
}
break;
case WM_CTLCOLORSTATIC:
{
if( IDC_STATIC_BKCOLOR == GetDlgCtrlID( (HWND)lParam_i ))
{
RECT stRect;
GetClientRect( (HWND)lParam_i, &stRect );
FillRect( (HDC)wParam_i, &stRect, pDisplaySettingsPage->m_hBkBrush);
return (BOOL)GetStockObject(NULL_BRUSH);
}
}
break;
case WM_NOTIFY:
{
NMHDR* pstNMHDR = reinterpret_cast< NMHDR*>( lParam_i );
if( PSN_APPLY == pstNMHDR->code )
{
}
}
break;
case WM_COMMAND:
{
int nCtrlCode = LOWORD( wParam_i );
if( IDC_BTN_CHANGE_COLORS == nCtrlCode )
{
pDisplaySettingsPage->OnChangeColor();
}
}
break;
}
return DefWindowProc( hWnd_i, uMessage_i, wParam_i, lParam_i );
}
Here is the Display setting page class
class DisplaySettingsPage
{
public:
DisplaySettingsPage();
~DisplaySettingsPage();
operator LPPROPSHEETPAGE();
static INT_PTR CALLBACK DisplaySettingsPageDlgProc( HWND hWnd_i, UINT uMessage_i,
WPARAM wParam_i, LPARAM lParam_i );
void OnInitDialog();
void OnChangeColor();
private:
HWND m_hWnd;
HBRUSH m_hBkBrush;
PROPSHEETPAGE m_stPropertyPage;
};
Initializing Property page information in constructor
DisplaySettingsPage::DisplaySettingsPage() : m_hWnd( 0 ),
m_hBkBrush( 0 )
{
ZeroMemory( &m_stPropertyPage, sizeof( PROPSHEETPAGE ));
m_stPropertyPage.dwSize = sizeof( PROPSHEETPAGE );
m_stPropertyPage.dwFlags = PSP_DEFAULT;
m_stPropertyPage.pszTemplate = MAKEINTRESOURCE( IDD_DISPLAY_SETTINGS_PAGE );
m_stPropertyPage.lParam = reinterpret_cast<lparam>( this );
m_stPropertyPage.hInstance = GetModuleHandle( 0 );
m_stPropertyPage.pfnDlgProc = DisplaySettingsPageDlgProc;
}</lparam>
modified on Tuesday, January 6, 2009 5:55 AM
|
|
|
|
|
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
|
|
|
|