|
In fact that the button is just look like simple button.
When you click the first time, it will response to your click.
If your second click is very fast, it will not pushed.
It need about 1 second between each click, then it will seems no problem.
Please help!
|
|
|
|
|
|
I have tried it. No change.
Which time I click it, the button is up.
(the first, second, or third...)
I do this in the normal button, it works.
Please help!
|
|
|
|
|
|
I know what is the problem now!
I need to add your code into the subclass not the main dialog!
It works now!
Thank you for your great help!
It means problem with ownerdrawn button should ask ownerdrawn(you);P
|
|
|
|
|
Can anyone tell me how to save the items in a CListCtrl to a file and then to load it when the dialog is opened?
Thanks in advance
|
|
|
|
|
The control itself can't do anything like this, you need to decide where to store it, and write the code accordingly. Some options include a database ( if you have one already ), a text file, or XML ( which is just a formatted text file, after all ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes i'm looking at a text file. You have any idea how to SAVE into a text file & how to LOAD into control. Any sample application where i can see the code?
|
|
|
|
|
An ofstream will write the file, and ifstream will read the file. You can google these if you don't know how they work. The format is up to you, and again, it's your code, and no built in magic that will turn the text in the file into data in your control, and vice versa.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
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?
|
|
|
|