|
You need not derive any class from CTreeCtrl. You just have to set the style TVS_NOSCROLL using ModifyStyle function of the CWnd Class ( CTreeview is derived from CWnd hence inherits that function). Later you will not have the both vertical and horizontal scroll bar for the tree control.
Example
CTreeCtrl *x = (CTreeCtrl *)GetDlgItem(IDC_TREE1);
x->ModifyStyle(0,TVS_NOSCROLL);
HTH.
Sundaravalli Shriram
Tektronix Engineering Development India Ltd,
Bangalore - 560001,
India.
|
|
|
|
|
Hi,
How do we get the buffer of text when we drag a text from a edit control?
Sincerely.
Ngo Khai Hoa
|
|
|
|
|
I am wondering if anyone knows how to alter ALL explorer Save As dialog boxes so that my custom box
comes up anytime the SaveAs box is called. I know it can be done. Ontrack software has a program
called "PowerDesk" which optionally allows the common Save As dialog box to include an extra control that
permits the user to choose from a list of folders that were recently saved in. I am interested in
implementing something similar in one of my applications I am writing.
Details on the controls themselves are not necessary, I just want to know how to change the dialog itself,
having windows use my own "version" of the SaveAs dialog box instead of the normal one.
|
|
|
|
|
I downloaded Microsoft platfoem SDK and installed in my machine according to the instruction. But it
seems the SDK can not be used in Microsoft Visual C++ 5.0 (Microsoft developer studio 97). My problem
is I have to use Visual C++ 5.0 since all the previous projects are developed under Visual C++ 5.0. Can
someone tell me how to fix this problem? Thanks
|
|
|
|
|
Can you tell me how you managed to download and install the SDK ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
The following is a summary of the problem we are having with our application:
The application is a SDI MFC application with a single view. There are quite a few dialogs brought up by the main view.
When we try to bring up a dialog, the application returns a Debug Assertion Failure. The code used to bring up the dialog is:
CPayorBenefitDlg dlgPayorBenft;
int nDlgRetState;
//subsequent lines of code
If the above block of code is executed in the Debug mode, we can observe that immediately on execution of the 1st line (where we instantiate the dialog object) the this pointer (the pointer to the view object) changes. This event causes the program to assert further down the line since in the subsequent lines of code we access the view's data.
However, if we change the above code as:
int nDlgRetState;
CPayorBenefitDlg dlgPayorBenft;
//subsequent lines of code
Then the dialog comes up fine but the program raises a General Protection Fault on closing the dialog. In this case, the this pointer does not change when the dialog is instantiated.
Finally, if we change the above code as:
int nDlgRetState;
char chArray[100];
CPayorBenefitDlg dlgPayorBenft;
//subsequent lines of code
Then the program works perfectly fine!!
What could be the reason for such an inconsistent behaviour? And any suggestions as to how we can fix the problem??
Thanks,
Arvind
|
|
|
|
|
You are describing the textbook case of a stack corruption. If you are certain the problem is related to the dialog, check to make sure the dialog doesn't have any embedded arrays that might be writing beyond (or before) their bounds.
This problem happens most often with embedded arrays rather than arrays created with new.
|
|
|
|
|
All I can think of (that's what happened to me) is that
a) you're doing something 'weird' in the dialog constructor (most likely)
b) the header file for you class you use is somehow different from the original class
(missing variables and such).
I had the exact same problem, when I fixed the header file it worked fine again...
|
|
|
|
|
I am designing a dialog that resembles a keyboard that will allow the user to enter passwords, keys, etc... Is it possible to create a single message handler for all of the buttons (letters, numbers, spacebar, -, and .), and if so how do you differetiate between which button was actually pressed. Or, do I have to have a single message handler for each individual keyboard button?
Roger Printy
Software Engineer
TeraNex
Orlando, FL
|
|
|
|
|
Supply your own WndProc (window procedure) and look for
the messages in that.
Stephen Kellett
|
|
|
|
|
Any help on doing that, this is new to me. Also, how would you suggest to create an array of button objects that in a constructor is initialized to have each element in the array be a pointer to a button. I am doing this, am I correct because it seems to not be working completely:
CButton *m_pLetterBtn[19];
m_pLetterBtn[1] = (CButton *)GetDlgItem(IDC_KEY_1);
m_pLetterBtn[1] = (CButton *)GetDlgItem(IDC_KEY_2);
m_pLetterBtn[1] = (CButton *)GetDlgItem(IDC_KEY_3);
.
.
.
Roger Printy
Software Engineer
TeraNex
Orlando, FL
|
|
|
|
|
Well, actually, you can use the ON_COMMAND_RANGE message handler. You must make sure all the buttons resource ID's are sequential though.
Having said that, your design is probably not the best. It would be much easier if you simply drew the keyboard layout on the dialog in it's OnPaint handler, then create regions for each button and then handle the OnMouseUp event and check to see which region the button press occured in.
|
|
|
|
|
You can create a message map entry as below
ON_CONTROL_RANGE(BN_CLICKED, IDC_BUTTON1, IDC_BUTTON10, OnButtonClicked)
instead of the ON_BN_CLICKED message map entry. Here IDC_BUTTONis is the first button in a set of button having consequtive IDS. and IDC_BUTTON10 is last among them.
The corresponding hadler will look like
void CMyDialog::OnButtonClicked( UINT nID )
{
int nButton = nID - IDC_BUTTON1;
ASSERT( nButton >= 0 && nButton < 10 );
// ...
}
If you dont have the button ids as consequtive integers You can try one more method.
Let me explain that.
Map All the button to one Command Handler. You can do this using the class wizard itself. For all the buttons give the function name the same. Say (OnButtonClicked)
Later inside OnButtonClicked you can code as below;
void CMyDialog::OnButtonClicked()
{
const MSG *x = GetCurrentMessage();
CString ToDisp;
int nID=(int)x->wParam;//WParam gives the command id of the button.
ToDisp.Format("The Id of the button is %d...",nID);
MessageBox(ToDisp);
}
HTH
Sundaravalli Shriram
Tektronix Engineering Development India Ltd,
Bangalore - 560001,
India.
|
|
|
|
|
Hi all,
I am using a listctrl w/ small icon style, but unfortunately some of my strings are too long, so they overwrite the items right to them. Therefore, I changed the style to list view. Everything ok, but I do not want a scoll bar. So, when I use the style LVS_NOSCROLL, only the first item is drawn, all others disappeared. Does anyone know where did they gone?
Thanks in advance,
Thomas
|
|
|
|
|
Hi
I'm trying to copy a <vector> array onto the clipboard and I keep getting crashes when I do. Any1 know why this happens? I'm assuming that vectors dont work if u just copy them coz they have pointers to data they use somewhere, but it still shouldnt stuff up??
any help appreciated
thanx
-Peter
|
|
|
|
|
Likely what happening is that you are copying the vector and then the original vector is going out of scope, destroying the data in the poitners.
Then when you try to access that data later, you're accessing deleted memory, and thus the crash.
You need to copy the data from the vector, not just the vector itself.
|
|
|
|
|
I always think that there might be a simpler solution to my current problem.
OK guys, here's how it goes: A RTS game (e.g. Starcraft, Red Alert, etc) will have many of those small units walking around on the map. OK, so now I want to make a game that each human player, will represent ONE unit on the map. That means, you log on to the server, you play as ONE SINGLE unit. If you die, the battle still go on. You gotta join the on-going battle again later.
Allright? So that's simple right? But when I consider the traffic over the server side, there's this BIG problem: Imagine there are 1000 players log on to play in a game, if there's a need to synchronize, one player will send out a message package to the server, and the server will in turn forward the messages to all the other players.
In the worst case, 1000 players will each send out a package, and the server will receive 1000 message packages from all the players, and if it wants to forward them, that will be 1,000,000 message packages on the server side. Try to consider a package of few bytes, will easily result in few megabytes of data flow on the server's line!! (Note that this is only for a single message package!!)
Oh Gosh!! That's gonna kill the server!! So my friend, do you have any idea as how to address this serious problem? Thanks a lot for helping me, this little poor guy. haha!!
|
|
|
|
|
I'm not sure about the answer, since i'm not specialized in that, but i'd like the server to have all positions in memory, clients send their new position if needed (to decrease client upload), and then server sends an update packet (of all changed positions, that is 1000 max here) to all client each frame / tick / second - depends what framerate u need.
I mean, do not update all clients when a client moves, just keep the server up to date and make the server tells everything that is needed on a regular time base.
Good luck
|
|
|
|
|
Well, I think your math is correct...
I play EverQuest, and I've noticed that they seem to have a maximum of about 2000 players per server, and use many other techniques to keep the relayed message count down.
One technique in particular is to divide the "world" into a number of zones that you move between. When you move from one zone to another, you get sync'd up with the players in that zone. The system still has the ability to send world wide messages, but they are very few in number in comparison to the standard.
By using zones, there's ususally groups of 70 to 80 people or less that are hooked together, and so the standard character positioning messages are far, far fewer in number.
HTH,
David
|
|
|
|
|
> but i'd like the server to have all positions in memory,
> clients send their new position if needed
Yes, and you need to make sure that the server takes care of colission detection and other stuff like that, so that the Server has the ultimate say on what happened, and when.
> One technique in particular is to divide the "world"
> into a number of zones that you move between.
Yes, but in an RTS game, (a similar idea) you might want to consider only sending updates to players that actually have something around them. For example, if your avatar is standing in the middle of the woods, with no other players in sight, there is no need for you to receive the locations/actions of every other player in the game (that also increases the cheat potential). You only need to know what is going on around you, and certain other items like transmissions from other teammates, "Base under attack", etc.
-=- James.
|
|
|
|
|
I want connect to some server at some port through a proxy wich uses NTLM authentification.
After connection I want to send some buffer to the server and initiate a communication (not just to get some file).
The main problem is NTLM scheme. I can bypass it using WinInet API, but I can't figure it out how to send a buffer (command) to server.
Another way is using WinSocks, but there is the NTLM scheme again.
So, can anybody help me?
Thanks,
may
|
|
|
|
|
i need a formula that will give me the x y coordinates of the edge of a circle
|
|
|
|
|
Isn't it something like
r^2 == x^2 + y^2
for the case when the origin is at 0, 0
r is radius
Stephen Kellett
|
|
|
|
|
thanks heaps for the help
|
|
|
|
|
Hy,
i need for a personnal application to retrieve the title and the url of a ie favorites. I have got the full path of each .htm favorite and i want to know what is the easiest way to retrieve the info i need. Thanx for your help
Patrice
|
|
|
|
|