|
Hi,
I have created splitter window ,one of the window is of type CFrameWnd which
creates a CHtmlView in it ,so the problem is that whenever Navigate2() (or
Navigate()) is called in OnInitialUpdate() the page is displayed ,but if I
call it in any other function (created by me) and which is called from
CFrameWnd window it does not display anything although OnDocumentComplete()
gets called but nothing is displayed.
here is the code:
To Create the view inside CFrameWnd where CBrowserView is CHtmlView derived
class.
BOOL CBrowserFrame::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext*
pContext)
{
CCreateContext context;
pContext = &context;
pContext->m_pNewViewClass = RUNTIME_CLASS(CBrowserView);
pview = (CBrowserView *) CreateView(pContext, AFX_IDW_PANE_FIRST);
((CMainFrame*)GetParentFrame())->pBView=pview;
if (pview ==NULL)
return FALSE;
pview->Test();
pview->SendMessage(WM_INITIALUPDATE);
SetActiveView(pview, FALSE);
return CFrameWnd::OnCreateClient(lpcs,pContext);
}
In the CBrowserView:
void CBrowserView::OnInitialUpdate()
{
Navigate2("http://localhost");
CHtmlView::OnInitialUpdate();
}
void CBrowserView::OnDocumentComplete(LPCTSTR lpszURL)
{
MessageBox("OnDocumentComplete()");
CHtmlView::OnDocumentComplete(lpszURL);
}
void CBrowserView::Test()
{
Navigate("http://www.google.com");
} And I also want to draw something in this view is it possible using
CClientDC as I am not able to draw anything , and it seems as if the OnDraw()
function of a CHtmlView never gets called?
Please help me.
modified on Monday, March 9, 2009 11:38 PM
|
|
|
|
|
Hi,
I recently got a answer to a question regarding a CwinThread question
I was pointed to a article on the code project
the following is the URL wwww.codeproject.com/KB/threads/extended_thread_aspx
my question is regarding the following snipet of code from the Article
CThreadEx::CThreadEx (AFX_THREADPROC pfnThreadProc) : CWinThread (pfnThreadProc, NULL) {
m_bAutoDelete = FALSE;
// Undocumented variable. Need to set the thread parameters variable to this
m_pThreadParams = this;
}
The author uses a inilizer list to pass paramters to the base Class'es contructer I have no problem
With this
My problem is the next line of code m_pThreadParam = this
The author points out that this contructer isn't the one documented AFXWIN.H
However I found a more complete discription of the CWinthread in the following PPT
presentation below is the URL
ttp://74.125.47.132/search?q=cache:azRHOpLik8MJ:www.ecs.syr.edu/faculty/fawcett/handouts/cse778/Lecture7/Additional%2520Thread%2520Info/threads.ppt+MORE+ON+THREADS+BUKIN&hl=en&ct=clnk&cd=1&gl=us
Anyway on page 5 of the PPT presentation is a more complete descrption of the CWinThread
Class
and m_pThreadParams seems to be a private member of the base Class CWinThread Class
I haven't build the code in the article but I am wondering if it would work
|
|
|
|
|
The first URL you mentioned, I believe is wrong. That is, it starts off with 4 W's. However, even after deleting the extra "W", I could not get there. Are you sure you have the right URL?
Bob
|
|
|
|
|
BobInNJ wrote: Are you sure you have the right URL?
Did you not notice the mising extension:
http://www.codeproject.com/KB/threads/extended_thread.aspx[^]
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Sorry you are right
the second one the titled more on threads by Konstatin page 5 has a detailed listing CthredWin
private:
LPVOID m_pThreadParams; <--- is a private data member //generic parameters passed to starting function
AFX_THREADPROC m_pfnThreadProc; ,
HANDLE m_hThread;
Just cut and paste the link below
http://74.125.47.132/search?q=cache:azRHOpLik8MJ:www.ecs.syr.edu/faculty/fawcett/handouts/cse778/Lecture7/Additional%2520Thread%2520Info/threads.ppt+MORE+ON+THREADS+BUKIN&hl=en&ct=clnk&cd=1&gl=us
|
|
|
|
|
http://www.codeproject.com/KB/threads/extended_thread.aspx
Sorry this the First Link
Page 5 from the PPT presentation
CWinThread
class CWinThread : public CCmdTarget {
public:
CWinThread();
CWinThread(AFX_THREADPROC pfnThreadProc, LPVOID pParam);
BOOL CreateThread(DWORD dwCreateFlags = 0, UINT nStackSize = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
virtual BOOL InitInstance();
virtual int Run();
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL PumpMessage(); // low level message pump
virtual BOOL OnIdle(LONG lCount); //return TRUE if more idle processing
virtual BOOL IsIdleMessage(MSG* pMsg); //checks for special messages
private:
LPVOID m_pThreadParams; <--- is a private data member
AFX_THREADPROC m_pfnThreadProc;
HANDLE m_hThread; // this thread's HANDLE
} Back to AfxBeginThread()
|
|
|
|
|
I use these two functions that I have copied from codeproject to use transparent static text and background in my application. But everytime I put a command button in my application the application seems to run for milliseconds and vanishes without me closing out. I am a beginner and any suggestion would be great thank you.
HBRUSH CTrialDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr;
if( nCtlColor == CTLCOLOR_STATIC )
{
pDC->SetBkMode(TRANSPARENT);
//pDC->SetTextColor(RGB(255, 0, 0));
hbr = (HBRUSH)GetStockObject( NULL_BRUSH );
}
else
{
hbr = CTrialDlg::OnCtlColor(pDC, pWnd, nCtlColor);
}
return hbr;
}
BOOL CTrialDlg::OnEraseBkgnd(CDC* pDC)
{
CBitmap m_bitmap;
BOOL rVal = FALSE; //CWizardPage_Base::OnEraseBkgnd(pDC);
if( m_bitmap.LoadBitmap( IDB_Background ) )
{
CRect rect;
GetClientRect( &rect );
CDC dc;
dc.CreateCompatibleDC( pDC );
CBitmap* pOldBitmap = dc.SelectObject( &m_bitmap );
pDC->BitBlt( 0, 0, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY);
dc.SelectObject(pOldBitmap);
rVal = TRUE;
}
return rVal;
}
|
|
|
|
|
Astitva23 wrote:
else
{
hbr = CTrialDlg::OnCtlColor(pDC, pWnd, nCtlColor);
}
Shouldn't that be CDialog::?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Yeah It should have been CDialog. Thanks for that.
But I have got another problem now. I am using arrays to display text through my static text and everytime I am displaying the next question, the text is overlayered above the previous one. Is there any function to flush the text...
thank you..
snippet of my code for displaying static text from array:
m_QUESTIONS.SetWindowText(Questions[counter]);
m_cAnswer1.SetWindowText(Answers[counter][0]);
m_cAnswer2.SetWindowText(Answers[counter][1]);
m_cAnswer3.SetWindowText(Answers[counter][2]);
m_cAnswer4.SetWindowText(Answers[counter][3]);
|
|
|
|
|
Astitva23 wrote: function to flush the text
Don't get your question fully. May be you are looking for a "setWindowText("")"? Guess
not. Ok dinner time. May be back in 30 mins.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
I will probably scratch the head of my tutor for this one. Anyway thanks for the effort...
|
|
|
|
|
I have an application that is running on a japanese machine and it seems that the code in that application is not working properly.
It is having a char a[256] array and it looks like the char array is not getting populated with a string.
In all strcpy(a, "test is here") is not working. Is this something related to unicode stuff on japanese locale. Will usage of tchar solve the problem?
|
|
|
|
|
tom groezer wrote: Will usage of tchar solve the problem?
Have you tried it to see?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
tom groezer wrote: Will usage of tchar solve the problem?
But you will have to replace those functions with equivalent _tcs functions. If you want to completely move to UNICODE and no looking back, you can choose wchar_t and the corresponding wcs functions.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Application uses multibyte character set but the symbol _UNICODE is not defined. Nit sure if the LOCALE Japanese can make the application to run in Unicode format?
|
|
|
|
|
tom groezer wrote: Application uses multibyte character set but the symbol _UNICODE is not defined
You mean "And"?
When you declare, MBCS, you should not use UNICODE. And Japanese letter would work with UNICODE. Remove MBCS if you had defined in your settings. and add UNICODE,_UNICODE.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Sorry to not make you understand. The project uses MBCS settings. It can't be set to unicode settings.
I was thinking if this app is made to run on a japanese m/c is there a way that locale settings could turn the application to be unicode aware.Is that is the case, since my application code used char array and strcpy function would it make it compulsory to change the application code to use -tcscpy and tchar array. This application code works perfectly on a my system.
|
|
|
|
|
tom groezer wrote: Sorry to not make you understand. The project uses MBCS settings. It can't be set to unicode settings.
Then use the character mapping routines in tchar.h. It'll handle MBCS, Unicode, or ANSI. Just learn the equivalent string functions for it.
tom groezer wrote: This application code works perfectly on a my system.
Probably because your system isn't a Japanese one. Just use the character mapping routines in tchar.h and you'll be ok.
|
|
|
|
|
Hi to All,
First of all thanks to all for replies to my previous post.
I am going to do an simple chat application on a network(LAN).Using MFC.I wanted an advice whether to do it as dialog based, SDI or MDI? The application should be more or less the same as GTalk
Please advice for both client and server.
Thanks in Advance
I am a beginner
|
|
|
|
|
I will start with dialog based application... with some pretty custom drawings...
- ns ami -
|
|
|
|
|
thanks for your reply,
But what about the server? can that be also dialog based, since there will be many clients. So i was wondering if it has to be an console based application.
I am a beginner
|
|
|
|
|
Sorry. I am not much experienced in socket programing.
But if you are going to create a gtalk like application peer to peer model is enough.
- ns ami -
|
|
|
|
|
You could make your server a service.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Answered to me?
- ns ami -
|
|
|
|
|
thanks for your reply ns ami,
And sorry that was for code-o-mate.
anyway,do you mean "cleint-client" by "peer to peer"
I am a beginner
|
|
|
|