|
my ONINITDIALOG is a bool and does not do any setting.what do you think would be resizing the window so small that it hides all its contents.This is not a resolution problem.please reply
|
|
|
|
|
pankaj0dm wrote: the window is being created dynamically.
What size are you specifying when Create() is called?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
it is using setwindowpos but it setting the value internally.since it is a huge product so classes have been derived.can you provide me more information.
thanks
|
|
|
|
|
pankaj0dm wrote: it is using setwindowpos...
So why can you not set the size correctly using this function? How are you creating the window?
pankaj0dm wrote: ...but it setting the value internally.
What does this mean?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Not sure why this is happening in the first place, but I have had a similar problem when saving/restoring a window's or dialog's geometry after the user changed fonts/resolutions.
My solution was to find the corner-most control(s) and get their RECT s when WM_INITDIALOG is processed. That will allow you to determine the minimum dialog size required to completely show all of the controls. You can also use that information to prevent the user from sizing the dialog too small.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
hello James.
Well this is not a font or resolution problem.and there is not WM_INITDIALOG in my code.I am just doing the sizing for my window.can you guess anything else which i sud look upon.Create() is also not getting called since its created dynamically.this is a part of a huge product code.infact one of the framework.
|
|
|
|
|
pankaj0dm wrote: Create() is also not getting called since its created dynamically.
How do you create a control dynamically then?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
how to kill ui thread. i have to kill the thread while cancelling the dialog how to do this
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
I would suggest that you avoid terminating a thread. Instead, have an event object shared between your dialog and the thread. When the user hits Cancel, signal the event indicating to the worker thread that it should exit. When the thread's handle becomes signaled, it has exited and you can continue (or you can wait with a timeout on the thread's handle, and terminate it if it does not exit normally within a certain amount of time).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
For a UI thread a more proper way is to exit the thread via its message pump rather than using events. Post a WM_QUIT message to the UI thread and it will exit itself. [Of course inside its message loop,the thread should expect WM_QUIT message].
--
=====
Arman
|
|
|
|
|
Yeah, but this does not sound like a UI thread, otherwise there would not really be a reason to kill it from another GUI element. (Because it would have its own cancel button )
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Really. Though the OP said it is;
how to kill ui thread.
--
=====
Arman
|
|
|
|
|
Doh! Missed it....!
That is what I get for applying the Reasonable Man Test...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
A "UI thread" is actually a misnomer. It's simply a thread with a message pump, whereas a "worker thread" is a thread without a message pump.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
the other post cover important details, like you should close a thread by the means its ment to be closed to avoid memory leaks and other nasty stuff.
but if you really want to do it...
i used these function is a app that had to close other applications regardless of memory leaks.
here it is.. should still work i hope.
<br />
DWORD lpProcessID, lpThreadID, lpExitCodeThread, lpExitCodeProcess;<br />
HWND WndHandle;<br />
<br />
#ifdef _DEBUG_MSGBOXS_<br />
AfxMessageBox(_T("Checking for Class"),MB_OK);<br />
#endif<br />
<br />
if(NameIsOfClass == TRUE)<br />
{<br />
WndHandle = ::FindWindow(AppName,NULL);
}<br />
else<br />
{<br />
WndHandle = ::FindWindow(NULL,AppName);<br />
}<br />
if(WndHandle != NULL)<br />
{<br />
#ifdef _DEBUG_MSGBOXS_<br />
AfxMessageBox(_T("Class found"),MB_OK);<br />
#endif<br />
<br />
lpThreadID=GetWindowThreadProcessId(WndHandle,&lpProcessID);
HANDLE ThreadHandle = OpenThread(THREAD_ALL_ACCESS,TRUE,lpThreadID);
HANDLE ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS,TRUE,lpProcessID);
<br />
if(GetExitCodeProcess(ProcessHandle,&lpExitCodeProcess) == 0 )
{<br />
AfxMessageBox(_T("GetExitCodeProcess function Failed with Error:"), MB_OK);<br />
return FALSE;<br />
}<br />
<br />
if(GetExitCodeThread(ThreadHandle,&lpExitCodeThread) == 0)<br />
{<br />
AfxMessageBox(_T("GetExitCodeThread function Failed with Error:"), MB_OK);<br />
return FALSE;<br />
}<br />
<br />
TerminateThread(ThreadHandle,lpExitCodeThread);
TerminateProcess(ProcessHandle,lpExitCodeProcess);
}<br />
else<br />
{<br />
#ifdef _DEBUG_MSGBOXS_<br />
AfxMessageBox(_T("Failed: Class may not be running"),MB_OK);<br />
#endif<br />
}<br />
that has the key functions in and works.
or atleast it did when i made it a few years back.
hope that helps
p.s i'd dont use this for threads i created, if you created the thread you need to kill it safely in the onclose event or ondestroy etc
|
|
|
|
|
when i move a tab key the static control does not show the tab key movement.How to do that please help me?
i have placed the image on static control.
|
|
|
|
|
prathuraj wrote: when i move a tab key the static control does not show the tab key movement.How to do that please help me?
Make sure the control has the WS_TABSTOP style (it's off by default). Then you'll need to call DrawFocusRect() when the control gains focus, and again when the control loses focus.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
prathuraj wrote: when i move a tab key the static control does not show the tab key movement.
By design. The static control does not take input, so tabbing through the controls will never stop on a static control.
(I assume you mean static control, not button control?)
|
|
|
|
|
Hi,
I tried to build an MFC dll(originally written VC++ 6.0) to VC++2005. I am getting the folloing error Error error C2065: 'abuf' : undeclared identifier.
The code is as follows:
static void
free_biobuf(abuf)
biobuf *abuf;
{
if(abuf == NULL)
return;
free(abuf) ;
}
What should i do..
Regards, Eswari
|
|
|
|
|
this syntax is old C.
i advise you to change the header of your function into this :
static void free_biobuf(biobuf *abuf) {
}
by the way, you're probably getting the error because you moved the code from a .c file into a .cpp file, didn't you ?
|
|
|
|
|
I built the same dll in debug mode without any changes in the code. The same is not building in release mode. What could be the reason. Any help in this will be appreciated.
Regards, Eswari
|
|
|
|
|
have you made the code modification i gave you ?
how do you know it's not working in release mode ? getting an error ? when ? what is it ?
i cannot help if you don't provide infos, hey !
|
|
|
|
|
Sorry for not giving clear picture.
I made the code change as you suggested. It worked. I mean that compiler error is gone. But it is giving other compiler errors.
In debug mode i did not get any compilers which i am getting in release mode(including the one i posted yesterday. not a single compiler error). I am getting 996 errors in release mode.
What should i do.
|
|
|
|
|
so as i said, i cannot guess what's wrong unless you provide relevant infos...
what are the first errors ?
have you tried to do a rebuild all ?
|
|
|
|
|
Hi,
The first error is c2065 error (the one i posted). I made changes in the code as you said. It worked. But now i am getting C2079 error for the line
static struct xdr_ops xdrposix_ops;
and C2197 error for the line
return (XDR_PUTLONG(xdrs, (long *)fp));
Where XDR_PUTLONG definition is like this
#define XDR_PUTLONG(xdrs, longp) \
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
. Like this i am getting many error. I did a rebuild. Still it did not work.
The same is being built in debug more without any errors.
Regards, Eswari
|
|
|
|