|
1. Are you returning CPropertyPage::OnSetActive(); in from your OnSetActive() function?
I am also calling Invalidate(TRUE) in InitDialog. Any help would be appreciated.
I have also tried OnPaint/ InitDialog etc. No luck. Thanks.
--> InitDialog() function is only called once and not everytime you navigate through the tab pages. so it won;t help.
Thanks
Abhi Lahare
|
|
|
|
|
Yes, I am returning return CPropertyPage::OnSetActive();
|
|
|
|
|
Thanks Abhi for replying to my question . I somehow found a solution. I made the picture control Transparent and Simple and moved the painting code to OnPaint. Now it seems to be working perfectly fine. Still not sure what the problem was .
|
|
|
|
|
I have a semi-transparent window. I need all mouse clicks to fall through to proper windows underneath mine. I need to implement a "click-through window"
How do I do this?
|
|
|
|
|
|
HTTRANSPARENT is usefull when you create a control and you want clickthrough to the parent... However in my case I want clicks to fall through a top level window to the underlying windows.
|
|
|
|
|
|
Hi all:
I'm required to manipulate files order through a listctrl, in that case the file ordering appears after the execution of DOS command "dir" must be the order I've specified in that listctrl. But note it has nothing to do with the command "dir" itself, the ordering after the execution of "dir" has some meanings to me!
I already come up with a solution which is the first file copy to the certain folder is appearing at the top of the list after execute "dir".
But with little testing I found that this solution is unreliable within certain environments. Such as if the destination folder is not clean (has some existing files and folders).
How can I accomplish this with other solutions?
Can anybody provides other alternatives, really stable ones!
Thanks for viewing!
|
|
|
|
|
As far as i know the DOS command dir lists files alphabetically.
|
|
|
|
|
Anonymous wrote:
As far as i know the DOS command dir lists files alphabetically.
Only on NTFS volumes. With FATxx volumes, they are enumerated in the order in which they were added to the FAT. The default sort order provided by the Dir command supercedes this, however.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi and Happy New Year!
I want my app running in the background. If I press "SHIFT" + "left mouse button" my application should get the content of the website (not the HTML code oder pic, text only).
I work with keybd_event() to send keys .
keybd_event(VK_CONTROL, 0, 0, 0); // press control
keybd_event('A', 0, 0, 0); // press 'a' to mark all
keybd_event('C', 0, 0, 0); // press 'c' to copy
m_ctrl_OriginalText.SetFocus();
keybd_event('V', 0, 0, 0); // press 'v' to paste
But I have a problem: I don't know how to send the keybd_event() of my app to a website I see. If I click the website my app'll loose the focus and doesn't work.
How can I solve this problem?
Thank you for your interest!
|
|
|
|
|
I dont see why you are trying to use a weird workaround...
You can user COM to properly access every aspect of the web browser (assuming u are talking about internet explorer)
|
|
|
|
|
rising_sun_2005 wrote:
I want my app running in the background. If I press "SHIFT" + "left mouse button" my application should get the content of the website (not the HTML code oder pic, text only).
You will have to write extensions for all the browsers where you want to accomplish this. If its for Internet Explorer its called writing BHO's (Browser Helper Objects). Search msdn for 'BHO'/'Browser Helper Objects'.
suhredayan There is no spoon.
|
|
|
|
|
Thank you all!
I'll try making it with this COM 'BHO'/'Browser Helper Objects'.
Have a nice day!
Thank you for your interest!
|
|
|
|
|
Hi,
Can anybody suggest a way to completely overwrite the contents of a text file with some new text?
Thanks very much,
dlarkin77
|
|
|
|
|
1) Open the file
2) Write some new text to it
3) Close the file
You left me high and dry and changed me
You lied to me and now i’m angry...
|
|
|
|
|
Thanks very much Shog9. Much appreciated.
dlarkin77
|
|
|
|
|
To be more specific, open the file with an option to truncate the file. I don't know what API:s you are using.
With standard C++ class std::ofstream , you can use the "normal" constructor: explicit ofstream ( const char * filename, openmode mode = out | trunc );
The last parameter is the open mode, which defaults to output and truncate.
In Win32, look at the function CreateFile . It has a parameter called dwCreationDisposition which you're interested in. You will want to use CREATE_ALWAYS or TRUNCATE_EXISTING .
For MFC, I really don't know. Haven't touched the crud in 3 years.
--
Komm tu mir langsam weh, leg mir die Ketten an
und zieh die Knoten fest, damit ich lachen kann
I blog too now[^]
|
|
|
|
|
Hi. I have encountered this problem as well, while working for some projects(writing a dos edit-like app, while handling the swap). As far as I could dig, I learned that one approach is to use a temp file, where you write the stuff you need in the file (which means you read the parts you need from the old file and put it in the temp file along with the new content), delete the original file, and name the temp file as you want. Even if some languages might hide that from you, that's what's happening underneath ...
|
|
|
|
|
For my setup , it is not WYSIWYG in the View . I do not know the number of pages for printing beforeHand . Basically I need to print out the contents of a Grid Control
I am overriding
1)OnPrepareDC (basically enables/disables continuing of printing)
that checks for the current Row( being printed out.
The code looks like this
void NewView1::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) <br />
{<br />
<br />
TRACE("Called OnPrepareDC\n");<br />
if(pInfo && printRowId>=m_grid.intf->RowCount){<br />
TRACE("FALSE\n");<br />
<br />
pInfo->m_bContinuePrinting=false;<br />
printRowId =0;<br />
}<br />
else{<br />
TRACE("TRUE\n");<br />
CFormView::OnPrepareDC(pDC, pInfo); <br />
if(pInfo)<br />
pInfo->m_bContinuePrinting=true;<br />
<br />
}<br />
<br />
}
and
2)OnPrint
<br />
void NewView1::OnPrint(CDC* pDC, CPrintInfo* pInfo) <br />
{ TEXTMETRIC tm;<br />
pDC->GetTextMetrics(&tm);<br />
string data;<br />
<br />
elapsed = printRowId;<br />
if(printRowId==0){<br />
data=m_grid.intf->Caption;<br />
pDC->TextOut(pInfo->m_rectDraw.left,pInfo->m_rectDraw.top+tm.tmHeight,data.c_str());<br />
} <br />
while(printRowId<m_grid.intf->RowCount && printRowId>=0){<br />
for(int j=0;j<17;j++){<br />
IsgCellPtr cell = m_grid.intf->GetCellAt(printRowId,j);<br />
data = cell->GetText();<br />
pDC->SetBkColor(cell->Style->GetBackColor());<br />
<br />
int x=((j-1)*2+5)*tm.tmMaxCharWidth;<br />
if(j==0)<br />
x=0;<br />
pDC->TextOut(pInfo->m_rectDraw.left+x,pInfo->m_rectDraw.top+(printRowId+3)*tm.tmHeight,data.c_str()); <br />
pDC->UpdateColors();<br />
<br />
}<br />
printRowId++;<br />
elapsed = printRowID-elapsed ; <br />
<br />
CFormView::OnPrint(pDC, pInfo);<br />
}
Now when I select the Print Preview it renders ok in the Print Preview Dialog , but when i click to zoom into it it displays a blank page .
I think that its a logical error where I am not able to trap the action of Zooming so that the code understands that the whole document needs to be printed again .
Where can I trap that ?
Engineering is the effort !
|
|
|
|
|
Hi,
I've created an SDI and as part of the application I have a dialog box that gets displayed when some action is done in the view. The dialog box is a separate class. I get some data in that dialog and need to store it in the document.
How can I -
- get a handle to the view from where the dialog was launched in order to be able to use the GetDocument() function within a message handler for the dialog box?
- solve this otherwise?
Thanks,
HelpWanted
|
|
|
|
|
Which class owns the Dialog ?
Engineering is the effort !
|
|
|
|
|
The dialog is in a separate class on it's own. Te view class creates an instance of it and calls the doModal() function to display it.
|
|
|
|
|
This will assume it is a modal dialog.
You mention needing to update the document, so
you need to add a command handler to the doc.
Either using ClassWizard, or manually, add
a command handler to the document.
BEGIN_MESSAGE_MAP(CMyDocument, CDocument)
...
ON_COMMAND(IDC_MYCOMMAND, OnMyCommand)
...
END_MESSAGE_MAP()
...
void CMyDocument::OnMyCommand)
{
}
You've already got a dialog box. I'll pretend
it has a few member variable that you store
data in.
void CMyDocument::OnMyCommand)
{
CMyDialog dlg (AfxGetMainWnd ()); // Make the dialog a child of the application window - doc don't have one.
dlg.m_bFlagOfSomeKind = FLAG_FOO | FLAG_BAR;
dlg.m_nVariable = m_nVariable; // Copy over a variable from the doc.
if (dlg.DoModal () != IDOK) // Do the dialog.
return;
// Use the results.
m_nVariable = dlg.m_nVariable.
m_nOtherVar = dlg.m_nResultData;
UpdateAllView (); // Sync view(s) with new contents of document.
}
Done!
Iain.
|
|
|
|
|
Yes, the dialog is a modal dialog.
Here are some follow up questions:
- What does AfxGetMainWnd() do?
- Can I create an instance of the dialog in the view and display it from there based on some menu choice by the user?
Thanks for the help!
|
|
|
|