|
ns wrote:
I didnt put the doc.h before the view.h include
Uh oh
Yeah, the order is very important. The preprocessor transforms the source file and all it's included files (minus #ifndef'd out sections etc) into one big file (not sure on the actual storage of it), then the compiler compiles that. So if you don't include doc.h before the view class, this is what the compiler sees:
class CYourView : public CView
{
...
CYourDoc * GetDocument();
};
class CYourDoc : public CDocument
{
...
};
And that's what caused your problems. Glad to hear that you fixed it!
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I'm reading <<programming applications="" for="" microsoft="" windows="">>, and get confused by some point.
The following is quoted from :
"every process has its own private address space. Process A can have a data structure stored in its address space at address 0x12345678, while Process B can have a totally different data structure stored in its address space—at address 0x12345678. When threads running in Process A access memory at address 0x12345678, these threads are accessing Process A's data structure. When threads running in Process B access memory at address 0x12345678, these threads are accessing Process B's data structure. Threads running in Process A cannot access the data structure in Process B's address space, and vice versa."
my questions are:
1> 0x12345678 appears in both process A and B. is
0x12345678 the actual virtual address or just the offset
to the base virtual address of a process?
2> if the answers to the first question is "actual virtual
address", does that mean two processes could have the
same virtual address(or overlapped virtual address, in
other words)?
2> how does the system raise a Access Violation exception?
in particular, is the exception raised by checking the
virtual address against the process's address space or by
checking it against the phisical address after address
translation?
Thank you very much!
Wenrich
|
|
|
|
|
You kind of complicate the issue (not without the help of the good book ).
Virtual address could be understood as mapped address. This mapping service provided by the system so it is transparent to the program. Each process has right to use up to 2GB in Win9X and 4GB in WinNT (I could be wrong on the actual numbers but that is irrelevant). Obviously very few computers have that much memory, so system uses swapping to load requested memory block into the physical memory. If application ask for memory at 1GB offset it does not mean that it actually offset to the physical memory. The physical address of the memory block could be changed during lifetime of the program. The virtual address stays the same, because, once again it is just mapping for the system to know what a program is asking.
|
|
|
|
|
Thanks a lot!
I'm aware of the virtual memory and physical memory concepts. I just got
confused by the statement that process A and process B both have acess to virtual memory at 0x12345678, because my understanding is that the system
uses the virtual memory space allocated to the process to verify whether a memory access is valid and an Access Violation would be raised if it's not.
Is my understanding wrong?
Thank you very much for your help!
Wenrich
|
|
|
|
|
I want to draw a line/rectange(normal CPaintDC functions) in a Dialog?
|
|
|
|
|
Add a handler for the WM_PAINT message (OnPaint) and have a blast.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
Maybe you're right, but I'd say WM_ERASEBKGND is the place to go.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm looking to have my app monitor another app (Internet Explorer) and respond to any dialogs( warning, error, connection ) that appears so the user doesn't have to. I have started studying up on hooking, but I wanted to see if that is the correct approach.
As a note, my app starts the IE instance that I want to monitor.
Thanks for any help or suggestions.
-Rick
|
|
|
|
|
a better approach for specifically hooking to internet explorer is to use Browser helper object
check
http://www.codeproject.com/system/hooksys.asp
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
I have already posted this message but somebody told me that it's wasn't clear enough.
Here is my problem.
I have a MDI App that contain a dialogbar(modeless dialog). On my dialog, I have a bitmap. I want my bitmap to have transparency on some part of it so that I can see the default color of my App in those part.
In my Mainframe class, I have a variable named m_wndDlgBar from CDialogBar and my dialog is created in the ressource editor.
I tried to use
LoadMappedBitmap(IDB_LOGO, 0, &color, 1)
with
COLORMAP color;
color.from = RGB(0,0,0);//color to be changed
color.to = COLOR_WINDOW;//default color
thanks!
|
|
|
|
|
I found out that the location of a #import statement matters.
Does the location of #includes matter? I have them as shown on rted. Are they in the right place in the .h file? Should they be moved above or below the #if s?
#if !defined(AFX_SEARCHVIEW_H__4E3DD48E_02D6_42F4_88D5_81E8ECCC08B2__INCLUDED_)
#define AFX_SEARCHVIEW_H__4E3DD48E_02D6_42F4_88D5_81E8ECCC08B2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXEXT_H__
#include <afxext.h>
#endif
<code>#include "mainfrm.h"
#include "childfrm.h"</code>
class CSearchView : public CFormView
Thanks
Appreciate your help,
ns
|
|
|
|
|
In your case, they should be after the #if's
don't put #include in .h files unless absolutly necessary, for example class inheritance, and non-pointer class objects.
#include "BaseClass.h"
#ifndef _SOMEOBJECT_H_
#include "SomeObject.h"
#endif
class MyClass : public BaseClass
{
SomeObject m_SomeObject;
};
the declaration of m_SomeObject could/should be replaced by
#include "BaseClass.h"
class SomeObject;
class MyClass : public BaseClass
{
SomeObject* m_SomeObject;
};
Max.
|
|
|
|
|
Gosh! I thought I was doing something wrong when I would put #includes in the cpp file!!! SO I started putting them in the .h!
So If I have a A.h and a A.cpp pair with a #include B.h in A.cpp, and I go and do a #include A.h in file C.cpp, everything will work out right?
Thanks
Appreciate your help,
ns
|
|
|
|
|
Why should we put our #include's in .cpp files rather than .h files? (I'm a student, not a programming expert)
Blackmesa
Computer engineering student
Étudiant en génie informatique
------------------------------
|
|
|
|
|
To remove the dependencies of objects.
if in class A I have an Object O and is declared directly in the class declaration, I need to have the #include for it in the .h file.
#include "O.h"
class A
{
O m_o;
};
so, everytime that O changes ( the file is changed ) , a.cpp. and every other files that include a.h will be recompiled.
but if I have
class O;
class A
{
O* m_pO;
};
there's no dependencies in the .h file.
For small projects, it's not that important whether you put #include in the .h files, but for large projects, is can be costly.
See Large Scale C++ Software Design[^] by John Lakos, and in particular section 6.1.
Max.
|
|
|
|
|
Alright, I've looked all over the friggin place, and I'm starting to get frustrated.
All I want to do is have a control that contains rendered HTML from local text that I feed it. I won't be loading anything from the web. Just from text strings in memory.
I've tried the CHtmlView, but on creation it seems to have no document in it. After I Navigate2() some page, then I can call GetDocument() and start replacing the internal HTML. But I don't want to have to Navigate2() anywhere.
Am I completely loopy for wanting to do this?
All I need is a simple control that renders HTML from a string input. Any recommendations?
J
May the bear never have cause to eat you.
|
|
|
|
|
If using the CHtmlView, you need to Navigate to "about:blank" first, then wrench around the document. Or, my personal favorite, go to QHTM[^] and use his control.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
I'll try that "about:blank". Sounds like that's what I need. And as to wrenching around the document, is that the way to do it?
CHtmlView::GetDocument() -> IDispatch
IDispatch->QueryInterface -> IHtmlDocument3
IHtmlDocument3->documentElement -> IHtmlElement
set IHtmlElement->innerHTML
Seems convoluted.
On the other hand, QHTM looks like it solves my problem quite nicely. It will even let me do my internal navigation without having to host a custom pluggable protocol for IE...
Thanks!
J
May the bear never have cause to eat you.
|
|
|
|
|
No, you don't need to wrench to hard. I have some code that does it, but it boils down to getting the IHTMLDocument2 interface, then calling the Write method. Thats about it. My code has some other useful functions like setting the background color, overriding the opening of new windows, and so forth, but to just display a document thats all you need to do.
Joel Lucsy
|
|
|
|
|
Perfect. I knew there would be an easier way. Of course having to create a safearray for a single string seems a little extreme, but I'll give it a go.
Thanks for your help!
J
May the bear never have cause to eat you.
|
|
|
|
|
|
Yes, QHTM looks quite handy. I'm undecided as of yet whether or not I need the full IE control...
I saw the XHTMLStatic control, but it's too lite for me. I need pretty much full HTML compliance.
J
May the bear never have cause to eat you.
|
|
|
|
|
how can i set a new Registry Key with a binary or a DWORD value? I have set a String Value for a Registry Key. But I could not set for a Binary or DWORD.
Pl. give me an example coding.
vijay
|
|
|
|
|
BYTE Buffer[256] = {1, 2, 3, 4, 5, 6};
LONG nRetVal = ERROR_SUCCESS;
HKEY hKey = 0;
nRetVal = ::RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\MyCompanyName"), 0, KEY_ALL_ACCESS, &hKey);
if(nRetVal != ERROR_SUCCESS)
return ::RegSetValueEx(hKey, _T("My Binary Field"), 0, REG_BINARY, Buffer, sizeof(Buffer)/ sizeof(BYTE));
return nRetVal;
|
|
|
|
|
Do you know any function to return if the app is running from a server or from the local machine ??
Thanks,
Cris.
|
|
|
|