|
The functions I need to access are public and declared as virtual. That's the first thing I checked.
public:<br />
UINT virtual NewDocument();
It's not that I hate object orientation; I've just never understood the point of virtual functions. I don't understand why you would want to use them.
Christian Graus wrote:
Is it possible to put code that defines the interaction between these two objects into a third class, so that they don't become tightly coupled ?
Not at this time, although that is a possibility later on. For right now, though, I have to get it working this way.
|
|
|
|
|
What do you mean by: I can't access them ? Compilation error/warning ? Failing assertion ? Crash ?
|
|
|
|
|
My apologies; I should have been clearer on that point.
When I click on the Print button on the property sheet, it gives me an access violation (Error code: 5) when I'm in debug mode.
|
|
|
|
|
That's not a problem of virtual, private nor public function. Access violation means you violated the memory you accessed, i.e. address of memory wasn't valid.
|
|
|
|
|
Have you placed any breakpoints to determine exactly where the access violation occurs (When you try to call the function, or inside the function...may trying to manipulate another object that isn't there anymore). How does this Print Object get instantiated?
|
|
|
|
|
bcemick wrote:
Not at this time, although that is a possibility later on. For right now, though, I have to get it working this way.
It's NEVER a good idea to 'do it this way for now and change to a good design later'. I suggest you stop coding and read a book called 'Code Complete'. Seriously.
If the function is not pure virtual ( has no body for you to call anyhow ), I don't see why you can't call it.
|
|
|
|
|
Plz tell me about an api that enlists the status of NIC?( keyboard ,Hard disk and RAM)
Wheather they are installed or not ? Plz also provide its example
|
|
|
|
|
Status is a vague term but perhaps the IP helper API is what you are after. See here for starters.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
How can we get the list of applications runned by a particular user?
like MS Word, MS powerpoint, notepad used by administrator and also provide examples. Plz help me out pals
|
|
|
|
|
Hey all,
I'm kind of lost here, I want to listen to a file-creation event in my computer.
Not that simple I know but according to the few documents on the web I understand there is an API function (ShellNotifyRegister) that suppose to solve my problem
(you can check: http://www.geocities.com/SiliconValley/4942/notify.html to learn about it)
Anyway, I have the known error:
unresolved external symbol "void * __stdcall SHChangeNotifyRegister..."
in the linking phase..
Does anyone know how to solve it..?
Thanks.
RoyRose78
|
|
|
|
|
|
You might also want to check out ReadDirectoryChangesW() and FindFirstChangeNotification() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have put this question before but it was misunderstood.
I need to declare a pointer to MFC class CMyView in CMyDialog but including myview.h in mydialog.h leads to errors (propably because mydialog.h is also included in myview.h).
Any solutions ?
|
|
|
|
|
Do not include myview.h in mydialog.h.
Put the following line right before your class definition for CMyDialog:
class CMyView;
And include myview.h in your cpp file after the include for mydialog.h.
John
|
|
|
|
|
Use forward declaration of a class. For example:
class CMyView;<br />
class CMyDialog<br />
{<br />
CMyView *m_pView;<br />
};<br />
.<br />
.<br />
.<br />
class CMyView<br />
{<br />
};
That works.
|
|
|
|
|
Do you really need to declare a pointer to CMyView or will a pointer to a CView suffice? Remember, you can always cast the pointer to a CMyView* in MyDialog.cpp .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi there,
How can I set the main applicatin window to a certain size at startup? With the code below, it sizes to the set size only when the Restore button is clicked. I'd like it to be that size when the application starts up. How can I manage this? Thanks!
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style =
WS_OVERLAPPED | WS_CAPTION |
WS_THICKFRAME | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
cs.cx = 1000;
cs.cy = 800;
cs.x = 100;
cs.y = 100;
return CMDIFrameWnd::PreCreateWindow(cs);
}
|
|
|
|
|
Use the following Cwnd function,
BOOL SetWindowPos(
const CWnd* pWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT nFlags
);
Do a search on this fcn in msdn to find out more.
|
|
|
|
|
This function is only for child windows and popups. How can I size the main window not the child window? Thanks.
|
|
|
|
|
Have you tryed it? It's always worked for me. If you go on MSDN, the actual description is:
"Call this member function to change the size, position, and Z-order of child, pop-up, and top-level windows."
Also, make sure you put this in the OnCreate fcn.
|
|
|
|
|
You can do that by handlling [WM_GETMINMAXINFO] message too!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello everybody, I hope someone can help me with this problem, i have tried a failed miserably.
I have a client/server app, each machine will have 2 LAN adapters (one for stream data at high rates and the other for control). The underling protocol is UDP. So in order to implement a response mechanism I use the sender address returned as an output parameter from the receivefrom() function. When working with 2 different PC there is no problem (both of them with 2 lan adap), the problem appears when I tried to run the apps in my developing machine to test one of the protocols, recivefrom() returns the address of the adapter listening, not the address of the sender… so I can’t acknowledge the packet send.
Does anybody has experienced this kind of problem, or something related? Is there any sockopt() that I can use? OS configuration? (by the way this runs in win2k).
Thank you all.
"I don't want to achieve immortality through my work... I want to achieve it through not dying."
Woody Allen
|
|
|
|
|
if you're testing client and server apps on the same machine then you will get problems, cos u cant create 2 udp sockets on the same port.
|
|
|
|
|
I need to access MFC view class from modeless dialog class.
Is it possible ?How
|
|
|
|
|
the easiest way is to just give that dialog a pointer to the view you want to access.
theDialog->m_pView = pPointerToViewObject;
or, if you want the dialog to access the active view, you can use AfxGetMainWnd and CFrameWnd::GetActiveView to find it.
Image Toolkits | Image Processing | Cleek
|
|
|
|