|
I like to know how can I get a pointer to a particular Document
Are you sure? The rest of your post describes problems with getting pointers to views. If this is the case, use CDocument::GetFirstViewPosition and GetNextView.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Do I have to get position of the first CView,
then iterate through the rest fo the Views??
Ehsan Behboudi
|
|
|
|
|
|
I used this, but it doesn't work,, any ideas???
CMyView CMyDoc::GetView(int n)
{
int ViewCount=0;
POSITION pos = GetFirstViewPosition();
while (pos)
{
CMyView *ppView=GetNextView(pos);
if(NULL!=ppView)
{
POSITION posView = GetFirstViewPosition();
while(posView)
{
CMyView *pView = GetNextView(posDoc);
if(NULL!=pView)
ViewCount++;
if(nDocCount == n)
pCurrView =(CMyView*)pView;
}
}
}
return pCurrView;
}
Ehsan Behboudi
|
|
|
|
|
|
Hi,
I like to know, how can I open a blank document from my CView class.
I mean actually write the code for ID_FILE_NEW.
I tried the following code, but it doesn't work.
CWinApp* pApp = AfxGetApp();
pApp->OpenDocumentFile(NULL);
thanks
Ehsan Behboudi
|
|
|
|
|
Could anyone tell me if there's an easy way to convert date/time from CString to CTime?
I would, for example, like to convert the string "2001-07-26 14:37:00" to a CTime object. I could do this using string operations to parse out the year, month, etc.. This, however, does not feel like a good solution since it's not very flexible. I would have to include several if-statements in the parsing to be able to handle dates on other formats, like "2001-07-26", "2001-07-26T14:37", etc.
What would make me very happy is if there's a way to use formatting string to specify the format of the input. Like when I convert a CTime object to a CString using Format() with formatting codes like %Y, %m, etc.
Maybe somebody has written a class, derived from CTime, that could handle this?
Jimmy Ehrnström
|
|
|
|
|
You can use COleDateTime::ParseDateTime( string ) to convert the string into the underlying DATE object.
If you don't like to use COleDateTime objects and need the CTime object, you would have to convert between the two. Create a tm structure and populate the structure from the COleDateTime object and then using mktime( tm ) assign the result to the CTime object.
|
|
|
|
|
|
hi,
I'm building a web browser, and I need to provide Java Console Option as IE provides, How could I do it...?
Gaurav Lambole
webdunia.com (India) pvt.ltd.
|
|
|
|
|
Hello,
How can I place the entire contents of a RichEditView into a variable? I can do it if the user selects the text, but I would like to do it unselected.
Also, is there a limit to the size of a string stored in a CString variable?
Thanks!
Frank
|
|
|
|
|
I guess you could use GetRichEditCtrl to get the control associated with the view and then GetWindowText.
/Per
|
|
|
|
|
Thanks, I'll give that a try.
Frank
|
|
|
|
|
How can i link DB grid to DAO database ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
how to make a program startup screen where an image is displayed.
Please help me quick.
Thank You
|
|
|
|
|
From VC++ menu select Project/Add to project/Components and controls/VC++ components/Splash screen
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
In the MSDN example program Wordpad there is a splash window. Maybe that will help you.
/Per
|
|
|
|
|
In VC++, is there any way to override the global "new" operator in a DLL and have other DLLs (which link together with this one) and the main program
(which links with all the project's DLLs) use this operator? If there is a way, I would appreciate seeing how it is done.
My attempts so far have produced the following conclusion:
If I add an overloaded "new" operator definition with an additional parameter,
e.g.
__declspec(dllimport) void * operator new(size_t , unsigned long);
There is no error, but as soon as I include the prototype definition of my "new" operator which contains only one argument:
__declspec(dllimport) void * operator new(size_t);
I get the following error:
error C2375: 'new' : redefinition; different linkage
C:\TEMP\a00238if(73) : see declaration of 'new'
If there is no way to do this in compile time, but there is a way in run-time, I would appreciate seeing how that is done, as well.
Thanks,
Jacob.
|
|
|
|
|
The simplest solution would be to implement real allocator as exported function living inside your DLL -- and -- provide overloaded inline operator new that simply calls that function. Operator new would be defined in .h file that all DLLs and EXE would #include.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
first of all, thank you very much for your consideration.
Please help me! I want to get a word on the screen (eg. on a label, on a button...) by clicking right mouse on it.
I guess that I must do some hook to API functions or window's messages, but I don't know how to do it.
Please show me the way or send me an example.
Once more thank you very much.
trungnq.
|
|
|
|
|
Override the OnContextMenu or MouseDown and draw your text.
|
|
|
|
|
|
Is it the same person asking this question over and over again ? I can't think of a use for this function myself, and I imagine the only way to do it would be with some simulated word selection and copying via the clipboard. I assume the absence of a function that does this is the reason it never gets an answer...
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
check out MSDN on how to do this. what sort of application are you doing? assuming you are using MFC, you want to override CWnd::OnRButtonDown(UINT nFlags, CPoint point). the associated command message is ON_WM_RBUTTONDOWN.
|
|
|
|
|
check out MSDN on how to do this. what sort of application are you doing? assuming you are using MFC, you want to override CWnd::OnRButtonDown(UINT nFlags, CPoint point). the associated command message is ON_WM_RBUTTONDOWN.
|
|
|
|