|
Eli,
you can see the article "Dynamically Highlight Elements in a List Control" at http://www.codeproject.com/listctrl/highlightlistctrl.asp
Neelesh K J Jain
|
|
|
|
|
How about a call to SetRedraw() before and after the insert/delete operations?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'd try this first:
SetRedraw
If you still get flicker, try drawing offscreen:
Flicker free drawing of any control
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENS
|
|
|
|
|
You can disable the painting on the list control with SetRedraw(FALSE);
I'm using this technique when updating my list controls.
m_lstCtrl.SetRedraw(FALSE);
m_lstCtrl.DeleteAllItems();
...
m_lstCtrl.SetRedraw(TRUE);
IMO this is easier than trying to implement Custom or Owner Draw
|
|
|
|
|
I am trying to implement an mfc dialog based application which will start when the system starts up just like a windows service...
|
|
|
|
|
Hello
You can place your app path into registry under the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Andrew
|
|
|
|
|
Another Method is to place a shortcut of your application on the directory "startup"
AntonlioX
|
|
|
|
|
I have made an application. Now i want to put its icon in the right corner of my task bar. How can i do that? Moreover, how can i display my own tooltip when i hover my mouse over that icon in the taskbar.
|
|
|
|
|
|
See this thread.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hi all..I'm newbie in visual c++ and I'm trying to make a simple file copy program, but it doesn't work. Here is my source code:
#include<afx.h>
#include<stdio.h>
int main()
{
CFile m_LogFile,m_DataFile;
char* a=NULL;
m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone);
try
{
m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone);
m_LogFile.SeekToEnd();
}
catch(CException* e)
{
e->ReportError();
e->Delete();
}
m_DataFile.Read(a,m_DataFile.GetLength);
m_LogFile.Write(a,strlen(a));
return 0;
}
The message error said that the m_DataFile.Read(a,m_DataFile.GetLength); part is wrong, but when I change the 2nd parameter into fixed number(I tried 10 and 100), it generate other error. Can somebody help me?
thx
|
|
|
|
|
I can't find it, but there is most certainly an API call you can make to copy a file, if you want to. In the meantime, m_DataFile.GetLength is a function pointer. m_DataFile.GetLength() is a function call.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
It is CopyFile(...)
Einstein: "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."
My Articles
|
|
|
|
|
Thanks - I thought it was, but I did a google on CopyFile C++ and got no helpful links. Usually, MSDN is the first hit in a case like that.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
1- Change m_DataFile.Read(a,m_DataFile.GetLength); to:
m_DataFile.Read(a,m_DataFile.GetLength());
because GetLength() is a function.
2- And also, you are using char* a = NULL;
You are not assigning any memory to it. It is a null pointer.
You can try this:
char* a = NULL;
a = m_DataFile.GetLength() + 1;
memset(a,0,m_DataFile.GetLength()+1);
Then read the file into it:
m_DataFile.Read(a,m_DataFile.GetLength());
this is this.
|
|
|
|
|
I already change the source code..but it is still error. This is my source code:
#include<afx.h>
#include<stdio.h>
#include<memory.h>
int main()
{
CFile m_LogFile,m_DataFile;
char* a=NULL;
m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone);
try
{
m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone);
m_LogFile.SeekToEnd();
}
catch(CException* e)
{
e->ReportError();
e->Delete();
}
memset(a,0,m_DataFile.GetLength()+1);
m_DataFile.Read(a,m_DataFile.GetLength());
m_LogFile.Write(a,strlen(a));
return 0;
}
n the program generate these errors:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/excel.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
excel.exe - 3 error(s), 0 warning(s)
n I don't understand what it's means...pls help.
thx
|
|
|
|
|
If you're using VC 6. do the following:
Menu item Project->Settings->Tab C++ -> Category 'Code Generation'->
set this option to 'Multithreaded' or 'Debug Multithreaded'
|
|
|
|
|
I already change the code generation into multithreaded. The program can be compiled successfully but when I run it, it generate an error and can't run. Give me some hints please. Is there any logic error on my program?
The reason that I didn't use CopyFile is if the program works, I'm planning to make a program that can make XML file from text file which I think it can't be done using CopyFile function.
thx.
|
|
|
|
|
firebolt77 wrote:
...when I run it, it generate an error and can't run.
And what would that error be?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
firebolt77 wrote:
n the program generate these errors:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/excel.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Remove the /MT linker option.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
No, he is using MFC, but he made a console application. So the default settings cause the linker not to link with the MFC libraries. He should change that setting to link dynamically or statically to the MFC.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
If that was the case, the linker would be complaining about MFC-related code instead of __endthreadex and __beginthreadex . See here for more.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I sometimes used MFC in an application that was not linking to the MFC libraries. The only unresolved external symbols that I had were the __beginthreadex and __endthreadex .
I thought that that was the problem, since he is using the CFile class from MFC. There are numerous ways to generate the same error, however.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
A simple trick - when you want to see if a function exists to do something go Help->Index and try typing in possible function names. As you type more letters it narrows the results.
"Filecopy" didn't return anything but "Copyfile" returned
CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists)
Elaine
The tigress is here
|
|
|
|
|
I already change the code generation into multithreaded. The program can be compiled successfully but when I run it, it generate an error and can't run. Give me some hints please. Is there any logic error on my program?
The reason that I didn't use CopyFile is if the program works, I'm planning to make a program that can make XML file from text file which I think it can't be done using CopyFile function.
thx.
|
|
|
|