|
I'm trying to figure out how to get the color Visual Studio .NET uses for the inactive/background color of its own tab controls. In Blue and Green mode, they use pale yellow, in Silver mode, they use white.
I wrote a quicky app to show the colors from GetSysColor() to no avail. Why do I suspect they use yellow unless they detect the silver color scheme is in use?
Joe Woodbury
"If other countries wanted their opinions to matter, they shouldn't be so small and weak." -- Ari Fleischer according to Frank J. (Parody at IMAO[^])
|
|
|
|
|
Can someone explain difference between these in an easy way to me :
const char *p="Test" ;
char const *p="Test";
char * const p="Test";
const char * const p ="Test";
|
|
|
|
|
act_x wrote:
const char *p="Test" ;
A pointer to a constant string - i.e. the pointer can be changed to point somewhere else, but the string itself is constant.
act_x wrote:
char const *p="Test";
Same as const char*.
act_x wrote:
char * const p="Test";
A constant pointer to a non-constant string - i.e. the string can be changed, but the pointer cannot be changed to point to something else.
act_x wrote:
const char * const p ="Test";
A constant pointer to a constant string - i.e. neither the string nor the pointer can be changed.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
A constant pointer to a non-constant string - i.e. the string can be changed, but the pointer cannot be changed to point to something else.
That is the beauty of C++, pointers.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hello,
I'm interested in the process behind the LVSCW_AUTOSIZE_USEHEADER used to set the width of the header control of a CListCtrl.
Does anybody know how they calculate the exact width of the text. This is based of the font used.
What is I want to write this myself?
m_cListCtrl.SetColumnWidth(i, CString("This is Column1).GetLength())
gives me the length of the string (15 points), but what I think I need to do is multiply this length by the average length (in points) of the characters used in the string.
Let's say a character average width is 6 points, my header will be 15 (=GetLength)*6, which is a reasonable width for the header.
Anybody knows of such a function. Or how I really should tackle this?
Thanks in advance
Wim
|
|
|
|
|
Wim Jans wrote:
Does anybody know how they calculate the exact width of the text.
CListCtrl::GetStringWidth() would be one way.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
And a nice way to do it!
Just fits my needs.
Thanks for that
|
|
|
|
|
I have a dialog as a child window to a CSizingControlBar. The dialog was created using the resource editor with 5 button controls at the top of it. At run time I dynamically add CListCtrls to it (the number of list controls will vary - depends on how many the user wants). The issue I am having is with the scroll bars when a new control is added while the scroll bar is scrolled down (not at the top position) the list controls get properly added in the right position but when I scroll back to the top of the dialog because I reset my scroll position to 0 before I add the new controls my original static controls are no longer there - They seem to disappear
If anyone can tell me what I am doing wrong I would greatly appreciate it
Thank you
|
|
|
|
|
I am getting this very strang problem while tracing my program with VS 6.0 debugger.
my program is written in VC++ 6.0, and it runs fine in release mode and in debug mode if I don't step into any functions.
But,my system looks like dead( freeze, stuck, what ever...) if I try to step into the program. This could happen any where in the program, it even happened at one line which contains only simple assignment statement (like: int x= 1;).
Would anybody give me some clues on this problem? Why do I get this? How to fix it?
Thank you very much in advance!
|
|
|
|
|
I see this from time to time, usually when debugging multithreaded apps on XP. Never noticed it on W2K. Ofter press Ctrl+Alt+Del to bring up Task Manager brings it back to life. That is the only solution I've found.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Which message do I need? I am trying NM_CLICK, and in that handler I check to see if any of my items is checked (have checkboxes). Problem is, the first item I click, triggers the event and the code steps into the function where I look for a checked item:
void CDlgFTP::OnClickLstftp(NMHDR* pNMHDR, LRESULT* pResult)
{
for( int index = 0; index < m_lstFiles.GetItemCount(); index++)
{
BOOL chk = m_lstFiles.GetCheck(index);
if (chk)
{
m_bGet.EnableWindow(TRUE);
}
}
*pResult = 0;
}
but this time around, chk is 0, but when I check the second item, and step into the code, the chk for element # 1 becomes 1, since its now checked. SO it looks like I am triggering my checkbox checking code prematurely. What message should I use instead?
Basically I want a button to get enabled when any item is selected in the listctrl.
Thanks,
ns
|
|
|
|
|
Hi!
I added a menu to my dialog (through the Wizard) and I can't get any command notification from it.
ON_COMMAND(ID_SOME_COMMAND, OnSomeCommand)
void CSomeClass::OnSomeCommand()
{
}
OnSomeCommand never gets called. I did notice, however, that I do get a message in my DefWndProc function (message 273) but lParam = 0, when it should equal ID_SOME_COMMAND. What's wrong?
I'm using MFC's CDialog class...
Thanks for your help!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
Is CSomeClass a CDialog -derived object?
Is ID_SOME_COMMAND assigned to any of the menu items?
LukeV wrote:
...I do get a message in my DefWndProc function...
Are you using .NET?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I'm using MFC's CDialog class...
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
|
Found the problem... I was using ModifyMenu to change the menu item's text, and it was setting the ID to 0.
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
In a header file of one of my classes I have a private two dim array,
<br />
double V[][6] = {<br />
{-.01,0,0, -.2,-.2,1},
{.1,0,0, .2,-.2,1},<br />
{0,.11,0, -.2,.2,1},<br />
{.08,.09,0, .2,.2,1}<br />
};<br />
but this gives me a compiler error. It says "syntax error : '{'" and
"unexpected token(s) preceding '{'; skipping apparent function body".
Does anyone know why? All I want to do is declare and initialize it.
Also, lets say I have a 3-dim array, (which I cant initialize either until I fix my first problem)
<br />
double polygon[][][] = {<br />
{ V[0], V[1], V[2] },<br />
{ V[1], V[2], V[3] }<br />
};<br />
and I need a for loop to go thru polygon. I want to do something like:
<br />
for (int n = 0 ; n < polygon.length ; n++)<br />
for (int i = 0 ; i < polygon[n].length ; i++) {<br />
for (int k = 0 ; k < 3 ; k++)<br />
normal[k] = polygon[n][i][k+3];<br />
What do I replace the bold & underlined with? Would it be sizeof(polygon)/sizeof(polygon[0]) for the outer loop and sizeof(polygon[0])/sizeof(polygon[0][0]) for the inner?
This stuff confuses me.
Thanx for the help,
-Flack
|
|
|
|
|
I got no errors with your two-dimensional array.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Here is the entire header file:
<br />
<br />
#include <windows.h><br />
#include <math.h><br />
#include "Pix.h"<br />
<br />
class ZBuffer1 {<br />
<br />
private:<br />
double V[][6] = {<br />
{-.01,0,0, -.2,-.2,1},
{.1,0,0, .2,-.2,1},<br />
{0,.11,0, -.2,.2,1},<br />
{.08,.09,0, .2,.2,1}<br />
};<br />
<br />
double polygon[3][3][3];<br />
<br />
double L[1][3];<br />
<br />
double rgb[3];<br />
double p[30][7];
<br />
double FAR_Z;
double * zbuffer;<br />
double normal[3];<br />
<br />
int W, H;<br />
<br />
void init();<br />
<br />
void clearZbuffer();<br />
<br />
void projectVertex(double pt[], double p[]);<br />
<br />
void doShading(double pt[], double rgb[]);<br />
<br />
void displayPolygon(double polygon[][3]);<br />
<br />
<br />
void normalize(double v[]);<br />
<br />
double lerp(double t, double a, double b) {return a + t * (b - a);}<br />
<br />
int f2i(double t) {return max(0, min(255, (int)(255 * t)));}<br />
<br />
public:<br />
Pix pix;<br />
<br />
ZBuffer1(int, int);<br />
void setPix();<br />
};<br />
I try to compile and still get an error on the underlined line:
zbuffer1.h(14) : error C2059: syntax error : '{'
zbuffer1.h(14) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
I dont know what Im doing wrong.
|
|
|
|
|
Flack wrote:
I dont know what Im doing wrong.
You are trying to initialize that array within the class itself. Try this:
class ZBuffer1
{
private:
double V[][6];
public:
ZBuffer1();
};
ZBuffer1::ZBuffer1()
{
V[0][0] = -0.01;
V[0][1] = 0.0;
V[0][2] = 0.0;
V[0][3] = -0.2;
V[0][4] = -0.2;
V[0][5] = 1.0;
V[1][0] = 0.1;
V[1][1] = 0.0;
V[1][2] = 0.0;
V[1][3] = 0.2;
V[1][4] = -0.2;
V[1][5] = 1.0;
V[2][0] = 0.0;
V[2][1] = 0.11;
V[2][2] = 0.0;
V[2][3] = -0.2;
V[2][4] = 0.2;
V[2][5] = 1.0;
V[3][0] = 0.08;
V[3][1] = 0.09;
V[3][2] = 0.0;
V[3][3] = 0.2;
V[3][4] = 0.2;
V[3][5] = 1.0;
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I think you have to first accept that this is not very easy to do in C/C++. A 2D array is an array of pointer to more arrays. In a declaration you can only have one unknown dimension []. So your second example will not compile. The first one might be an error related to
The rest must be specified. V is a pointer to a pointer, V[n] is a pointer and v[n][m] is a value. The [m] operator is saying advance i + k*m spaces to obtain the location.
You need to either dynamically allocate this with multiple news or allocs, or use constants to create the space in memory in the first place, so it is far easier just to store the dimensions in an integer and use this in your loops.
J.
----------------------------
|
|
|
|
|
JWood wrote:
You need to either dynamically allocate this with multiple news or allocs, or use constants to create the space in memory in the first place, so it is far easier just to store the dimensions in an integer and use this in your loops.
Or use C++.. vectors
John
|
|
|
|
|
Hey.
I was wondering if there was any way to get more than one line of text to appear in a static text control? I tried just putting a \n where I want the new line to start, but then any text after that is invisible.
So, I guess what I'm asking, is how do I turn:
43 text
into:
43
text
without using 2 separate static text boxes? (is this possible?)
|
|
|
|
|
|
*ahem*
thanks. stupid mistake. it was only large enough for one line, not both. haha. sorry!!!
|
|
|
|
|