|
I have written a program C++. I want to be able to give the user an option to print or print preview the putput or exe file. Are there any tutorials that explain how to create a page like this in MFC. I have a little idea but do not know how to enter my C++ code into the MFC template in order to create the complete program.
Thank You all for all of your assistance.
|
|
|
|
|
REPOST !
and i'm not sure you want to print "exe files"... do you know what is exe files ?
do you already opened a compiled file into a WYSIWYG editor (like notepad, ultraedit...) ???
TOXCCT >>> GEII power [VisualCalc][toxcct]
|
|
|
|
|
The exe file is what I get after I compile and build my program. I run it and out comes an exe file. The program perfroms exactly how I want it to. Now I want to be able to take my code and enter it into MFC so I will have a more functional program that give the user the option to print out the results. With the exe you can only view it. Of course they could maybe cut and paste but that is not to professional.
Thank You
|
|
|
|
|
so, you have an executable (A) that when run will extract/generate another executable (B) ?
and when you run B, you want it to be able to print what it displays ?
if so, you need to reprogram B to handle the print process.
Am I understanding corretly your situation ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
so what do you want to print ? binary datas ? source codes ? document files manipulated by your "exe" (program) ?
ps : MFC is not a functionality or anything like that. MFC means "Microsoft foundation classes". it is a framework that provides you a set of classes and functions to ease you windows programming?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
BRIMID wrote:
The exe file is what I get after I compile and build my program.
We all agree on this much. Hereinafter is where things get sketchy.
BRIMID wrote:
I run it and out comes an exe file.
This implies that your program produces another .EXE file. Yes?
BRIMID wrote:
The program perfroms exactly how I want it to.
What exactly does it do?
BRIMID wrote:
Now I want to be able to take my code and enter it into MFC so I will have a more functional program...
Are you saying that you want to base your program on MFC rather than the standard Win32 API?
BRIMID wrote:
...that give the user the option to print out the results.
The results of what?
BRIMID wrote:
With the exe you can only view it.
What is it viewing?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I will try to explain a liitle simpler.
I wrote a program to add 1+2=3
I Compile it, Build it, and then execute it. I have a exe file. Right?
Everytime I run the exe file is see 1++2=3. But the file does not have the option to print. I would like to be able to print out the results of the program i.e., 1+2=3.
|
|
|
|
|
So all you are really wanting to do is output the sum of 1 and 2 to the screen?
With C:
printf("%d\n", 1 + 2); With C++:
cout << 1 + 2 << endl; Does that help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I have that. I am able to display output to the screen using cout<<. I want to send the output on the screen to the printer.
|
|
|
|
|
Well, if you are running your program from a command prompt, just redirect its output to the printer like:
C:\> myprog.exe > prn
or
C:\> myprog.exe > lpt1
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Q1-does function CreateMapFile() create the file in MEMORY?
Q2-do we need to call DeleteFile() to clean the file from memory or somewhere before app exits?
includeh10
|
|
|
|
|
is CreateMapFile?
You have CreateFileMapping and OpenFileMapping which return a handle. Then use CloseHandle before your program exits.
No, you have to also follow the CreateFileMapping and OpenFileMapping with MapViewOfFileEx and then use UnmapViewOfFile
Sequence:
CreateFileMapping or OpenFileMapping
MapViewOfFileEx
Use the mapped memory
UnmapViewOfFile
CloseHandle
|
|
|
|
|
not really.
if doing
CreateFileMapping
......
CloseHandle
the file is still there because another app can open it.
i need to delete the file because i have to create thousands of maping files, i need to delete some files if they are useless.
CloseHandle does not delete mapping files - similar to normal files.
includeh10
|
|
|
|
|
MSDN To fully close a file mapping object, an application must unmap all mapped views of the file mapping object by calling UnmapViewOfFile, and close the file mapping object handle by calling CloseHandle. The order in which these functions are called does not matter. The call to UnmapViewOfFile is necessary because mapped views of a file mapping object maintain internal open handles to the object, and a file mapping object will not close until all open handles to it are closed.
So, if you unmap all the views and then close the handle, the memory map file will be gone.
If you want to delete the 'regular' file, then use DeleteFile().
Otherwise, you are getting something mixed up or I don't understand what you want to do.
There is no need to 'delete' a memory mapped file. It will happen on its own if the above guidelines are followed.
|
|
|
|
|
i need to pass a string from app A to app B.
app B is dialog based, app A knows HWND handle of app B.
i test by SendMessage or PostMessage from A to B, but the string can not be passed.
any idea?
thx
includeh10
|
|
|
|
|
includeh10 wrote:
i test by SendMessage or PostMessage...
I presume you used the WM_COPYDATA message. Yes? Otherwise, a code snippet would be especially helpful.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
no, i use in this way:
(in app A)
::SendMessage(hwndB,WM_USER+1,(int)(LPCSTR)csA,0);
//csA is object of CString
(in app B)
WindowProc(UINT msg,WPAREM w,LPARAM l)
{
switch(msg)
{
case WM_USER+1:
{
CString csB=(char*)w;
}
break;
............
but csB gets nothing - the reason i guess is that a string can not be passed to another app (app adress) in this way.
is WM_COPYDATA better?
any suggestion?
includeh10
|
|
|
|
|
includeh10 wrote:
is WM_COPYDATA better?
I'll let you be the judge of that:
http://tinyurl.com/62khl
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
it looks great.
i will test it.
thanks
includeh10
|
|
|
|
|
i tested it.
it is perfect!!!!
cheers
includeh10
|
|
|
|
|
additionally, there's another simple way to do it...
Convert the string to a global atom: GlobalAddAtom
ATOM GlobalAddAtom( LPCTSTR lpString );
this converts the string to a handle -- which you can transmit via Post/Send Message to any other process. Use GlobalGetAtomName() on the other end to convert it back.
It's a simple way to send small strings (255 chars or less).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Hello all,
I am using a CSplitterWnd. I would like to prevent the user from dragging
the splitter any closer than a certain distance from the edge of the window.
I found that CSplitterWnd::SetRowInfo() and CSplitterWnd::SetColInfo() allow
you to set a "minimum" size. However, it's not the case that the user can't
drag the splitter past this minimum. It's just that if he does so drag the
splitter, the window size will become 0.
Is there a way to do what I wish and pysically disallow the splitter to move
past a certain point?
Thanks,
Jitendra
|
|
|
|
|
I'm wrote a simple code to creates a empty Dialog. But I've an exception with him. Why?
DLGTEMPLATE dlg;
dlg.x = 0;
dlg.y = 0;
dlg.cx = 200;
dlg.cy = 200;
dlg.style = WS_BORDER|WS_CHILD|WS_VISIBLE;
dlg.dwExtendedStyle = 0;
dlg.cdit = 0;
CDialog Dialog;
Dialog.InitModalIndirect(&dlg);
DoModal();
Best regards,
Eugene Pustovoyt
ICQ UIN: 161325180
|
|
|
|
|
From MSDN: "To create a modal dialog box indirectly, first allocate a global block of memory and fill it with the dialog box template. Then call the empty CDialog constructor to construct the dialog-box object. Next, call InitModalIndirect to store your handle to the in-memory dialog-box template."
Here is the most IMPORTANT part:
"first allocate a global block of memory"
It does not matter which version of InitModalIndirect you call, the DLGTEMPLATE must be in a globaly allocated memory block. That means using GlobalAlloc(...).
If this is not the cause of exception, then the MSDN remarks section may be wrong.
The only question that remains is: who is responsible for freeing the memeory?
Search the MSDN for the sample code:
"DLGTEMPL: Creating Dialog Templates Dynamically"
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|