|
Sounds like a tricky problem.
The first thing I would recommend is you have some code that loads in all the files you will need to be printing. You can store these in a vector of objects. The object needs to support a call that tells how much space it will need when it prints - this probably needs to be in lines or pixels (depends on what each object is). Once you have their sizes, you could write an algorithm that groups together those items which can be placed on the same page where possible (this also depends on the page size landscape/portrait etc)
Once you have them put together into page blocks you will be able to calculate the number of pages you will have to print and hopefully print them too.
As your algorithm for working out what goes on each page needs to be properly optimized. I would get the items just printing as a square block with an ID number inside. Then if you get preview up and running you can try tweaking the layout engine until it gives the best results.
As your question is just a general overview I can't really be more specific.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thanks Roger
I was thinking in something like this ( a lot of work!!!!) but I think that is the only way.
Best Regards
|
|
|
|
|
I have a CFormView based project that cleans out the system. For example, it deletes cookies, and temp files. When I run the program, the user can select checkboxes and click on a button to wash.
Is there any way to adjust the program so when the user clicks the .exe file, my program reads the command and does the wash automatically without opening the actual program?
|
|
|
|
|
azi_games wrote:
my program reads the command and does the wash automatically
Yes, this is easy and commonly done. You can store parameters for program in INI file, in Registry, or even read them for command line - see XGetopt for an example of reading command line.
azi_games wrote:
without opening the actual program
I do not understand what you mean. If the user clicks on a program, he expects to see something happen. If nothing happens, he will probably click again. After three or four times, he will probably think your progam doesn't work, and will delete it from system.
Of course, if this is really what you want to do, then there are ways to make a program invisible - e.g., on NT, make it a service. Or make your program's main window the child of an invisible window - it will not even show in the taskbar.
Best wishes,
Hans
|
|
|
|
|
I mean that the program does something without opening up the window.
I have found some information about this but it still is not clear to me.
BOOL CMyApp::InitInstance()
{
LPSTR lpszCmd=GetCommandLine();
// parse lpszCmd
if(command_line_keys_detected)
{
// do all your tasks here
return FALSE;
}
//
// original body of InitInstance
// goes here
//
}
I'm getting command_line_keys_detected error: undeclared identifier.
I don't know how this is supposed to be declared.
Thanks.
|
|
|
|
|
It's a variable. It needs to be declared just like any other.
|
|
|
|
|
Hi,
I have two CTime objects.
I need to determine how many days separate the two dates these objetcs represent.
How could I do this?
Thanks!
-- narada
|
|
|
|
|
Create a CTimeSpan var and initialize it with the difference between the two times. After that, use GetDays in the CTimeSpan object.
|
|
|
|
|
Yes, thanks a lot!
that's what I needed!
|
|
|
|
|
I've been doing some work with IShellFolder and related shell interfaces, working mostly with PIDLs. I did some tests, and saw that the DWORD cast of a PIDL was the same for particular folders. My gut tells me that these pointers are calculated using each folder's ID, token if you will. Does anyone who has more experience with these know for sure if they are persistent for each folder/file/virtual folder in the Namespace?
|
|
|
|
|
Hi there
I'm trying to refactor some old code, and in the process I'm introducing a dll, that's to be used from atleast 5 app's. The exe's has som objects with operations on them that i want to call. And I run into troubles. And I cannot figure out how to make a funktion call from an mfc extension dll to an exe.
Please hint me.
thanks
kenneth
app,dll,exe,call
|
|
|
|
|
How about passing the DLL a pointer to a static or global function from the main process?
Kuphryn
|
|
|
|
|
well, i'm just not happy with globals, but it might be the only way.
I was hoping on something like an COM emulated solution, through interfaces or
just through instances.
k
|
|
|
|
|
Just wondering if you are are exporting the function/methods (and or the objects) from the .exe.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hello,
I am new to MFC, please bear with me.
Within MainFrm.cpp, I have a function that is mapped as
ON_COMMAND(ID_STARTUP, DoStartupFunctions)
Now, I want to execute this before user can do anything else. Can you guide me on this ? Thanks.
Robert
|
|
|
|
|
Go to class wizard ( CTRL + W) and map a function to the message WM_INIT
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Depending on what things you want to happen initially, you may need to put code in several classes, not just CMainFrame.
|
|
|
|
|
Normally the applications get initialized in the OnInitInstance handler.
Well after having said that, think always in the OOP and initialize class members inside it's own owner class (this will make your life easier).
And after having said this and going where you need to go..., I think there's a handler for OnInitialUpdate (If you want to initialize things after the view is created) OnCreate (if you want to initialize things while the view is created). Take a look at the class wizard as other CPian advice's you Ctrl+W and choose the best handler for your pourpose.
Hope this helps...
|
|
|
|
|
In your app's InitInstance() method, right after you create the mainframe window, do:
pMainFrameWnd->PostMessage (WM_COMMAND, ID_STARTUP);
This will cause the DoStartupFunctions() handler to be called before the user is permitted to interact with the app.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thank you, all. I got it. Wished I had asked before
Robert
|
|
|
|
|
Hi,
I'm looking for an Edit box where i can set the font size something bigger. Do somebody know such of control??
Thanks,
Willem
|
|
|
|
|
Yes, the Edit control is what you want. Just select a different font into its DC.
|
|
|
|
|
DavidCrow wrote:
Yes, the Edit control is what you want. Just select a different font into its DC.
okay, but how can i do that?
thank you!
|
|
|
|
|
Use SetFont() , which is a method of the base CWnd class. See the documentation of CFont before using this function.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
By using SetFont():
BOOL CMyDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
<br />
m_font.CreateStockObject(SYSTEM_FIXED_FONT);<br />
m_edit1.SetFont(&m_font);<br />
<br />
return TRUE;<br />
}
|
|
|
|