|
Debug information can be generated by the compiler when it compiles your program. Generally it takes the form of a .PDB file. This debug information contains, amongst other things, a mapping from addresses in the compiled executable to the source file and line number of the corresponding source. The debugger uses this information. You can too via the dbghelp.dll functions. You can also get this mapping information in the form of a .MAP file although .MAP files only contain a small subset of the information in a .PDB file.
Steve
|
|
|
|
|
When you load a ".doc" using this:
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof (SHELLEXECUTEINFO);
sei.lpVerb = "open";
sei.lpFile = "RD Bennett13.doc ";
sei.nShow = SW_SHOW;
sei.hInstApp = NULL;
sei.lpDirectory = "C:\\BASIC\\Maps\\";
sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS;
sei.lpParameters = NULL;
ShellExecuteEx (&sei);
This loads the "doc" with MS WinWord. but I can't make it close PROGRAMMATICALLY!
How do I close MS WinWord.exe after the user reads and moves on to another function in my program not involving MS WinWord.exe?
I tried using:
STARTUPINFO si = {0};
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
BOOL bOk = CreateProcess(
"C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe", // LPCTSTR lpApplicationName
NULL, // LPTSTR lpCommandLine,
NULL, // LPSECURITY_ATTRIBUTES lpProcessAttributes,
NULL, // LPSECURITY_ATTRIBUTES lpThreadAttributes,
FALSE, // BOOL bInheritHandles
0, // DWORD dwCreationFlags
NULL, // LPVOID lpEnvironment
NULL, // LPCTSTR lpCurrentDirectory
&si, // LPSTARTUPINFO lpStartupInfo
&pi // LPPROCESS_INFORMATION lpProcessInformation
);
if ( bOk )
{
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
Of course this doesn't load the particular "doc" I want loaded and it doesn't close the file or MS WinWord.exe either.
How do I close MS WinWord.exe from within my program?
C++ is my favorite programming language
|
|
|
|
|
To have better control over Word, you should use Automation to open and close it. Office comes with help for all the VBA/Automation functions (although it might not be installed by default) so give that a look.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I have no idea what you are talking about. I did a FULL install of Word. I need programming examples. Again, I can load the document in Word; but I need to be able to CLOSE Word when the User is further into my program. How do I close Word PROGRAMMATTICALLY!. Example Please!
C++ is my favorite programming language
|
|
|
|
|
First of all, STOP SHOUTING. It's rude, and guaranteed to reduce interest in answering your questions to zero.
Second, Mike told you what you need to know. Word supports an Automation model that exposes its functionality via a group of COM objects and interfaces. Try looking it up in the MSDN, using keywords like "Office" and "Automation".
Software Zen: delete this;
|
|
|
|
|
Why don't you try 'ShellExecute'/ShellExecuteEx' APIs
-Malli...!
|
|
|
|
|
Please explain what you mean by an example. The reasoning of using Woord is that during my program's usage the User may want to see a drawing or a description for the part the User is doing. Since I have a database comprising of Word documents it's natural to use Word. However, it would be wrong for the Word or even the document to remain on the screen after the User is further into the program. I need to be able to automatically CLOSE word once the User has no other need for it in the program. I've shown you the code for bring Word up; please show me some code for closing Word AUTOMATICALLY in my program WITHOUT User influence!.
C++ is my favorite programming language
|
|
|
|
|
Could you explain with an example? I've used SHELLEXECUTE to "open" the ".doc" in Word; but my problem is I cannot close Word PROGRAMATTICALLY. I need to close Word before alowing the User to go further in my programs implementation. Could you show me a example of closing the process(Word)?
C++ is my favorite programming language
|
|
|
|
|
MouseKeys is an application in Accessibility Options which help us control mouse by Keyboard. I wonder how MS program that application ? It is different from AutoIt, which could help us write macro in Windows. AutoIt Macro doesnt work in many launched program, especially games, but MouseKeys does. It simulate Mouse really. Who knows this technique, share me plz. Tnx all.
|
|
|
|
|
Hello Guys,
I've an old Win32 application, which is written in C. The problem is that for some reason, we need to convert it to MFC.
I'd prefer is a separate application that can swallow and show instances of Win32-App and provide the interface. Is it possible?
I'd love to know.
Umer Mansoor
|
|
|
|
|
Did u mean u want to run another application from the old one?
If so the functions like ShellExecute() and CreateProcess() will help u.
nave
|
|
|
|
|
Nave,
Thanks for replying. Let me clarify:
We've a Win32 application with source code. I want to create a new MFC application. Now I want to run Win32-app in way that it only appears in my MFC application (not on taskbar, not on desktop) but *inside* my MFC application. [That is the MFC-app becomes the parent of the Win32-app]
This will allow me to keep the Win32-app intact, while the outer-frame will be in MFC, which offcourse, I'll customize way more easily than Win32.
ShellExecute() I think won't help as it still create a new instance on the desktop. I can still pass the handle to my MFC application but that will only relay messages to my MFC app.
Umer Mansoor
|
|
|
|
|
I know converting Win32-app to ActiveX looks like a good idea. I'm here to explore other options.
Umer Mansoor
|
|
|
|
|
For your 'ShellExecute()' will work. If you don't wanna to display the process(on desktop/taskbar), just put last parameter of the fuction as 'SW_HIDE'(0).
Well ! Try it...
-Malli...!
|
|
|
|
|
didn't work!!! i want to show it, not hide it, but INSIDE my APP
Umer Mansoor
|
|
|
|
|
which key work to google for dll work principle? give me some key work I can get idea.
|
|
|
|
|
|
It's clear how to set right and left margins in an instance of CEditView. Is there a way to effectively set a top margin?
--hsm
|
|
|
|
|
In the PARAFORMAT2 Structure there is a member called dySpaceBefore. You will need to build a function to call this member using the dwMask member. The value must always be > than or = 0. The Size of the spacing is in twips. You may be able to set up something similar in the PARAFORMAT structure if you are using later versions of Visual C++. Go to MDN.COM and do a search for PARAFORMAT OR PARAFORMAT2. I think there is an example there somewhere..??
regards,
RRL
|
|
|
|
|
sorry. I ment msdn.com not mdn.com also, if you ar running v.s. 6.0 PARAFORMAT may be the structure to use...
RRL
|
|
|
|
|
Much thanks, I'll take a look.
--hsm
|
|
|
|
|
I just looked. Two problems occur to me; first, this is for a CRichEditView, not a CEditView. The other problem is that this would allow control of the space above a paragraph--- not the space above the page. Perhaps I'm missing something?
--hsm
|
|
|
|
|
For those with the same problem, a tentative answer is to set the rectangle in the CEdit control:
void CPGNTextView::SetTopMargin()<br />
{<br />
CEdit &theEdit = GetEditCtrl();<br />
CRect r;<br />
theEdit.GetRect(&r);<br />
TRACE("t=%d l=%d b=%d r=%d\n",r.top,r.left,r.bottom,r.right);<br />
r.top = TOP_MARGIN;<br />
theEdit.SetRect(&r);<br />
TRACE("t=%d l=%d b=%d r=%d\n",r.top,r.left,r.bottom,r.right);<br />
}
And then to do it again in WM_SIZE and WM_SETFONT handlers. Seems like overkill, but the CEdit control loses this information every chance it gets so you just have to help it along so to speak.
--hsm
|
|
|
|
|
Is there a way I can do something like this:
<br />
class MyClass<br />
{<br />
...<br />
private:<br />
class MyInnerClass: public CWnd<br />
{<br />
...<br />
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);<br />
...<br />
};<br />
...<br />
};<br />
??
I've been trying for a while, and the code doesn't even compile (if I declare the class outside the first one, everything works OK, but I want the class to be inner). I suspect it's a matter of names for the message maps, but can't figure out the right one...
Thanks!
Alberto.
|
|
|
|
|
Why do you feel the inner class is necessary?
I would probably have done this instead:
class MyInnerClass: public CWnd<br />
{<br />
...<br />
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);<br />
...<br />
};<br />
<br />
class MyClass<br />
{<br />
...<br />
private:<br />
MyInnerClass* m_InnerClass;<br />
...<br />
};
And avoid the entire problem.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|