|
Here's an example. Btw, see if CStringArray (a directly accessible dynamic array of CStrings ) is more suited to your needs. I tend to use that because it's more efficient. Of course if you need a list, then CStringList is the non-STL way to go.
CStringList myStringList;
CString strFirst = "First";
CString strSecond = "Second";
CString strThird = "Third";
POSITION pos = myStringList.GetHeadPosition();
pos = myStringList.InsertAfter (pos, &strFirst);
pos = myStringList.InsertAfter (pos, &strSecond);
pos = myStringList.InsertAfter (pos, &strThird);
pos = myStringList.GetHeadPosition();
while (pos != NULL) {
CString* pString = (CString *) myStringList.GetNext (pos);
TRACE ("Element = %s\n", *pString);
}
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
do the job that UrlDecod() in asp by vc6.
vc newbie , thx for your help !
|
|
|
|
|
(using VC++6, MFC,... )
Howdy'
I'm now displaying a webcontrol (CWebBrowser2, from the components) in my UI; it's in a CWnd, inside a floating window; I have two floating window, each display some UI, one of them receive the webcontrol; the other floating window contain tree controls, buttons, ...
If I really create the the webcontrol, the rest of the UI doesn't gets initialized properly, they don't get resized, they don't receive an appropriate WM_SIZE.
If I don't create the webcontrol, the UI is perfect, I receive 2 size messages, one, I think is ok, of cx=0 and cy=0, and the other size with the good value (cx, and cy are normal values, the real size.
Also, if the floating windows are docked, everything gets displayed as expected ?
I don't know if it's because the control takes a long time to create ? or if it's eating messages intended to the parent window ?
Anyone have some clues ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Hi!
I've the following code:
In my CDocument based class:
//Scripting support
class CScript
{
public:
CString sString0, sString1, sString2, sString3, sString4;
int i0, i1, i2, iID;
};
//Script IDs
#define MOVE_PLAYER 0
#define TEXTBOX 1
#define CHOICE_TEXTBOX 2
#define GIVE_ITEM 3
#define MOVE_OBJECT 4
#define HAS_ITEM 5
#define IF_ELSE 6
//End scripting
class CMyMap
{
public:
CMyMap()
{x=0; y=0; id=0; iMax[0]=0; iMax[1]=0; iMax[2]=0; iHitpoints=0; bWalk=true;};
CMyMap(int nx, int ny, int nid)
{x=nx; y=ny; id=nid; iMax[0]=0; iMax[1]=0; iMax[2]=0; iHitpoints=0; bWalk=true;};
int x, y, id, iMax[3], iHitpoints;
bool bMoveable, bDestroyable, bTileSave, bWalk;
CScript cs_arrayScript[3][100];
};
class CTheEditDoc : public CDocument
{
[...]
public:
CArray<CMyMap, CMyMap&> dv_arrayMaps;
// Overrides
void Serialize(CArchive &ar);
[...]
}
void CTheEditDoc ::Serialize(CArchive &ar)
{
CDocument::Serialize(ar);
if (ar.IsStoring())
{
dv_arrayMaps.Serialize(ar);
}
else
{
dv_arrayMaps.Serialize(ar);
}
UpdateAllViews(NULL);
}
My problem 0:
When saving my document everything works fine, but when it comes to reloading it cs_arrayScript[3][100] is filled with waste (all other variables are loaded corectly). Is the Serialize function of CArray unable to serialize my 2D-array properly?
My problem 1:
While the User works with my app the CArray dv_arrayMaps is filled. After some CMyMaps (I think about 10-15) are pushed into it the app slows down a whole step. Is there a way around it? Am I handling to much data?
[I tried dv_arrayMaps.FreeExtra()]
Build a system that even a fool can use, and only a fool will use it.
|
|
|
|
|
can someone please tell me how to check to make sure that a string getting passed into my function is of length 9 exactly?
BSTR __stdcall FindBankName(char* strFilename, char* strRoutingNumber, BSTR strErrString)
thanks in advance, i am pretty unfamiliar with char arrays..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
|
thanks, i appreciate it!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hello,
In MDI project i want to remove View's border, i already try pView->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, 0); , but i have always the border.
if someone know how to remove the border ?
thx in advance
|
|
|
|
|
In OnInitialUpdate , before calling the parent's implementation, insert:
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thx it's perfect !
|
|
|
|
|
Another alternative is to override PreCreateWindow if you are using MFC. It would allow you to adjust the flags even before the window is created.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi, i took a look at custom drawing under the Listview control section. I want to make my own Listview control. But for this, i need to see wether the mouse i over a item/subitem. For example i would adapt the font of one item when the user moves his/her mouse over it, when he/she moves the mouse out, it goes back to normal. Unfortunately, i have no idea how to do this... Do i catch a mousemove/nchitest message over an item(if thats possible) and set a flag so i can see in the drawing code wether the flag is set and disable the flag by catching the same message in the proc of the entire control, i really have no idea (this doesnt seem right to me btw). Can anyone give me directions for this?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
One way to do this is to add a timer to your subclassed CListCtrl .- In your
OnTimer() handler, check if the mouse is over an item or subitem. If the state of the mouse (the item/subitem it is/was over) has changed, save the index of the new item/subitem (if any) under the mouse and invalidate the list control.
- This will cause your custom draw code to kick in.
- Your custom draw code should check the the index and draw the cell appropriately.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi
I do use Visual C++ 6 on Win2000 and WinNT4 and have an MFC application in development in which I want to add some custom informations at its compilation. Those informations should/could be the date, time, the current user and the current computer the application is compiled on. They should later be seen in the AboutBox dialog of the application itself.
Furthermore I do want this infos only in this application, not in all my other ones (a lot of the build number increasing tools/addins always apply to all my applications - I don't want that).
To even excess that I do use SourceSafe for this application so me and my work-mates can work together on it.
Is this possible?
Thanks in advance for answers,
Matthias
|
|
|
|
|
For date and time use the __DATE__ and __TIME__ macros. Not sure how to help you with USER and MACHINE NAME yet.
Kind regards,
Tim
|
|
|
|
|
I'm looking for some information regarding Memory Resident Databases, sometimes called Main Memory Databases (or MMDB).
I can't seem to find a decent explanation of it. The advantages should be obvious, but I'm looking for some more technical information, e.g. how it can co-operate with RDBMS's, in which environments they're actually used, if they're used merely for single-user systems (one MMDB per user/application) or also for multi-user environments (one MMDB for a small company or workgroup).
I find some references to Angara (www.angara.com) but that company seems to be non-existing anymore.
Anyone tips or references ?
Enjoy life, this is not a rehearsal !!!
My Articles:
- Implementing a Subject/Observer pattern with templates
- Different ways of writing class factories
|
|
|
|
|
i have huge problem in doing this, i tried virtually everithing, does anybody has examplecode??
i can change the icon, but i can not change it to a freely selectable ore selfmade icon. by default the icon wich is assigned in the pCommands->AddNamedCommand method
is a smiley, and has the value 59. when i change this value, i see another icon, but is there a list or something, where i can see, which icon has which ID ??
please help me!
thanx a lot
|
|
|
|
|
Hi!
I am new to c++ and I have a small problem.
I have a text file that I dont know how many lines are in and I want to read each line and put each line in a buffer... Does anyone know how to do this?
I use the ifstream function to read the lines and if I know how many lines are in that text file I can create a buffer for each lines. But the problem is if I have a file with 1000 lines.... what can I do to read each line?
The reason why I want to read each line is that I want to put "" tags on each...
Can anyone help me? Or if there is a webpage about this just give me its address... I'm really confused.
Thank you for your future answers!
|
|
|
|
|
Scolinks wrote:
and if I know how many lines are in that text file
You could just read through it, counting, in a first run and then do the read-in in a second run, after having allocated the memory you would need.
Or simply use containers that C++ offers you:
std::vector < std::string >
You can call push_back()( with every new line, and as long as your file is not larger than the available memory, the container will grow.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I have different descriptions to the same file, such as "c:\tmp\test.dat", "c:\tmp\..\tmp\test.dat" etc - the variations are endless.
What is the easiest way to normalize the paths so that I can compare two or more and determine they refer to the same file?
Note the file may not yet exist.
I thought the Shell API had something but was unsuccessful with my search through MSDN. Anybody to point me to some standaed Win32 API to solve that problem?
TIA,
Bernd
|
|
|
|
|
Does GetFullPathName() do the trick?
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Unfortunately not. GetFullPathName() does what the name suggests, but does not normalize.
Thanks for making an effort anyhow
Bernd
|
|
|
|
|
How about _fullpath() ?
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
How can I clear a file with fstream?
I've opened my file with append flag, so I can't do:
my_fstream.write("", 0);
Bye
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:
How can I clear a file with fstream?
I've opened my file with append flag, so I can't do:
Why not just close the file and re-open it with ios::trunc? .... I suppose there is probably a faster way.
-Nick Parker
The true measure of a man is how he treats someone who can do him absolutely no good. - Samuel Johnson
|
|
|
|
|