|
Can't you open the file in binary mode in the first place, instead of changing the mode later?
|
|
|
|
|
I am not entirely sure how to do that in eVC++ considering i need 2 header files that doesnt exist.
This is what i did in VS6 :
"FILE *fp = fopen("c:\\c.bmp", "w+");
_setmode( _fileno( fp ), _O_BINARY );
....code to receive data from socket.....
....write data to file...."
are there equivalent io.h and fcntl.h (under different names ??) in evc++?
sparky
|
|
|
|
|
|
Hello all,
I really have the feeling that this is a stupid question, but for some reason I do not see the answer
Problem (Multi Doc Interface project):
When creating a new document (OnNewDocument), I also need to have access to its ChildFrame object to set some data member (via public method). I used next code, but its unfortunaltely faulty.
<br />
BOOL MyAppDoc::OnNewDocument()<br />
{<br />
if (!CDocument::OnNewDocument())<br />
return FALSE;<br />
...<br />
CMainFrame *pMainFrame = ( CMainFrame* )AfxGetMainWnd(); <br />
ASSERT( pMainFrame ); <br />
CChildFrame *pChild = (CChildFrame *) pMainFrame->GetActiveFrame();<br />
<br />
...<br />
}
Where I'm going the wrong way?
More background info:
In my ChildFrame (not MainFrame) I've defined a statusbar, which should be updated with info I've available at the moment of creation doc (or view).
Thanks in advance,
EiSl
|
|
|
|
|
Perhaps You forgot to call the base class:
BOOL CMyDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// Do initialization of new document here.
return TRUE;
}
The MSDN says that this is called as a part during the File New Command.
You can't be sure that the window already has been completely created.
I did always keep a list of doc/view ptr in min App Object. It worked very well.
<br />
class CMyApp<br />
{<br />
<br />
<br />
public:<br />
vector<CView *> m_ActiveViews;<br />
vector<CDocument *> m_ActiveDocs;<br />
}<br />
<br />
I always filled both in the members in <br />
<br />
void CMyView::OnInitialUpdate( )<br />
{<br />
CView::OnOnInitialUpdate();<br />
<br />
CMyApp *pMyApp = (CMyApp *) AfxGetApp();<br />
if( pMyApp )<br />
{<br />
pMyApp->m_ActiveViews.push_back(this);<br />
pMyApp->m_ActiveDocs.push_back(GetDocument());<br />
}<br />
}<br />
where i could be sure that the window was created and the document ptr
already existing. This would be a better place to change the frame window.
Keep Your list up to date and all will work fine.
<br />
CFrameWnd::InitialUpdateFrame( CDocument* pDoc, BOOL bMakeVisible );<br />
would be the best place to change the frame window behaviour
|
|
|
|
|
Thanks for reply Alois,
I've updated my example since I'm indeed first calling
<br />
if (!CDocument::OnNewDocument())<br />
return FALSE;<br />
after I'm continueing with the rest of my stuff.
More background info:
In my ChildFrame (not mainframe) I've defined a statusbar (at bottom). This one should be updated with information I've available at the 'OnNewDocument' (so the Doc) or in the View. That's the reason I need a pointer to ChildFrame to be able access my CStatusBar member.
Thanks,
EiSl
|
|
|
|
|
Did you try the opposite direction ?
Overide
<br />
CFrameWnd::InitialUpdateFrame()<br />
and get a ptr to your new created document in this function.
There You can safely update your status bar because you can be sure that the
frame window already exists.
I think the problem is that when OnNewDocument is called only the CDocument
is created. The View does not yet exist. The order is if I remember right
first the document then the view with the frame is created. You are trying
to update a frame which does not yet exist.
|
|
|
|
|
hai,
We customized the default open dialog by deriving the class from
cfiledialog . These are the issues that we faced.
Issues:
1. How to handle the default messages in cfiledialog class?
2. In Win'2000 & above, we tried to change the listview style to
LVS_REPORT using Modifystyle method The style is changed, but the files and
column headers are not displayed.
3. In Win'98, how to remove the separator in toolbarwindow32.
Please give me the solution as early as possible.
sureshb
|
|
|
|
|
easiest way to remove separator is to write into the .rc file. open it find the separator and remove the line and you will see you are done. elase you can also modify setting styles.
cheers
Himanshu
|
|
|
|
|
I am writing win32 application.if the application throws any error .how can i handle it.
Any function to handle the error properly.
Thanks in advance.
|
|
|
|
|
u can use c++ native try catch macros or even MFC TRY/CATCH
|
|
|
|
|
Hi,
In my appication i want to check whether the the lbutton is kept pressed.So in my OnLbuttondown() function
i have GetQueueStatus(QS_MOUSEBUTTON || QS_MOUSE || QS_INPUT) it always returns 0 eventhough the left button is down..Can any one tell why is it so?
Regards
Neha
|
|
|
|
|
GetQueueStatus() tells you about the message queue, not the mouse itself. Call SetCapture() in your OnLButtonDown() and you'll get all the mouse messages (regardless of where the mouse moves to), so you'll know when the button is released.
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
When you document a class using the UML you can show the visibility of the various member functions and variables through the use of -, # and + to indicate private, protected and public visibility. However, when you use graphical methods to show aggregation or association what is the implied visibility here - private? How would you indicate any other type of visibility - through the use of stereotypes? If so, is there a standard method for doing this? This is something my UML books seem to gloss over.
Phil
|
|
|
|
|
http://www.omg.org/
OMG Unified Modeling Language Specification, Version 1.4 September 2001
3.43 Association End
3.43.2.9 visibility
"Specified by a visibility indicator (‘+’, ‘#’, ‘-’ or explicit
property name such as {public}) in front of the rolename. Specifies the
visibility of the association traversing in the direction toward the
given rolename. See Section 3.25, "Attribute," on page 3-41 for details
of visibility specification. Other properties can be specified for
association ends, but there is no graphical syntax for them. To specify
such properties, use the constraint syntax near the end of the
association path (a text string in braces). Examples of other properties
include mutability."
|
|
|
|
|
Excellent - thanks very much! Having the actual spec to hand is a good idea - thanks for the link.
Phil
|
|
|
|
|
Hi, i need to develop an application which has to be appear in the full screen size . Can any one pls help me how to do make a window or dialong screen size? Thank you very much in advance.
|
|
|
|
|
use the code:
int screenWidth = ::GetSystemMetrics(SM_CXSCREEN);
int screenHeight= ::GetSystemMetrics(SM_CYSCREEN);
::MoveWindow(hDlg,0,0,screenWidth-1,screenHeight-1,TRUE);
|
|
|
|
|
use CDialog::MapDialogRect () and set your parameters. Hope this works fine for you.
cheers
Himanshu
|
|
|
|
|
|
If you want to draw your dialog/window over the taskbar first you must change the workarea:
<br />
CRect rectWorkArea;<br />
<br />
rectWorkArea.left = 0;<br />
rectWorkArea.top = 0;<br />
rectWorkArea.right = ::GetSystemMetrics(SM_CXSCREEN);<br />
rectWorkArea.bottom = ::GetSystemMetrics(SM_CYSCREEN);<br />
<br />
SystemParametersInfo(SPI_SETWORKAREA,<br />
0,<br />
&rectWorkArea,<br />
SPIF_SENDCHANGE);<br />
and then you must resize your dioalog/window.
Remember to change the workarea when closing your app.
Hope this helps...
|
|
|
|
|
Thank you all. Thank you very much for the quick reply.
|
|
|
|
|
Is there a way to see if the default printer is printing in colour, grayscale or black and white?
well hell doesn't want you
and heaven is full.
Tom Waits
|
|
|
|
|
Take a look at this, might help:
PRINTER_INFO_2 has a pointer to DEVMODE structure. In DEVMODE is dmFields, value DM_COLOR is what you are looking for?
You can find more info about the structures from MSDN, or ask. I'm currently working on PRINTER_INFO_* and DRIVER_INFO_*.
------------------------------------------
Experience is the name every one gives to their mistakes.
-- Oscar Wilde
Experience is one thing you can't get for nothing.
-- Oscar Wilde
|
|
|
|
|
Thank you
well hell doesn't want you
and heaven is full.
Tom Waits
|
|
|
|