|
Hi,
1. Find the number of items in the CListCtrl using the method CListCtrl::GetItemCount
2. Then use the WritePrivateProfileInt() API call to write this information to a file (.INF or .INI)
3. Run a loop and get each and every item from the CListCtrl. Write all these into the .INF file using WritePrivateProfileString() API call.
4. GetPrivateProfileInt() and GetPrivateProfileString() will help you to get the information back.
5. Display it.
6. If you face a problem, reply and let me know.
Regards,
Rajesh R. Subramanian.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Thanks Rajesh
Do you have any sample application or source code which does this?
|
|
|
|
|
It is simple to do. Try. If you run into trouble, let me know.
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
|
Well this should be simple but I can't for the life of me figure it out.....
void Game_Run()<br />
{<br />
<br />
RECT rect;<br />
GetClientRect(global_hwnd, &rect);<br />
<br />
if (rect.right > 0) <br />
{ <br />
gPosX = gPosX + 1;<br />
if ( gPosX >= rect.right )<br />
{<br />
gPosX = gPosX - 1;<br />
}<br />
if ( gPosY > rect.bottom - 30 )<br />
{<br />
gPosY = 0;<br />
gPosX=0;<br />
}<br />
DrawBitmap(global_hdc, "c.bmp", gPosX, gPosY); <br />
}<br />
<br />
} I basically am trying to get this dam thing to move right (which it does) hit the rect.right and then move left hit the rect.right then repeat....anyone want to help end my misery of tyring to figure this out
thanks
Chad
|
|
|
|
|
Try something like this:
------------------------
// Add a direction variable somewhere:
int gDX = 1; // Initially moving right.
// Now modified version of your code:
// Draw it.
DrawBitmap(global_hdc, "c.bmp", gPosX, gPosY);
// Update the position (only altering x-cord.
// make sure you set gPosY somewhere visible.)
gPosX += gDX;
// Check if we need to bounce:
RECT rect;
GetClientRect(global_hwnd, &rect);
if ( gPosX<0 || PosX>rect.right)
{
gDX *= -1;
}
Steve
|
|
|
|
|
It looks like your "thing" is moving right and then staying there, is that correct?
That is because you add 1 to gPosX, then if it hit the boundary you subtract 1. The problem is that once you get to the boundary you will keep adding 1 and then subtracting 1 in each iteration of the function.
When you come into the function you should add some offset variable, and then in the boundary check, change the sign of the offset variable if the condition is true. (Make that offset variable static so that it is maintained between function calls.)
|
|
|
|
|
Hi,
I have a class that needs to output data to a file. for this I defined a std::ofstream as a class member. However for some reasons I cannot get this to work. Writing to file works fine when I define a std::ofstream locally in a function, but for some reason it does not work when I use the std::ofstream as a class member. This is driving me nuts.
example:
<br />
#include <fstream><br />
<br />
class MyClass<br />
{<br />
public:<br />
MyClass() {};<br />
virtuel ~MyClass(){};<br />
<br />
void WriteSomething();<br />
<br />
private:<br />
std::ofstream m_file;<br />
<br />
}<br />
<br />
void MyClass::WriteSomething()<br />
{<br />
CString str = "test\n";<br />
std::ofstream file;<br />
<br />
m_file.open("c:\\test.txt", std::ios::out);<br />
m_file.write(str, str.Getlength());<br />
m_file.close()<br />
<br />
file.open("c:\\test2.txt", std::ios::out);<br />
file.write(str, str.Getlength());<br />
file.close()<br />
}
-- modified at 17:00 Thursday 12th January, 2006
|
|
|
|
|
When you say 'does not work', what does it do ? Does this only get called once ? Does any other code use the member variable ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The destination file is created, but remains empty. I have to say, I gave up and now use a CFile, which does use, but I still like to know why the ofstream does not work.
|
|
|
|
|
Thats probably because of caching:
The function's local stream is closed as the function exists so the file is flushed to disk and closed.
On the other hand, the class member stream is not flushed so u c a file but no data.
To check this u just have to flush the file explicitly.
[I'd paste some code here but I use FILE*fh=fopen or CreateFile. Never c++ streams nor CFile]
|
|
|
|
|
Can any one tell me if it is possible to Dynamically link a C# DLL in C++ code?
If possible, some help would be nice.....
Thanks.
JSJ
|
|
|
|
|
I doubt it - a C# dll is not a normal DLL, it's managed code. COM is your best bet to go from C# to C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Once i saw a program that was able to send an auto update the user on its activities via email, and it was even able to put attachments.
I'm not sure whearther the program was using some wininet techniques or what
But, i would like to know how would you go about programing a program that is able to send emails using c++?
Thankz!
|
|
|
|
|
|
Is their anyway to do this in a way that out look does not catch / interrupt it with their dialogs?
Or are these classes just manipulating Outlook and not doing its own *magic?
|
|
|
|
|
GreenLantern wrote: Is their anyway to do this in a way that out look does not catch / interrupt it with their dialogs?
i believe if you use 'extended MAPI', you can avoid all that stuff. don't have any links handy, sorry.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hi all:
I need a function which dynamically simulate a line function for example
r(t) = r0 + t * v;
where r0 is the 3D point on the line, v is the direction vector. The value of t can only be obtained dynamically. And when the function is fixed, I can send some points to test if they are on the line. Is there a good solution to do this in c++ please??
Thanks
Asura
|
|
|
|
|
If I understand this correctly, what you want to do is, given points P and r0, decide if it satisfies the following system of equations:
Px = r0x + t * vx
Py = r0y + t * vy
Pz = r0z + t * vz
where t is the unknown. Sure. just check that the following value is the same for all i in { x, y, z }
( Pi - r0i ) / vi
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello,
I have downloaded the last version of log4cpp from source forge but I have to build the sources because they dont provide the binaries. There's a MSVC6 folder in the distrib (the project is not maintained for a long time) but I only have visual studio .net 2003. Is it possible to build this project with vs2003?
In fact I even tried to buid it under vc++ 6 but I also have build errors.
I would also like to have your advices about the best logging api for c++ or simply about the logging apis you are using.
Thx.
|
|
|
|
|
|
It tells that some files are corrupted or missing. You can download the bundle and launch a build to see what happens.
|
|
|
|
|
Or you could be explicit and paste some of the errors in this thread.
It seems quite unreasonable to ask someone to download and build these files just to assist you.
Help us help you. If you make helping you too much work, you will not get help.
|
|
|
|
|
Ok, I'm sorry but when I wrote this message I was at home and I couldn't paste you the errors because I don't have vs.NET on my computer. By the way, downloading the api and launching a build took me less than 1mn that's why I whished you could do this to see the errors by yourself. Ok, sorry again and here's the build output:
------ Build started: Project: log4cpp, Configuration: Debug Win32 ------
Performing Custom Build Step
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
Build log was saved at "file://c:\Donwloaded Tools\c++\log4cpp-0.3.3\msvc6\log4cpp\Debug\BuildLog.htm"
log4cpp - 1 error(s), 0 warning(s)
|
|
|
|
|
my best guess is that you are missing header files from vc++ 6. try to search for each missing .h file online and download it and put it in your include path or project path.
and i agree, it's alot to ask people to download distros to help you
|
|
|
|