|
Hint: way too much code here. Trim it down to something more manageable and ask a specific question. You'll get tons more help that way.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi
I am trying to print bmp/jpeg image from an mfc application, but the image size is very small.
Can someone tell me how to get the original size while printing?
Here is my code.
Thankyou.
BOOL CView::OnPreparePrinting ( CPrintInfo *info )
{
info -> SetMaxPage ( 1 ) ;
return DoPreparePrinting ( info ) ;
}
void CView::OnPrepareDC ( CDC *pDC, CPrintInfo* info )
{
CView::OnPrepareDC ( pDC, info ) ;
if ( pDC -> IsPrinting( ) )
int n = info -> m_nCurPage ;
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(10000,10000);
pDC->SetViewportExt(18000,18000);
pDC->SetViewportOrg(500,1000);
}
}
|
|
|
|
|
The document should have information on the bitmap, since it had to load it from a file, or create it outright.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
After creating a printer DC in your printing function calculate desired destination rectangle taking into account a size of paper:
CSize paper_res;
paper_res.cx = dcPrinter.GetDeviceCaps(HORZRES);
paper_res.cy = dcPrinter.GetDeviceCaps(VERTRES);
Try to set dcPrinter's map mode as MM_TEXT and to use dcPrinter.StrechBlt(...)
|
|
|
|
|
|
hello everybody,
I want to store strings in the format of lines in an edit box or an rich edit box.
I had done by using CString variable but it doesn't taking the '\n' escape sequence which displays the next part of the string in a new line.
any solutions,
please help.
Thanking you
Neelesh K J Jain.
|
|
|
|
|
You need to use \r\n instead of \n
|
|
|
|
|
In addition to niall's response, you also need to make szure the control has the ES_MULTILINE style.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all,
Im having real trouble trying to get consistent output in print preview. I am drawing a page of text and by varrying the zoom state, the text height differs by a few pixels for any given line. I know why this is occuring because the CPreviewDC->MirrorFont() function does some odd things with the fonts in order to display them. I havent got a clue how to get around this, any help would be greatly appreciated.
Cheers,
Andy.
|
|
|
|
|
Hi,
I want to develop an application in VC++ which should work on Windows and Mac.
How do i go ahead, pls guide me out in this aspect.
Thanks a zillion for your help.
Cheers
Pawan
|
|
|
|
|
The Mac cross compiler version of VC++ is long gone, so you won't be able to use VC++ for the Mac version. Have a look at wxWindows.
|
|
|
|
|
I have installed Visual Studio .NET on my PC and now I want to install it on my new one instead. Unfortunately, my disks are in the server room on another site and I can not get to them. Can anyone tell me how to get the license key from Visual Studio? My disks are available on a server which I can connect to of course, but I can not get to the physical disks which have the key!
|
|
|
|
|
I believe that you can get the key from the Help->About menu from the first installation.
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
I looked at that, but there are not enough numbers - and they are in the wrong format:
20 numbers:
nnnnn-nnn-nnnnnnn-nnnnn
I believe it should be in this format:
25 numbers/letters
nnnnn-nnnnn-nnnnn-nnnnn-nnnnn
|
|
|
|
|
I found out that a bitmap containing alpha channel can be specified to a layered window in order to obtain a special defined map alpha, not just a general level of transparence.
This is done by using the UpdateLayeredWindow function.
This is all fine, but I still have some problems:
Since I provide the look for the window throught my bitmap, the window will look just like that! This means that any controls that I have on my frame are not drawed anymore. I also can't use this stuf for children controls (windows).
One solution I think of, is to draw all the children myself over the bitmap I use to set the window look. But what can I do with other controls that I don't want to draw myself (think of an Internet browser control - I can't draw that). Maybe is a way to force windows to draw on a specified hdc ?
If anyone can help, cause I really think it's a great feathure that I can't fully use !
Alex
xelanoimis@yahoo.com
|
|
|
|
|
Hi all,
I am getting problem while using this CRichEditCtrl::SetParaFormat .
I am writing what I am getting.
Step1- I have changed the para formatting by using this code
PARAFORMAT pf;<br />
pf.cbSize = sizeof(PARAFORMAT);<br />
pf.dwMask = PFM_ALIGNMENT;<br />
pf.wAlignment = PFA_LEFT;<br />
m_RE_Output.SetParaFormat(pf);
Step2- Then I have changed the para formatting by using this code
PARAFORMAT pf;<br />
pf.cbSize = sizeof(PARAFORMAT);<br />
pf.dwMask = PFM_ALIGNMENT;<br />
pf.wAlignment = PFA_RIGHT;<br />
m_RE_Output.SetParaFormat(pf);
in step2 the above performating goes out, I mean as soon as the step2 code being executed the above code also changes to the right side.
Please tell me, anything which i am missing, I mean any message I have to post to the RichEdit class to inform it that I have changed the para format.
I am very thankfull.
The Phantom.
|
|
|
|
|
Phantom,
When you do the second SetParaFormat, are you on a different paragraph? Each paragraph is seperated by a "\r\n".
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
Hello all
Is there anyway to read the office documents like reading a text files?
for eg, we use ifstream to access the text file.
I want to change the autodate ( for example, in word, if you want to insert the date that will change automatically every time you reopen the doc, you go to insert menu and click date and time to insert the date and time. ) in the docs
I want to replace every autodate with the const string like " THIS IS AUTO DATE"
Anyone ??? please
|
|
|
|
|
Hi,
I'm writing a small program with a basic text editor incorporated. It is basically a dialog box with a rich edit box and the capability of saving what is written in the rich edit box to a .txt file. Here is the function I am using to save the text (I'm using _no_ MFC, by the way):
[code]
void SaveRichEditText(HWND hWnd, int nIDDlgItem, char* szSaveFile)
{
char szText[100000]="";
GetDlgItemText(hWnd,nIDDlgItem,szText,100000);
HANDLE hFile = CreateFile(szSaveFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
DWORD dwW;
WriteFile(hFile,szText,strlen(szText),&dwW,NULL);
CloseHandle(hFile);
}
[/code]
This works fine, and the file is saved with the correct text.
However, as you can easily see from the code, this has a severe restriction: the text that can be saved is limited to 100,000 characters (or any other arbitrary limit I choose for char szText[]).
This is no doubt a very stupid and basic question, but I can't find the answer in my Sams or "C for Dummies" or other books, so please forgive the lack of knowledge of a relative novice:
How do I make it so that the text length is not limited by the char? Is there a way to get the length of the text in the Rich Edit box and then create a string on the fly that is the length of this? I am sure I have seen somewhere a method using mem... commands, but can't find the answer.
Once this is solved, I would then need to create a load command that reads the text from file using ReadFile(), and I will be faced with a similar problem - namely getting the length of the string from the .txt file and creating that string to insert into my rich edit box.
If anyone can tell me how to go about solving these two problems, I would be really grateful - apologies again if this is a really basic question.
Many thanks,
KB
|
|
|
|
|
try this:
void SaveRichEditText(HWND hWnd, int nIDDlgItem, char* szSaveFile)
{
// Counters
uint nCount = 0;
uint nNewCount = 0;
BOOL bRet = FALSE;
char* szText = new char[100000];
// Get the initial count returned
nNewCount = GetDlgItemText(hWnd,nIDDlgItem,szText,100000);
// Keep getting the count until it returns 0
while( nNewCount > 0 )
{
nCount += nNewCount;
nNewCount = GetDlgItemText(hWnd,nIDDlgItem,szText,100000);
}
// If there is nothing to save return or insert code to create the file and return.
if( 0 == nCount )
{
return;
}
// Delete the array.
delete[] szText;
// Create the array the necessary size (nCount + 1(NULL) )
szText = new char[++nCount];
// Get all of the data.
GetDlgItemText(hWnd,nIDDlgItem,szText,nCount);
// Create the file
HANDLE hFile = CreateFile(szSaveFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
DWORD dwW;
// Save the data.
bRet = WriteFile(hFile,szText,nCount,&dwW,NULL);
// Close the file
CloseHandle(hFile);
// Check for write error
if( TRUE != bRet )
{
// Handle Error
}
}
Its probably not the cleanest way of doing things, but it is never the less a way. Hope it helps.
|
|
|
|
|
I'll suggest you to use RichEdit messages,
EM_GETTEXTLENGTHEX to get length of text and create bufer. and EM_GETTEXTEX to get text and fill buffer
|
|
|
|
|
Great, thanks for the info, and thanks for the replies to both of you.
In the end I went the EM_GETTEXTLENGTHEX route and used that to create the buffer, though I had problems before realising that I needed to load RichEd20.dll instead of RichEd32.dll, and then, because I was using a dialog-based app, I had to manually change the class name in the .rc file to "RICHEDIT20A" instead of "RICHEDIT" (just in case anyone else encounters this problem).
Thanks again!
KB
|
|
|
|
|
You need to look for TVN_xxx notification messages.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
If your checkboxes are images then I think following code can help you
1) go to classwizard -> add the NM_CLICK message function to your treecontrol
<br />
<br />
OnClickSmptree(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
*pResult = 0;<br />
CPoint pt;<br />
::GetCursorPos(&pt); <br />
m_TreeCtrl.ScreenToClient(&pt);<br />
<br />
UINT nFlags;<br />
HTREEITEM hItem = m_TreeCtrl.HitTest(pt,&nFlags);<br />
<br />
if((nFlags &= TVHT_ONITEMSTATEICON))<br />
{<br />
<br />
}<br />
|
|
|
|
|
Can anybody tell me the meaning of: #define WM_GRAPHNOTIFY WM_USER+13.
Here WM_GRAPHNOTIFY is window message used in DirectX. But how this WM_USER + 13 value is set.
Even at one code, I have seen: #define WM_GRAPHNOTIFY WM_APP + 1.
Pls explain what is the purpose of these statements.
|
|
|
|