|
Thanks for the suggestion. However it gave me some link errors explained below.
I initially added the InitCommonControls() function right before this line
DialogBox(hInst, (LPCTSTR)IDD_SPECDIRBOX, hDlg, (DLGPROC)SpecifyDirectory);
I got this linker error
error LNK2019: unresolved external symbol __imp__InitCommonControls@4 referenced in function "long __stdcall AddRecord(struct HWND__ *,unsigned int,unsigned int,long)" (?AddRecord@@YGJPAUHWND__@@IIJ@Z)
I then tried replacing that function because Microsoft says it is obsolete and has been replaced by
bool InitCommonControlsEx(LPINITCOMMONCONTROLSEX lpInitCtrls);
So now instead of just InitCommonControlsEx(); I have
INITCOMMONCONTROLSEX iccex; // INITCOMMONCONTROLSEX structure
iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);
iccex.dwICC = ICC_TREEVIEW_CLASSES;
InitCommonControlsEx (&iccex);
which is exactly the same as a MS example.
I got the same error
error LNK2019: unresolved external symbol __imp__InitCommonControlsEx@4 referenced in function "long __stdcall AddRecord(struct HWND__ *,unsigned int,unsigned int,long)" (?AddRecord@@YGJPAUHWND__@@IIJ@Z)
Any suggestions as to what to do next?
Thanks
Nitin
|
|
|
|
|
Hi
I just solved the problem by adding the COMCTL32.LIB to my library includes.
Thanks
Nitin
|
|
|
|
|
ok i have a question...
I am working on a project right now whos base class is CFormView... When i create dialog boxes from the main application they do not minimize into the taskbar - instead they minimize to the bottom of the screen just above the taskbar area... Is there anyway to make these dialog boxes minimize into the taskbar - for example - AOL INSTANT MESSENGER - each chat conversation box that opens up minimizes into the taskbar and eventually they start stacking up on each other....
is there a setting i have to change in the dialog boxes properties? perhaps change the owner of the window???
HELP!
-kevin
|
|
|
|
|
Hi All,
I've put some macros together, and I would like to see what my code looks like after the macros have been handled by the preprocessor. I remember that there is a way to do this in Visual Studio, but I can't rememebr exaclty how.
Anyone know?
Thanks
|
|
|
|
|
You can use the /E switch (preprocess to stdout) or /P switch (preprocess to a file). Run cl /? for a full list of switches.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hello,
How to round a number into nearest integer in C++?
Is there any function to do that?
THX!!!
|
|
|
|
|
double a_bouble_val = 23,34;
int an_integer = (int)a_double_val;
This small code will assign an_integer to 23.
double a_bouble_val = 23,7;
int an_integer = (int)a_double_val;
This, will assign an_integer to 24.
Did I understand you?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
double a_bouble_val = 23,7;int an_integer = (int)a_double_val;
This, will assign an_integer to 24.
Actually, this will evaluate to 23. Casting a double to an int will always round to the whole number given (down for positive numbers, up for negative)
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
You can use floor() , ceil() , or just cast to an int eger.
This code rounds a value to the nearest integer.
int rounded = (int)(doubleval + 0.5);
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
it rounds up, to the nearest integer.
this goes both ways.
int i = (d > 0 ? (int)(d + 0.5) : (int)(d - 0.5));
-c
WWT2D?
|
|
|
|
|
It's a little more complicated if you are going to be dealing with both positive and negative numbers, as the floor() function moves the decimal number toward zero and the ceil() function moves the decimal number away from zero. The value of floor(-23.7) is -23, where rounded you probably would want -24. Adding 0.5 to the value before casting to an int works only for positive values, and not for negatives. There, you would have to subtract.
floor(-23.7 - 0.5) = floor(-24.2) = 24<br />
floor( 23.7 + 0.5) = floor( 24.2) = 24
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
|
show yur code where you subclass it.
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
BOOL CMyStatic::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CStatic::PreCreateWindow(cs)) { return FALSE; }
cs.style |= SS_OWNERDRAW;
return TRUE;
}
void CMyStatic::PreSubclassWindow()
{
CStatic::PreSubclassWindow();
ModifyStyle(0, SS_OWNERDRAW);
}
I did both just to make sure. Winspector Spy shows SS_OWNERDRAW style in the window styles, but no call to DrawItem occurs.
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
what about the code creating the instance of CMyStatic on the toolbar?
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
|
Good question, i remember there are issues with toolbars and messages not getting routed. i think that the solution is to override PreTranslateMessage and handle them ur self.
Did you watch messages with spy and see if the frame or dialog is receiving the DRAWITEM for that window?
-pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
|
|
Well i don't believe CStatic get input focus. Perhaps you just need a custom window so derive from CWnd. Then do ur OnPaint handler. For focus rect drawing look at CDC::Draw3dRect/DrawEdge/DrawState
Something there should do the trick.
-pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
WM_DRAWITEM is not sent to the owner draw control but to the owner window (the dialog it is on) of the control.
No need to subclass...
Oliver
|
|
|
|
|
I have created a List box using CreateWindow in my app's client area. Is there any way I can make the background of my list box transparent so that it is the same color as the background of my main window?
Thanks in advance,
Paddy.
|
|
|
|
|
Get the handle to the device context of the listbox (HDC) and use the Win32 function SetBkColor to set the color you want.
For more, see function SetBkColor in MSDN.
If you would like to use the same color as in your main window, you first have to get the standard color of your window, which is usually done by a call to GetSysColor.
Hope this helps,
-Dominik
|
|
|
|
|
ummm i don't believe that 'transparent' is the same as setting the background color to the same as the background window. Not to mention how do you know what window and what background color it is, and what about if it has something in it... or am I totaly lost?
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
I understand what you are saying, they are not the same thing but for this particular case changing the background colour will work fine for me.
Thanks,
Paddy.
|
|
|
|