|
Hi all,
Why a Application get hangs.
I am working witha MFC dialog Based application.
When I try to use controls on dialog box , application gets hang. No Abort, nothing only Hanging.
Can Any one tell me why this will happend.
Thanking You.
Sheshidar
|
|
|
|
|
sheshidar wrote: Why any application get hangs.
Did you check that whether there is a thread that lock's itself or some infinite while loop that you are using in your code. If you can post some code relevant to your application and this query you are more likely to get to the solution.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thx very much for ur reply.
I am getting this problem when data sharing between control and member variable.
|
|
|
|
|
are you copying/sharing data in a while loop . It could be an infinite loop. Can you post some code...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
No I didn't used any while loop
|
|
|
|
|
Can you be more specific can you show snippet code
|
|
|
|
|
Code is very lengthy.
I can write more specific.
I had create 2 dialog boxes.
First I had create one more dialog box with splitters, then i showed these first two dialogs in splitters. I accessed the controls on dialogs from the third dialog box.
Now I used Tab Control instead of splitter plane.
Then start problem.
I am able to see the two dialogs in diferent tabs but not able to access them. When I tried to access them then application get hangs.
|
|
|
|
|
How to access to dialogs and whats error?
|
|
|
|
|
sheshidar wrote: not able to access them
What do you mean by not able to access them.
How are you creating the third dialog. Modal or modeless?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I used Modeless.
I had created them using CreateIndirect Method.
|
|
|
|
|
Hi,
I am displaying one graphics in my view...the graphics page is designed in seperate software(Glg toolkit) and im displaying and working in ti by using glg.dll .
I want to change the font color of the graphics text from my coding.Is there any possibility to do this?
I can select the clor of the text from that glg software itself but the whole page get that one color and dispalyed.
i.e, if i select green then the total text available in the page is turned to green color.
I want to give different color to diffeent text from my coding.
I think its not possible to do this...But is there any way means pls help me out?
Anu
|
|
|
|
|
Do you want to change color font from a text into a graphic file?
|
|
|
|
|
You would be better searching for a Glg toolkit forum, where the members may be better able to help you. In normal code we would simply call SetTextColor() , but your Glg would have it's own methods of doing this.
|
|
|
|
|
I guess he want to reads graphic file and then change color from texts
|
|
|
|
|
Hi All.
How can we chnage default color to our own color of a dialog box in MFC Dialog based applications.
Thanaking You all
Shesahidar Patnam
|
|
|
|
|
sheshidar wrote: How can change color of dialog box
Override WM_CTLCOLOR.
HBRUSH COnlyForYou::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
HBRUSH BkgBrush = ::CreateSolidBrush(RGB(0,0,255));
if(GetSafeHwnd()==pWnd->GetSafeHwnd())
{
pDC->SetBkColor(RGB(0,0,255));
hbr = BkgBrush;
}
return hbr;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thx very much.
but how I have to call this function.
|
|
|
|
|
You dont need to call this event you need to insert this event to your class
|
|
|
|
|
Thx very Much I got it now,
|
|
|
|
|
sheshidar wrote: how I have to call this function.
You can use class wizard to add the code for you.
The framework calls this member function when a child control is about to be drawn.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi Gurus,
I'm using Visual C++ 6 and somewhat familiar with using Automation locally.
I am hoping to communicate with a program over the network as easily as I do
it locally.
Here is some code (note the comments):
CString strPCName;
GetDlgItemText(IDC_EDT_REMOTE,strPCName);
//m_PIDatsApp is a COleDispatchDriver wrapper class
if (strPCName.IsEmpty()) //local
{
m_PIDatsApp.CreateDispatch("PIDats.Application");
}
else //remote
{
LPDISPATCH lpDispatch = GetRemoteDispatch
(L"PIDats.Application",(LPCTSTR)strPCName);
if (lpDispatch)
m_PIDatsApp.AttachDispatch(lpDispatch);
}
m_PIDatsApp.OnFileNew();
LPDISPATCH GetRemoteDispatch( WCHAR* lpProgID, LPCTSTR lpPCName )
{
LPDISPATCH pDisp = NULL;
USES_CONVERSION;
COSERVERINFO SI;
::ZeroMemory(&SI, sizeof(SI));
SI.pwszName = T2OLE((LPTSTR)lpPCName);
CLSID clsid;
::CLSIDFromProgID(lpProgID, &clsid);
MULTI_QI rgmqResults;
IID IID_IUnk = IID_IUnknown;
rgmqResults.pIID = &IID_IUnk;
rgmqResults.pItf = NULL;
rgmqResults.hr=0;
HRESULT hr = ::CoCreateInstanceEx(clsid, NULL, CLSCTX_REMOTE_SERVER,
&SI, //Machine on which the object is to be instantiated
1, //Number of MULTI_QI structures in rgmqResults
&rgmqResults //Array of MULTI_QI structures
);
if( SUCCEEDED(hr) )
{
LPUNKNOWN pUnk = rgmqResults.pItf;
VERIFY(S_OK==pUnk->QueryInterface(IID_IDispatch, (void**)&pDisp));
pUnk->Release();
}
return pDisp;
}
I note that I'm able to start the program (PI_Dats) either way. But if
PI_Dats is on a remote machine, when I get to m_PIDatsApp.OnFileNew(), the
debugger on the server doesn't move past it. I put a message box in the
OnFileNew() function on the server; it did not pop up. However,
OnFileNew() works fine locally. I was hoping that I would be able to work
remotely without many modifications. Apparently I can't do that? What would
be a good source to study to learn how to use Automation functions (I'm
noping I don't have to learn low-level DCOM)?
Another difference is debugging on the server. Locally, I'm able to debug a
server program easily. In this case I try to do that by running the program
on the server with /Embedding as a program argument. But then when I use
GetRemoteDispatch() above, a new instance of the program is created on the
server, so I can't use the debugger on the server. How can I use the debugger
on the server?
Also, once the program has started on the server, I don't know how to stop
it. Using the Task Manager doesn't do it, a message box pops up that says
"Access denied." The only way to stop it is to reboot, which is time
consuming. How can I shut down the program started on the server?
I'm using Windows 2000 on the client computer, Windows NT on the server.
Thanks for any help.
|
|
|
|
|
Have you got a proxy registered on the client machine and a stub registered on the server?
Steve
|
|
|
|
|
Thanks for your reply. To answer your question, I don't and I don't know what they are. This is what I need to learn about. What is a good book or other source of information on DCOM programming with MFC? I want to use the local automation already in place over a network.
Thanks,
GF
|
|
|
|
|
Say I have a CCriticalSection member variable (m_cs) in my class A
In some routine Foo
A::Foo()
{
m_cs.Lock();
m_cs.Lock();
cout<<"Entered";
}
when i call Foo() from a single thread , will it encounter the cout statement ?
Engineering is the effort !
|
|
|
|
|