|
When i applied LAYOUTRTL layout on my window by setting extended window style, everthing went fine. All the contorls, title bar, scroll bar all are now in right to left layout. However the images that were being displayed previously are not being displayed instead of that blank window is being displayed in place of the image data.
I am now totally clueless.
|
|
|
|
|
Hello to all,
First of all let me tell you what I am doing in my project, in my project I am collecting some data from two devices, one device is having USB connector and another device is having serial port (RS232) connector.
Now I will tell you the main problem, In my project I am creating one file and writting the data collected from any one of above device, into that file.The function in which I have written file writting operation code gets called after each 10 seconds. But problem is that when I collect data from device having serial port (RS232) connector then sometimes I get "CFile::sharingViolation" exception in file operation.I am giving my code also here. In below code "CreateRawDataFile()" function gets called after each 10 seconds and this function contains the code regarding file handling operation.
void CMainFrame::CreateRawDataFile()
{
CFile oRawFile;
CFileException ExceptionObj;
if(oRawFileIO.Open(FileName,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite,&ExceptionObj)==FALSE)
{
if(ExceptionObj.m_cause == CFileException::sharingViolation)
{
TRACE("\n Sharing violation");
}
}
else
{
code for writting data in a file
.
.
.
.
oRawFile.Close();
}
}
In above function sometimes I get "CFileException::sharingViolation" exception and then the TRACE statement which I have written gets displayed.Most surprising thing is that this file exception occurs only when I collect the data from the device having serial port (RS232) connector.Also I have checked that call to above function is going exactly after each 10 seconds and not before that.Also data is not much long which will not get written into file within 10 seconds.Most surprisingly it works very much accuratly without any file exception when I collect data from the device having USB connector.
Really I am not getting what exactly happening? Please can any body tell me what to do and how to remove this problem? It is really really very very urgent? Please help me out.
Thanks and Regards,
Anay
|
|
|
|
|
Maybe you have a race condition, where the USB handler has opened the file and then the serial handler tries to open it as well?
If I were you, I hold the file open through the life of the program (make the CFile variable a member of CMainFrame and open it in CMainFrame::Create , close it when the CMainFrame closes). Then there's no worry about the file needing to be shareable, as you won't be trying to open it more than once.
|
|
|
|
|
I build a web browser using Chtmlview.
and now I don't want use "Navigate2" function ,I want to get HTTP request ,which is come from the web browser, and store the this HTTP request,send it to WEB server by myself.
at the other hand , I can acquire the HTTP response by my application , How can I send the response to the web browser built by Chtmlview class.
I mean that how can I send/get the HTTP message between the chtmlview and myself.
Thank you very much!
Lampa
|
|
|
|
|
If you have the HTTP response, extract the body into a string and set it as the CHtmlView 's document by extracting the web browser interface pointer with CHtmlView::GetHtmlDocument and using the sample code on this page[^].
|
|
|
|
|
Hello Stuart Dootson:
Thank you for your reply.
Could you tell me how to get the HTTP request from the web browser ,which built by CHtmlView?
That is , when I click the button (or super HTTP link ),and the CHtmlView will generate the HTTP request and send it to WEB server . I want to get the HTTP request, how to do it?
Where can I find the answer?
Thank you again !
Lampa
|
|
|
|
|
maoxintt wrote: Could you tell me how to get the HTTP request from the web browser
Ah, sorry - thought you'd already done that bit...Anyway, you probably want to use the CHttpFile class in MFC. If you look at this page, Microsoft list the exact steps you need to take to read data over HTTP. Doesn't get better than that!
|
|
|
|
|
Thank you for your reply!
I am a newer for MFC. I have built a web browser using CHtmlView ,and I want to how to get the HTTP request from the web browser using ChtmlView.
I don't familiar with MFC , so could you tell me more about how to get it. I think the CHttpFile is use to handle the response from the WEB server. And I need to do is that how to intercept the HTTP request generated by my web browser.
Lampa
|
|
|
|
|
I dont know how to explain this.
I have a Visual Basic project which i wrote it for long time.
Now,I want control VB project from VC++ project.
For Example:
There is a "A" Button, and Text in CString of VC++ project (MFC exe).
when "A" button is pressed.
It will act like "B" button in VB project and Text will show on VB dialog.
I have heard the visual studio has tool for this but i can not find how does it look like..
Looking forward for your advice .
Thank
M
|
|
|
|
|
Member 4626568 wrote: I dont know how to explain this.
That's a bad start...
Member 4626568 wrote: There is a "A" Button, and Text in CString of VC++ project (MFC exe).
when "A" button is pressed.
It will act like "B" button in VB project and Text will show on VB dialog.
So...the VB and VC++ applications are both running and you want to control aspects of the VB app from the VC++ app? Tricky...
Member 4626568 wrote: I have heard the visual studio has tool for this but i can not find how does it look like.
Nope, can't say as it does.
|
|
|
|
|
I dont understand what do you need do you want to convert your code or you want to use of a project on other project?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I have a list control in my View class, (i created a list control using on draw )which I can see it on my main frame. But it does not show up in the print preview. Any help would be appreciated.
|
|
|
|
|
You have to draw your data onto the print preview (or, for that matter, the print) youself - all you get is a DC (device context) on which to draw. Control's won't help you with printing.
|
|
|
|
|
How did you make your preview?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi,
Could anyone tell me how to create a view using the "Create()" in the child frame and that too the view should completely occupy the ChildFrame's client area.
Thanks in advance
Taruni
|
|
|
|
|
|
I am to provide RTL Layout for the CPropertySheet.
As it is derived from the CWnd, I am setting WS_EX_LAYOUTRTL as the extended style.
But it is doing nothing. Just added a Debug Assertion Failure to my code.
Please suggest me how can i provide the RTL layout for the CPropertySheet.
<br />
#include "stdafx.h"<br />
#include "CmnCtrl1.h"<br />
#include "propsht.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CCmnCtrl1App, CWinApp)<br />
ON_COMMAND(ID_HELP, CWinApp::OnHelp)<br />
END_MESSAGE_MAP()<br />
<br />
<br />
CCmnCtrl1App::CCmnCtrl1App()<br />
{<br />
<br />
}<br />
<br />
<br />
CCmnCtrl1App theApp;<br />
<br />
<br />
BOOL CCmnCtrl1App::InitInstance()<br />
{<br />
AfxEnableControlContainer();<br />
<br />
<br />
CAllControlsSheet allcontrolssheet(_T("Common Controls Sample"));<br />
allcontrolssheet.ModifyStyleEx(0, WS_EX_LAYOUTRTL);<br />
allcontrolssheet.m_psh.dwFlags |= PSH_RTLREADING ;<br />
m_pMainWnd = &allcontrolssheet;<br />
m_pMainWnd->ModifyStyleEx(0, WS_EX_LAYOUTRTL);<br />
allcontrolssheet.DoModal();<br />
return FALSE;<br />
}<br />
<br />
|
|
|
|
|
Looking at this page[^], I think you need to set WS_EX_LAYOUTRTL in the resource file for each property page (as each property page is a dialog), rather than directly on the property sheet?
|
|
|
|
|
Thanks for your reply. I tried setting the Layout RTL flag to true for each property page in the resource file. I also set the language of these property pages to Arabic. The result was that the individual pages (tabs) are getting displayed in the Right to Left layout.
But the container window (main dialog box that is the Property Sheet) is still in LTR layout.
Please suggest for the same..
|
|
|
|
|
Looking at the description of PSH_RTLREADING on this page[^], maybe you don't need to set both PSH_RTLREADING AND WS_EX_LAYOUTRTL ?
CAllControlsSheet allcontrolssheet(_T("Common Controls Sample"));
allcontrolssheet.ModifyStyleEx(0, WS_EX_LAYOUTRTL);
allcontrolssheet.m_psh.dwFlags |= PSH_RTLREADING ;
m_pMainWnd = &allcontrolssheet;
m_pMainWnd->ModifyStyleEx(0, WS_EX_LAYOUTRTL);
|
|
|
|
|
I tried the same after removing both the lines pointed by you. Still the main container window is in LTR layout.
What i got from the PSH_RTLREADING documentation and its implementation in my project, is "PSH_RTLREADING" only changes the the caption. What is require by the RTLLayout is change in the whole TITLE bar, Status bar, tabs all these should be in the Right of the screen.
Canption should be displayed in the Right of the Title bar.
However PSH_RTLREADING only changes the caption in RTL. However the position of the caption in the Title bar still reamings in teh left.
|
|
|
|
|
I'm wondering if you might be better using SetProcessDefaultLayout and removing the other explicit RTL options in your app...
I'm afraid my knowledge of the subject is exhausted now
|
|
|
|
|
SetProcessDefaultLayout(LAYOUT_RTL ) is not solving the problem.
|
|
|
|
|
CPropertySheet layout is automaticly change by the OS
|
|
|
|
|
My project is Dialog base and I want to change "Font" of all control on this dialog.
What's the function can support this issue?
|
|
|
|