|
Thanks all, I have cleared some of my confused knowledge...
-
When in doubt, push a pawn!
-
|
|
|
|
|
I am using CScrollView to handle scrolling. The only thing I did so far with ScrollView is setscrollsize and that's it.
Why is that when I have long document open and I drag the scroll bar scrolling my scroll bar would jump right back to the to the top/begining as soon I release my mouse button? Mouse click jump to location, click on scroll arrows up and down, or mouse wheel they all scroll fine.
|
|
|
|
|
I test it out by shrinking the document. It seems to occur when the document goes over 1850 lines.
|
|
|
|
|
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>
|
|
|
|