|
Hi all,
I have designed a MFC based Dialog application. I have a parent dialog and a corresponding child dialog.
My requirement is this. My parent dialog has a edit box. Which should display value form 0 to n without stopping although the child window is opened or closed.
Just like a clock it should be incrementing the value by itself. Which function do u suppose can be used to achieve this?
I tried WM_TIMER but to no avail. It increments once and then stops.
Please some one tell me as to which function or handle can accomplish this.
Thanks and Regards in Advance
Kenny
|
|
|
|
|
Use a thread function to implement the edit box updation.
Threadproc()
{
m_edit = 1; // edit box member variable
while( 1 )
{
m_edit++
UpdateData(FALSE);
sleep( 10 )
if( m_edit == n ) // return if n is reached
{
return;
}
}
Rinu Raj
|
|
|
|
|
Hi all,
I want to draw some diagrams (rectangles ...etc) and put text in to it..
I have used TextOut() function to write the text...
But I want to reduce the font size ....
Now it takes current font settings of Device Context...
How do I make it ?
Thanks in advance....
vinsankar
|
|
|
|
|
Hi
Use CreateFont to set font size.
Attach font object to dc using SelectObject
KK
|
|
|
|
|
Are you using the original (default) font in the DC, or have you selected your own in? I'm guessing the former, since if you were selecting them in, you'd just create a smaller one.
Steve S
Developer for hire
|
|
|
|
|
You can use of CreateFont and SelectObject but in the end use CFont::DeleteObject and also you can use of CreateFontIndirect
|
|
|
|
|
I create an 'Win32 Console Application' "Program01" in VC6 as follows,
#include "stdafx.h" #include "Class.h"<br />
int main(int argc, char* argv[]){<br />
Class<int> a;<br />
int b = a.GetValue(1729);<br />
printf("\n\t");<br />
return 0;<br />
}<br />
<br />
#include "stdafx.h" #include "Class.h"<br />
template <class T><br />
Class<T>::Class(){<br />
}<br />
template <class T><br />
Class<T>::~Class(){<br />
}<br />
template <class T><br />
int Class<T>::GetValue(int value){<br />
return value;<br />
}<br />
<br />
template <class T> class Class{<br />
public:<br />
Class();<br />
virtual ~Class();<br />
int GetValue(int value);<br />
};
It shows Linking error for the member functions of class. But when I remove template from Class the program runs well; even when I write all code (Class with template) in single "Program01.cpp" File then also it runs well.
Then what might be the problem in the above code?
-- modified at 4:03 Friday 15th September, 2006
|
|
|
|
|
|
Aniket Salunkhe wrote: It shows Linking error for the member functions of class. But when I remove template from Class the program runs well; even when I write all code (Class with template) in single "Program01.cpp" File then also it runs well.
Then what might be the problem in the above code?
Template classes should be defined and declared in .h files so that the compiler can generate code for these classes when an instantiation is required.
Because templates are compiled when required, this forces a restriction for multi-file projects: the implementation (definition) of a template class or function must be in the same file as its declaration. That means that we cannot separate the interface in a separate header file, and that we must include both interface and implementation in any file that uses the templates.
Remove definitions from .cpp file to .h file.
These days compilers do allow you to forward declare template types, but some compilers don't yet support them.
template < class T >
class AClass
{
int ATemplateFunction( T aObj );
};
template< class T >
int AClass< T >::ATemplateFunction( T aObj )
{
return 1;
}
|
|
|
|
|
Nibu babu thomas wrote: Template classes should be defined and declared in .h files
But I am creating Library ('Wind32 Static Library') using that code, so i can't write implementation of class in .h file.
So what should i do?
|
|
|
|
|
Aniket Salunkhe wrote: But I am creating Library ('Wind32 Static Library') using that code, so i can't write implementation of class in .h file.
So what should i do?
Look at what Microsoft has done for their template classes. They do have plenty of them. For eg: CArray , CPtrArray etc.
|
|
|
|
|
Where should I search for that?
|
|
|
|
|
Aniket Salunkhe wrote: Where should I search for that?
AfxTempl.h
|
|
|
|
|
I am doing a MFC project and want to change the tip on toolbar item.
I found some samples on Dialog to do that in codeproject, but none on MainFrame'stoolbar.
Can you help me?
|
|
|
|
|
|
Hi,
MY application consits of a button and a tree control.If i press the button, windows explorer files and folders will be displayed in the tree control with images.Now my problem is,if i press the button for the second time the images are not appearing in the tree control.How can i eliminate this problem.
Thanks in advance,
Radhika.
|
|
|
|
|
radhika28 wrote: MY application consits of a button and a tree control
What is the type of application?
radhika28 wrote: if i press the button for the second time the images are not appearing in the tree control.How can i eliminate this problem
Can you post some source code showing how are you going with the creation of the tree control etc....
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
void CApplication::OnButton1()
{
// TODO: Add your control notification handler code here
TCHAR szWorkDir[MAX_PATH];
if ( m_tree.m_hWnd )
{
if ( m_tree.SubclassDlgItem( IDC_TREE1, this ) )
{
m_tree.DisplayTree( NULL /*Display all*/, TRUE /* TRUE = Display Files*/ );
_getcwd( szWorkDir, 256 );
// set the Path to the current Work-Directory
m_tree.SetSelPath( szWorkDir );
}
}
}
|
|
|
|
|
radhika28 wrote:
TCHAR szWorkDir[MAX_PATH];
if ( m_tree.m_hWnd )
{
if ( m_tree.SubclassDlgItem( IDC_TREE1, this ) )
{
m_tree.DisplayTree( NULL /*Display all*/, TRUE /* TRUE = Display Files*/ );
_getcwd( szWorkDir, 256 );
// set the Path to the current Work-Directory
m_tree.SetSelPath( szWorkDir );
}
you have to check out for some flag !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
i just want to read .pst file made by oulook ....
i have tried reading it by using ReadString function .its reading file but the strings r in some code format i just wanted to read 'em in some understandable manner...can anybody plsss give me some tips on how to use .pst file ???Is .pst file use any kind of data structure for storing our emails etc..........
|
|
|
|
|
pst files us a variant on the Jet database engine. You need to research the file structure and impliment the code to read it if you want to work with them. You really didn't expect it to be a bunch of plain text, did you ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
actually i want to recover my deleted files from the outlook.So i m not getting from where to start with??So if u can plssss guide me thru...it'll be of g8t help
|
|
|
|
|
LOL - I can tell you from personal experience ( outlook died for me earlier this week ) the web is full of people willing to sell you a program that will recover your PST. The sample versions all show you your mail but do not recover it, but I found ones as cheap as $50, which worked really quite well.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanku for ur suggestion
if u knw it or u can rather tell me how to read a pst file or in what file format does it contains its content or anythig related to a pst file
it'll be helpfull
thanxs
|
|
|
|
|
I thought I'd answered that question ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|