|
OK, this is a guess/from memory. A list box will be using the in-built scrollbars (which you cant get a ScrollBar* pointer to). You have to access and control them by using the CWnd scrollbar base class functions. You may also need to modify the style opf the list box to have the WS_HSCROLL style set.
Then you should be able to use the CWnd functions to control the scrollbar visibility/scroll range etc
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Create your list box with the WS_HSCROLL windows style ( Horizontal Scroll check box in the properties->Style page ) and then set the width with the SetHorizontalExtent() function. You can get the width of the text using the GetTextExtent() function.
HTH
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
Hi
I hope someone can tell me how to retrieve the exitcode of a thread the right way.
The code below shows how I retrieve the exitcode now.
But it doesn't work and i don't understand why.
DWORD exitcode = STILL_ACTIVE;
//set autodelete to false. This allows us to retrieve a handle for m_pThread.
m_pThread->m_bAutoDelete = false;
//tell the thread to end
m_pThread->PostThreadMessage(WM_STOPTHREAD, 0, 0);
//get the exitcode of the thread
do
{
bool temp = ::GetExitCodeThread(m_pThread->m_hThread, &exitcode);
Sleep(1);
}
while (exitcode == STILL_ACTIVE);
//when the thread has exited delete the CWinThread object
if (m_pThread)
{
ASSERT(m_pThread);
delete m_pThread;
}
The message handler for WM_STOPTHREAD looks like this
OnStopThread()
{
::PostQuitMessage(0);
}
|
|
|
|
|
Use WaitForSingle object instead of loop. WaitForSingleObject returns when thread is finished, or specified timeout is reached.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
could you give an example of this?
|
|
|
|
|
::WaitForSingleObject(pYourThread->m_hThread, INFINITE);
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
DWORD exitcode = STILL_ACTIVE;
//set autodelete to false. This allows us to retrieve a handle for m_pThread.
m_pThread->m_bAutoDelete = false;
//tell the thread to end
m_pThread->PostThreadMessage(WM_STOPTHREAD, 0, 0);
bool temp = ::GetExitCodeThread(m_pThread->m_hThread, &exitcode);
if ( exitcode == STILL_ACTIVE ) ::WaitForSingleObject(m_pThread->m_hThread,INFINITE);
|
|
|
|
|
Is this the right way to force a dialog to repaint it's client area?
CRect r;
GetClientRect(&r);
InvalidateRect(r);
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Just call CWnd::Invalidate, which calls ::InvalidateRect and passes NULL as rectangle. In that case, complete client area is invalidated.
Why are you doing this to CDialog?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
|
Tomasz is right, in that calling Invalidate() will make the window eligible for repainting. But to force a repaint, you should do:
Invalidate();
UpdateWindow(); /ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks Ravi
It was basically for my demo app in my new article
By the way it repainted without the call to UpdateWindow()() on my Win XP prof
Maybe if none of the other threads or processes are busy an Invalidate() alone will do, but if the system is real busy, then we can force it by an UpdateWindow()
I am correct I hope
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Yes, UpdateWindow() causes Windows to send a WM_PAINT message to an invalidated window, while Invalidate() cause WM_PAINT to be posted. I use UpdateWindow() to force a repaint when I can't afford to wait for the posted WM_PAINT to eventually arrive. It probably doesn't make a difference in your demo app.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi
How can i associate a file extension with my app?
i want that all double clicks will will open the files in the same instance of my app.
thanks
|
|
|
|
|
Anonymous wrote:
How can i associate a file extension with my app?
If this is an SDI app, you can use these lines of code in the InitInstance:-
EnableShellOpen();
RegisterShellFileTypes(TRUE);
m_pMainWnd->DragAcceptFiles(); //for drag/drop support
Anonymous wrote:
want that all double clicks will will open the files in the same instance of my app.
For this you need to use a mutex to prevent multiple instances. You check if the prog is already running and if it is already running [search for it using window title/class name] post a WM_COPYDATA message to it passing the command line.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
There's an article by Joseph Newcomer that describes how to limit your app to one instance.
In the C++/MFC section, it's called "Avoiding Multiple Instances of an Application".
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Nish - Native CPian wrote:
How can i associate a file extension with my app?
If this is an SDI app, you can use these lines of code in the InitInstance:-
EnableShellOpen();
RegisterShellFileTypes(TRUE);
m_pMainWnd->DragAcceptFiles(); //for drag/drop support
What if I have a dialog-based app? Since I don't have the doc-view framework, AddDocTemplate() doesn't work.
Thanks!
|
|
|
|
|
Does anyone know of any website that contain tutorials for a beginner to learn opengl?
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I think Microsoft has invented A.I. My computer has a mind of its own!"
|
|
|
|
|
Try www.codeproject.com in the tutorial area
~RaGE();
|
|
|
|
|
http://nehe.gamedev.net/
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
|
And, of course, the beginners coding forum at opengl.org.
|
|
|
|
|
|
Hello
I have a CBitmap object.
It's a member of a class.
The user can call a function to load a bitmap into this CBitmap object.
Now I have another function where I use the CBitmap object.
Here I would not know whether the user has actually loaded the bitmap or not.
So can I use this code to check if the CBitmap object has a valid bitmap in it?
if(!m_bitmap.m_hObject)
MessageBox("No bitmap found");
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
That code looks fine Nish.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|