|
You can use the analogy of a memory address being a phone number - where each process is equivalent to an area code.
If you call a number from the same area code you will get the person you expect. If you use a pointer withing your process you will get the data you expect...but if you use a phone number from a different area code you will get a wrong number and if you use a pointer from a different process you will get a wrong address which usually results in a program crash.
If you want to access another process' memory use the API call ReadProcessmemory which is equivalent (in the above tortured analogy) to adding the area code to the phone number.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Each process has its own virtual memory space. Simply, this means your processes pointer (0x1000) will
point to a different bit of silicon than the same pointer in a different process. This makes your
life simpler and allows for security (you have to work hard to damage another process, and vice versa).
The far keyword was used in 16bit windows to indicate a 32 bit pointer, with some other fancy bits.
It is completely obsolete in 32 bit machine. I imagine the compiler just pretends you hadn't typed
it.
Iain.
|
|
|
|
|
Iain Clarke wrote:
I imagine the compiler just pretends you hadn't typed
it.
Actually, the compiler never sees it as the preprocessor strips it out.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
I was trying not to confuse the chap. I normally simplify preprocessor, compiler, and linker into
one big lump unless I can't do so. A big black box. Typed stuff in one end, exe / dlls out the other.
Unless they're doing occasional clever things, I imagine most people do to.
So there...
Iain.
|
|
|
|
|
I'm writing a context menu shell extension that is shown in response to user right-click on directory background. I need to get the explorer interface (iwebbrowser2 or similar) that executed my extension. From what I found the communication is one-way and I can't get what I need. Am I missing something, or is there some hack?
|
|
|
|
|
I've had a quick look see, and about the only information you get from the caller is the HMENU.
As this doesn't help you too much, you may be able to go from the mouse position. That would
certainly tell you the window of the explorer area. You may be able to go from there.
But in short, you're not *meant* to know / care. The information you need is passed through
the IShellExtInit::Initialize interface. That gives you the PIDL of the folder, and an
IDataObject (whatever that is!). I can't think why you'd need more.
If you expand of what you want from the caller, I may be able to help.
Iain.
|
|
|
|
|
Iain Clarke wrote:
If you expand of what you want from the caller, I may be able to help.
I want to be able change the directory of the calling explorer. More or less like the "Go To Folder" feature of http://www.shelltoysxp.com/[^].
|
|
|
|
|
Will a Separate copy of Dll be loaded for each application reference? If so, How can I share the same data between applications? could anyone explain please.
Shenthil
|
|
|
|
|
Correct. Each process gets a copy of the DLL data in its address space.
There are several solutions to data sharing across address space. One solution is memory-mapping.
Kuphryn
|
|
|
|
|
You can also mark certain data segments in a DLL as shared.
From the MSDN docs:
#pragma section ("mysectionname", read, write, shared)
__declspec(allocate("mysectionname")) int my_shared_variable = 0;
This will create a section within your DLL called mysectionname. It will be shared among the processes which loads the DLL. By using __declspec(allocate) you advise the compiler to put the variable in that section instead of it's private data segment.
--
You're entertaining at least.
|
|
|
|
|
Hello there,
I have a very stupid question to ask and I know I'm going to kick myself when I find the answer:
How do you change the font in a static text (label) box in a dialog.
Thanks in advance
|
|
|
|
|
Click the entire Dialog and Check for its properties. U'll have font attribute changing which changes the font of static text too.
Shenthil
|
|
|
|
|
But this changes the font of all the controls. I just want to increase the size of the static text control.
|
|
|
|
|
Create a CFont object to you liking settings... then
use setfont method of the static object to the font.
its really not that supid question
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
Thanks for the reply, how do I access the objects SetFont() method?
CMyClass::SetFont( ) is wrong isn't it???
My dialog class is derived from CFormView class.
Thanks.
|
|
|
|
|
CWnd *pStatic = GetDlgItem (IDC_FONTINGSTATIC); // You need to give the label an actual ID.
... ERROR CHECK
pStatic->SetFont (...);
pStatic->Invalidate ();
Better?
|
|
|
|
|
TolTol wrote:
CMyClass::SetFont( ) is wrong isn't it???
My dialog class is derived from CFormView class.
SetFont is the member of CWnd not CFormView, but CFormView is derived from CWnd so you can use SetFont for CFormView also.
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
|
I have a method OnBegindragUrlList() in my dialog class which implements the response to the LVN_BEGINDRAG message. I drag from a selected item in a control on my dialog onto Explorer. It maybe the desktop but it may also be an open folder. I want to know what folder my drag operation ends on so that I can then create a corresponding link. Nota that I do not want to copy or move a file and I don't want to create a link either as my file does not exist so I would get an error.
|
|
|
|
|
You need to implement IDataObject, IDropTarget, IDropSource etc to do that kinda of job, check out "drag drop" on code project just do a search on it... Micheal Dunn has written a good article on the same.
Programming is an art not a skill, every one can be a skilled programmer but not an artist.
|
|
|
|
|
I presume you mean you want to create an Internet Shortcut by dragging a URL from a list? If so, you don't have to worry about what folder is specified as your drop target. Just package your custom data up in an COleDataSource object and call the DoDragDrop() member function. To package the custom data up you will have to have an actual file that you intend to move or copy so you'll have to first create an Internet Shortcut (with a .url extension). It might sound a bit clumsy, but even if you can find the details on your drop target you would still have to create an Internet Shortcut.
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
I am using ODBC to connect to an ms access mdb file.
When trying to add a new recordset to an empty table, I get an error in CRecordSet::Update and the whole operation fails.
The code looks like this:
<br />
rs.Open(CRecordset::dynaset);<br />
rs.AddNew();<br />
rs.m_ent_id = 1;<br />
rs.m_ent_nom = "String data";<br />
rs.Update();
rs.Close();<br />
I think the reason for this is that when Update() is called and the new record is added, it then tries to return to the previously selected record, which in this case doesn't exist.
Apparently, others have come across this, as can be seen here.
Any suggestions?
Have no fear of perfection - You will never reach it
|
|
|
|
|
I've been fighting ODBC with Access tables for a couple of days, so I'm no expert. But look into the permissions on the target database. Using ADO for this in a webpage, the default is read-only; I have to specify a different access parameter in order to update the db. This same default behavior may be true using ODBC (I don't know that for certain, but I'm looking into it today).
[EDIT]
Never mind. The default for CRecordset is snapshot, which is fully editable.
[/EDIT]
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Salvador Dali wrote:
rs.Update(); // This is where the exception is thrown
And that exception is??
Salvador Dali wrote:
I think the reason for this is that when Update() is called and the new record is added, it then tries to return to the previously selected record, which in this case doesn't exist.
CRecordset is smart enough to know that a previous record does not exist. If you'll step through the code, you're apt to see exactly is happening.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
"Unhandled exception in MyApp.exe (MFC42D.DLL): 0xC0000005: Access violation"
The last functions in the call stack at that point are:
<br />
CTime::GetYear()
RFX_Date(...)<br />
CMyRecordset::DoFieldExchange(...)<br />
CRecordset::LoadFields()<br />
CRecordset::UpdateInsertDelete()<br />
CRecordset::Update()<br />
Have no fear of perfection - You will never reach it
|
|
|
|