Click here to Skip to main content
15,887,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I export a Dialog class in MFC regular Dll or Extension Dll? Pin
guiguizk26-Jul-05 20:47
guiguizk26-Jul-05 20:47 
Questionhow can i transprant a child dialog's background? Pin
SamSmithCn26-Jul-05 17:35
SamSmithCn26-Jul-05 17:35 
AnswerRe: how can i transprant a child dialog's background? Pin
mark novak27-Jul-05 0:33
mark novak27-Jul-05 0:33 
GeneralPath Name Pin
Veera Raghavendra26-Jul-05 17:23
Veera Raghavendra26-Jul-05 17:23 
GeneralRe: Path Name Pin
Bob Stanneveld26-Jul-05 23:14
Bob Stanneveld26-Jul-05 23:14 
GeneralRe: Path Name Pin
Veera Raghavendra26-Jul-05 23:16
Veera Raghavendra26-Jul-05 23:16 
GeneralRe: Path Name Pin
David Crow27-Jul-05 3:09
David Crow27-Jul-05 3:09 
GeneralRe: Path Name Pin
Toby Opferman27-Jul-05 14:28
Toby Opferman27-Jul-05 14:28 
It is actually harder than just that.

A filter driver on the file system(s) will allow you to capture open/close/read/write, etc. so you would be able to find out the LAST file that notepad had opened or created. The problem is that notepad does not hold the file handle open, it closes it after is reads it or saves the file. So, you would need to keep a list of PID's and "last opened" files. Of course, you would need to differentiate the file opened for "putting in notepad's window" verse opening some configuration file by some system component.

Even so, if you could solve that you would then need to clean the list of PID's so you don't keep growing them indefinately. This could again be solved by registering for process creation and destruction.

The final problem is that since notepad doesn't keep the file open, you can actually just select "New" and create a new untiled file without doing any disk access at all. So infact, notepad wouldn't have the file you previously opened in it anymore.

Now, here's a secret. There is a global variable in notepad called "notepad!szFileName". This is the file name that was opened. You would then just need to get notepad's current directory (Hopefully hasn't changed since the file was opened) and then relate it to reading this global variable from notepad's memory. If this global says "Untitled" then it's a new file.

So, how do you find the offset to this? Well you could simply hard code the offset based on a particular version of notepad, but the Microsoft symbol server has the symbols. So you could write a client that could then talk to the symbol server and request the PBD symbol file for that version of notepad, then read the offset into the file where it is and read the file name.

Alternatively, you could just "GetWindowText" and read the title bar of notepad. Of course this doesn't include the ".txt" extension if it's being used so "x.txt" and "x." look the same. Also, it includes no directory information so you're kind of stuck guessing where the file is on the system.

You could read the command line from the application, but then again you don't know if they've saved, closed the file and opened a new one. You could even hook "CreateFileW" in notepad, but you would never know if they used "new" and you also wouldn't tell the difference between when they are opening a file for editing or if some component is opening a file for settings or something else.



The moral of the story is that if you want to keep track of what file is being edited, why don't you just write your own editor.




8bc7c0ec02c0e404c0cc0680f7018827ebee
GeneralLockFileEx Pin
Anonymous26-Jul-05 16:48
Anonymous26-Jul-05 16:48 
GeneralEnumerating NICs Pin
franji126-Jul-05 16:46
franji126-Jul-05 16:46 
GeneralRe: Enumerating NICs Pin
Ted Ferenc26-Jul-05 21:49
Ted Ferenc26-Jul-05 21:49 
Generalnot whats needed Re: Enumerating NICs Pin
franji127-Jul-05 2:04
franji127-Jul-05 2:04 
GeneralFile transfer thru bluetooth USB Pin
cheewooi26-Jul-05 13:27
cheewooi26-Jul-05 13:27 
GeneralWinsock 2 10004 error code Pin
Kuniva26-Jul-05 12:32
Kuniva26-Jul-05 12:32 
GeneralDialog from Plugin & TabStop Pin
Andrei Kashcha26-Jul-05 12:08
Andrei Kashcha26-Jul-05 12:08 
GeneralRe: Dialog from Plugin & TabStop Pin
guiguizk26-Jul-05 18:45
guiguizk26-Jul-05 18:45 
GeneralRe: Dialog from Plugin & TabStop Pin
anvaka26-Jul-05 20:03
anvaka26-Jul-05 20:03 
GeneralRe: Dialog from Plugin & TabStop Pin
guiguizk26-Jul-05 20:45
guiguizk26-Jul-05 20:45 
QuestionWhat do you know about Mandatory Profiles? Pin
Ian Bowler26-Jul-05 11:43
Ian Bowler26-Jul-05 11:43 
GeneralWebBrowser control and the clicking sound Pin
Peter Weyzen26-Jul-05 11:10
Peter Weyzen26-Jul-05 11:10 
GeneralRe: WebBrowser control and the clicking sound Pin
David Crow26-Jul-05 11:22
David Crow26-Jul-05 11:22 
Generalnamespace and DLL issues Pin
Joris van der Pol26-Jul-05 8:25
Joris van der Pol26-Jul-05 8:25 
GeneralKeyboard Hook in MFC -- Minor Syntax Pin
c121hains26-Jul-05 7:06
c121hains26-Jul-05 7:06 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
David Crow26-Jul-05 8:04
David Crow26-Jul-05 8:04 
GeneralRe: Keyboard Hook in MFC -- Minor Syntax Pin
c121hains26-Jul-05 8:14
c121hains26-Jul-05 8:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.