|
What about converting to .pdf or .ps? I think there are some utilities to convert it in codeproject.
Another solution would be to generate an image. For that, i think you can create an image object of some kind, like CBitmap (or CMemDC??), and PAINT in to it, like you would do if it was a printer. Of course, if your doc has multiple pages, it will require multiple images. After that, you can save the data to a file.
|
|
|
|
|
i have another question.
i develop my application in the 1024*768,the formview has not scrollbar and all controls are shown.
when i change to 640*480 or 800*600, the scrollbar show.
how can make the scrollbar disappear and all controls shown?
|
|
|
|
|
The size at which a formview will begin to show the scrollbars is based on the dialog template size you set when creating that. If the viewable area is smaller, then the view will automatcially add the scrollbars.
As you do not want scrollbars, you will have to make use of the CScrollView::SetScaleToFitSize function to resize the dimensions of the form. You would normally do this in the OnSize() for your form view. There is only one problem with this in that you will have to change the size/positions of some/all controls on the form to position them in positions in which they will be visible in the new form size.
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|
|
One solution is to limit the size of the frame to a static minimum size. That way, you will not need scrollbars.
Kuphryn
|
|
|
|
|
Reasonable Developer
i wanted to download the SDK of Microsoft Project, i try my best but fail(it give overview of MS Project 2002) pls help me. So nice of u
|
|
|
|
|
Hi,
I've done a prog to shut down a computer after a period of time via InitiateSystemShutdown(). I got a problem in W2K -> windows shuts down and displays a messagebox: i it now safe to shut down the computer (or something like that). Is there any possibility to make w2k power down the system ? I got this problem only in w2k, w9x and xp works fine, nt4 not tested.
tia
-widi
|
|
|
|
|
I have been using this.. put this in one of you .h files..
BOOL MySystemShutdown()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return( FALSE );
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
if (GetLastError() != ERROR_SUCCESS)
return FALSE;
if (!ExitWindowsEx(EWX_POWEROFF | EWX_FORCE, 0))
return FALSE;
return TRUE;
}
Then make a call to the function in you app..
MySystemShutdown();
I've tested it in windows NT and 2k.. havent tried it in 9x..
|
|
|
|
|
thanks,
that's what I've been looking for.
-widi
|
|
|
|
|
Hi, I have an CEdit control which can be resized. The user can switch from a single line edit control to a multi line control if he decides so.
How do I detect the number of lines? I need to catch the switch from a single- to multi line and change some atributes.
Thanks
|
|
|
|
|
Anonymous wrote:
How do I detect the number of lines?
GetLineCount() is a member of CEdit
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
ohh
tack rickard
|
|
|
|
|
ah no, GetLineCount() retreives the lines currently in the control, not the number of lines a edit control can hold.
you know, i need to detect if an edit control after WM_SIZE is big enough to hold multiple lines.
|
|
|
|
|
Anonymous wrote:
not the number of lines a edit control can hold
Hm... Is that even possible?
Anonymous wrote:
not the number of lines a edit control can hold
Try set a varible to the maximum count of lines and then every key press in the edit control you check if there is too many lines and then do something!?
Sorry but can't help you anymore!
PS. Are you Swedish?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
well... I ment something like:
1 get inner client area (prolly client area - minus some pixels),
2 get font height and
3 calculate full visible lines
--
PS: nej, men jag pratar en lite, jag heter Måak
|
|
|
|
|
Anonymous wrote:
PS: nej, men jag pratar en lite, jag heter Måak
Be a member Moak!
BTW:
Ledsen, kan inte hjälpa dig!
(Sorry, can't help you)
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
UINT MyThreadProc( LPVOID pParam )
{
CMyDataStructure* pObject = (CMyDataStructure*)pParam;
// do something with 'pObject'
}
// inside a different function in the program
.
.
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObjectPointer);
In my application, the main structure is simply a Dialog window. I placed the Dialog's pointer in the pObject and call the AfxBeginThread(MyThreadProc, pNewObject), however it always give me out run-time error when the Thread come to this line 'MyDialogPointer->UpdateData(false)'.
However if I replaced the line 'AfxBegnThread(MyThreadProc, pNewObject)' with MyThreadProc(pNewObjectPointer), no error come out.
Can anybody help me figure out what is the reason for it? And what should I do to sucessfully Perform UpdateData() of the Dialog by using Thread?
|
|
|
|
|
Sstar wrote:
I placed the Dialog's pointer in the pObject
That pointer should be allocated on the heap. Is your dialog staticly declared in the main thread?
rechi
|
|
|
|
|
Bogdan Rechi wrote:
That pointer should be allocated on the heap
Why?
He allocate memory in a function and then pass the address to that memory in AfxBeginThread (parameter to the thread func). In the thread function he create a new pointer (not on the heap) which will be assigned to the address that argument points to!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
The pointer arriving in the thread function is correct. But the structure it points to has a pointer member (probably a CDialog * ) which is not allocated on the heap! That one is the pain, and it doesn't appear in his posting.
rechi
|
|
|
|
|
Each thread has its own message map. As a result, you can't pass MFC objects that refer to windows between threads. The best you can do is pass the window handle between threads.
Software Zen: delete this;
|
|
|
|
|
I want to change value of y axix
i have tried following code
for(int x = 1 ; x < 10; x++)
{
m_Chart.SetColumn(x);
CString str1;
str1.Format("%d",x);
m_Chart.SetColumnLabel(str1);
}
but it doesnt work can anybody help me? thanx in advance
bye chan
|
|
|
|
|
hello @all,
i have a mdi program. in the mainframe you have for example:
File -> Close
i would like to hide 'Close' to the users until the correct password entered.
enter password:
View -> Password
the 'Close' should not be gray or something like that. the user should not see that there is something like the 'Close', until he enter the right password.
i hope you can help me.
thank you very much
MFC
|
|
|
|
|
Off the top of my head, you could have a ON_COMMAND_UPDATE for the mdi child (which is where the
close command ends up) and use pCmdUI->SetText (m_bCanClose ? "Close" : "Password") to change the
text. You would also need a command handler to change the behaviour between password entry and the
normal closing.
For a "proper" app, you should load the menu strings from a resource rather than hardwired as above,
but you get the idea?
Iain.
|
|
|
|
|
thanks for reply.
i think i know what you mean, but i don´t know, how i should program it.
can you give me an example or explain it in more detail?
thank you very much
mfc
|
|
|
|
|
perhaps I misunderstood something, but the desired GUI design sounds wired.
|
|
|
|