|
Thanks gscotti!
1.
"If possible, use references on arguments to functions and members of your class" -- could you show some code please? I want to learn your best practice, but I do not understand until I see some code.
2.
gscotti wrote: Beware of your design. It is a very common practice to stack everything on "multi-purposed" classes. Every class has a purpose. If you stick with that in mind, probable your class will be split to several ones, and you'll find lots of issues.
Confused about your points above. Do you mean it is good practice to make a class big to contain a lot of stuff other than split?
regards,
George
|
|
|
|
|
Hi,
On Remarks section, MSDN documentation of CListCtrl:SetItemState its written that SetItemState may be used for hiding or disabling items on the List. I tried to find the state bits for hiding or disabling any item but i couldn't.
Do you have any idea?
Thanks,
Cem
|
|
|
|
|
I suppose the remark section is suggesting a usage (i.e. your application should implement it) for the bits not directly used by the List Control itself.
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]
|
|
|
|
|
Hi all
I am trying to compile my project reach of templates but at one point I continuously receive the following errors
error C2471: cannot update program database 'і'
fatal error C1083: Cannot open program database file
followed by a long list of
fatal error C1090: PDB API call failed, error code '23' : '(
Looking for error C1090 Microsoft refers this error to something that sounds like "data allocation exceeds 64K ..The specified segment has grown beyond 32 kilobytes, the maximum for data segments. You will need to reduce the size of the segment."
My question is also "How to reduce the size of the segment" ? I was not able to find a way to dfo that?
Kind regards
ManuStone
|
|
|
|
|
I don't understand the exact nature of the problem, but it sounds like Visual Studio has become confused. In this situation resetting the state of your project will sometimes fix the error.
So, rename your Debug and Release folders (to eliminate them, but keep the possiblity of restoring them), and do a Rebuild Solution.
|
|
|
|
|
Yes, this tips was useful!
At the end my code compiles and my 3-days headache went away!
Ciao
Manustone
|
|
|
|
|
Hello there,
I've made ActiveX control which is used in my webpage to get client's system information.
I followed the article http://www.codeproject.com/KB/COM/CompleteActiveX.aspx[^] to create and sign the control.
In short I followed this steps:
1. the control is created and is marked as safe
2. The control is packaged into the cab file
3. The cab file is signed by class3 digital certificate issued by Thawte
4. The control is now embedded into the web-page.
The command used for creating cab file and signing it are
c:\cabsdk\bin\cabarc -s 6144 N SystemCheck.cab SystemCheck.ocx SystemCheck.inf
signcode -n "SystemCheck" -i http:
Now when I run the control it runs from most of the machines but from some machines it gives "Unknown publisher" Error.
The page is hosted online and is available at http://92.61.60.4/vod/SystemCheck1.htm[^]
Please note that I do not get unknown publisher error in all machines.
Thanks in advance...
|
|
|
|
|
Hi all,
I m using a Resizing property for List Control in Dialog an in FormView.
I want to get total size or total width of list control.
Can anybody tell me how can i get total size or total width of list control.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
I think he needs the size of the content area... he might needs to avoid the scrollbar...
|
|
|
|
|
Hi all..
I'm using AnimateWindow for Bubble window or PopUp window for Win98, Win 2000 and above... As i've to run my exe on Win95 and NT also so for that i'm making that window with the help of calculating coordinates and SetWindowPos. After that i fill my dialog box with some color..
So the problem is that whenever i run my code without using AnimateWindow it works fine.. But when i introduce AnimateWindow it shows a black border around dialog box.
Can anyone explain this??
Thank you..
|
|
|
|
|
Are you painting the border? How did you take the DC?
|
|
|
|
|
I'm painting Dialog Box...I mean i'm taking rectangle of dialog box and painting it with specified color... Using my function to paint dialog without AnimateWindow works fine...But with AnimateWindow the black border comes...
GradientFillRect(HDC (wParam), &thisWindowRect, startCol, endCol, TRUE);
This is my function to Gradient fill my dialog...
|
|
|
|
|
Where this function is called? Or respond to which message? Can you please show me a little of your code part...?
|
|
|
|
|
Sure.
Calling this function on WM_ERASEBKGND:
case WM_ERASEBKGND:
{
GetClientRect(hWnd, &thisWindowRect);
COLORREF startCol = RGB(174, 255, 194), endCol = RGB(230, 255, 236);
GradientFillRect(HDC (wParam), &thisWindowRect, startCol, endCol, TRUE);
}
thisWindowRect is Dialog Box Coordinates...
and here is my animate window code.
BOOL bLoadLib = FALSE;
HMODULE _user32 = GetModuleHandle("user32.dll");
if(_user32 == INVALID_HANDLE_VALUE || _user32 == NULL)
{
_user32 = LoadLibrary("User32.dll");
if(_user32)
bLoadLib = TRUE;
}
typedef BOOL (WINAPI *_AnimateWindowDT) (HWND,DWORD,DWORD);
_AnimateWindowDT _AnimateWindow;
if(_user32)
{
if((_AnimateWindow = (_AnimateWindowDT) GetProcAddress(_user32,"AnimateWindow")))
{
RECT windozeRect, thisWindowRect, SlideDialog;
int DialogLeft, DialogRight;
SystemParametersInfo(SPI_GETWORKAREA, 0, &windozeRect, 0);
GetWindowRect(hWnd,&thisWindowRect);
DialogLeft = thisWindowRect.right;
DialogRight = thisWindowRect.bottom;
thisWindowRect.left = windozeRect.right - DialogLeft - 8;
thisWindowRect.top = windozeRect.bottom - DialogRight- 5;
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
_AnimateWindow(hWnd, 300, AW_SLIDE | AW_VER_NEGATIVE);
bBack = TRUE;
}
else
{
RECT windozeRect, thisWindowRect, SlideDialog;
int DialogLeft, DialogRight;
SystemParametersInfo(SPI_GETWORKAREA, 0, &windozeRect, 0);
GetWindowRect(hWnd,&thisWindowRect);
DialogLeft = thisWindowRect.right;
DialogRight = thisWindowRect.bottom;
thisWindowRect.left = windozeRect.right - DialogLeft - 8;
thisWindowRect.top = windozeRect.bottom + 5;
SlideDialog.top = thisWindowRect.top;
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE );
for(;thisWindowRect.top > SlideDialog.top - 131; thisWindowRect.top--)
{
UpdateWindow(hWnd);
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
ShowWindow(hWnd, SW_SHOW);
Sleep(2);
}
bBack = TRUE;
}
}
And this whole code comes under WM_INITDIALOG:
modified on Thursday, October 9, 2008 5:36 AM
|
|
|
|
|
Please get me the code of GradientFillRect too...
|
|
|
|
|
void GradientFillRect(HDC hdc, LPRECT rcGradient, COLORREF start, COLORREF end, BOOL isVertical)
{
BYTE startRed = GetRValue(start);
BYTE startGreen = GetGValue(start);
BYTE startBlue = GetBValue(start);
BYTE endRed = GetRValue(end);
BYTE endGreen = GetGValue(end);
BYTE endBlue = GetBValue(end);
HBRUSH endColor = CreateSolidBrush(end);
FillRect(hdc, rcGradient, endColor);
DeleteObject(endColor);
int dy = 1;
int length = (isVertical ? rcGradient->bottom - rcGradient->top : rcGradient->right - rcGradient->left) - dy;
for (int dn = 0; dn <= length; dn += dy)
{
BYTE currentRed = (BYTE)MulDiv(endRed-startRed, dn, length) + startRed;
BYTE currentGreen = (BYTE)MulDiv(endGreen-startGreen, dn, length) + startGreen;
BYTE currentBlue = (BYTE)MulDiv(endBlue-startBlue, dn, length) + startBlue;
RECT currentRect = {0};
if (isVertical)
{
currentRect.left = rcGradient->left;
currentRect.top = rcGradient->top + dn;
currentRect.right = currentRect.left + rcGradient->right - rcGradient->left;
currentRect.bottom = currentRect.top + dy;
}
else
{
currentRect.left = rcGradient->left + dn;
currentRect.top = rcGradient->top;
currentRect.right = currentRect.left + dy;
currentRect.bottom = currentRect.top + rcGradient->bottom - rcGradient->top;
}
HBRUSH currentColor = CreateSolidBrush(RGB(currentRed, currentGreen, currentBlue));
FillRect(hdc, ¤tRect, currentColor);
DeleteObject(currentColor);
}
}
|
|
|
|
|
I just did a sample with your code, and it is working well... Ensure that the you return TRUE from WM_ERASEBKGND case.
|
|
|
|
|
Yes i am.. False would not fill my dialog with any color
case WM_ERASEBKGND:
{
GetClientRect(hWnd, &thisWindowRect);
COLORREF startCol = RGB(174, 255, 194), endCol = RGB(230, 255, 236);
GradientFillRect(HDC (wParam), &thisWindowRect, startCol, endCol, TRUE);
return TRUE;
}
Is it working well in your system?? No Black Border????
|
|
|
|
|
gothic_coder wrote: Is it working well in your system?? No Black Border????
Yes, my friend... Mine is WinXP.
|
|
|
|
|
BTW, Did you do something with WM_PRINT, WM_NCPAINT, etc?
|
|
|
|
|
Nah.. I'm not using these message handlers..
i'm using only.
WM_INITDIALOG
WM_CTLCOLORSTATIC
WM_ERASEBKGND
That's all...
|
|
|
|
|
What is in WM_CTLCOLORSTATIC? Let's look into that too...
|
|
|
|
|
WM_CTLCOLORSTATIC is where i make my static control transparent...
case WM_CTLCOLORSTATIC:
{
if(hwndstatic == GetDlgItem(hWnd, IDC_STATIC_TEXT)
{
HBRUSH hbr;
SetBkMode((HDC)wParam, TRANSPARENT);
hbr=(HBRUSH)GetStockObject(NULL_BRUSH);
return (LONG)hbr;
}
}
Defined hwndstatic as lparam...
|
|
|
|
|
This code seems as good...
If you can, please mail me full source... If I could reproduce the problem, there is some hope.
|
|
|
|
|