|
As anyone heard of a problem where in Windows 2000 when drawing to an offscreen the TextOut would be clipped, but not anything else (lines, bitmaps, rectangles, circles, etc.).
My program creates a course map for dog trainers where they can place symbols, lines, and text to describe the various excercises they are doing. When they go to print the course map is always scaled to fit on one page. To do this I take the drawing surface (which may or not be larger than the screen) convert it to a DIB and use StretchDIBits to get the scaling right. The problem is that the text (and only the text) is getting clipped on the right side (from what my user is reporting is like I am clipping at the window rect, not the entire drawing area, but I am not sure she understands what I am asking). The same problem occurs when the user saves the course as a bitmap file, or places the course on the clipboard and the text is clipped in the same place for all three instances. The problem has to be in my CreateCompatibleBitmap in my rect size, but I never change it.
I have not seen this problem on any of my machines, XP, 98, and 2000. I have scrounged around town and tested on three other 2000 machines and not seen the problem. No one else as reported the problem (about 200 users and counting) I can not seem to duplicate the problem. Part of me says it is one person and not to worry, but...where's theres one. there is bound to more.
Any suggestions?
|
|
|
|
|
Try to scale the problem down to a much smaller one. Create just enough of an application that demonstrates the problem and go from there.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have problem to read long strings from windows registry.
I have no problems with writing...
my code>
char m_sPiasPath[MAX_PATH];
char m_sIniPath[1024];
CRegKey cRegKey;
if(ERROR_SUCCESS!=cRegKey.Create(HKEY_CURRENT_USER,"Software\\psm",REG_NONE,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,0,0 ))
{
MessageBox(0,"Can't create register key","PSM",MB_ICONWARNING);
}
else
{
if(ERROR_SUCCESS!=cRegKey.QueryValue(m_sPiasPath,"pias",&dwData))
{
// find pias.exe
CFileFind cFileFind;
if(cFileFind.FindFile("pias.exe"))
{
cFileFind.FindNextFile();
strcpy(m_sPiasPath,cFileFind.GetFilePath());
if(ERROR_SUCCESS!=RegSetValueEx((HKEY)cRegKey,"pias",0,REG_SZ,(BYTE*)((LPCTSTR)cFileFind.GetFilePath()),
cFileFind.GetFilePath().GetLength()));
}
else
MessageBox(0,"Can't find \"pias.exe\". Try run it manual.","PSM",MB_ICONWARNING);
}
// psm.ini
if(ERROR_SUCCESS!=cRegKey.QueryValue(m_sIniPath,"psm_p",&dwData))
{
if(::AfxMessageBox("Can't read path for \"psm.ini\" from windows registry.\nDo you want to select it?",
MB_ICONQUESTION|MB_YESNO)==IDYES)
{
CSelectPathDlg dlg;
dlg.DoModal();
strcpy(m_sIniPath,dlg.m_sFolder);
if(strlen(m_sIniPath))
{
if(ERROR_SUCCESS!=RegSetValueEx((HKEY)cRegKey,"psm_p",0,REG_SZ,(BYTE*)m_sIniPath,
strlen(m_sIniPath)))
{
::AfxMessageBox("Can't create registry key.",MB_ICONWARNING);
}
}
}
}
}
cRegKey.Close();
Thanks for help...
R.
|
|
|
|
|
rudoq32 wrote:
I have problem to read long strings from windows registry.
And what would that problem be? Have you single-stepped through the code, especially the call to QueryValue() , to see what is happening? Do the variables (e.g., m_sPiasPath , dwData , m_sIniPath ) hold the expected values?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I get these all the time...
CONCEPT MALFUNCTION: IN/OUT Pointer means you must SET the value before calling function and it MIGHT be assigned a different value upon return.
BE aware of discussion like this in MSDN about the arguments to a function:
pdwCount
The size of the string data. Its value is initially set to the size of the szValue buffer.
You are lucky this works at all, because unless I missed something, you never set the value of dwData prior to either of your calls to QueryValue , and you SHOULD set it to something like sizeof(m_sPiasPath)
Try this instead:
dwData = sizeof(m_sPiasPath);<br />
if(ERROR_SUCCESS!=cRegKey.QueryValue(m_sPiasPath,"pias",&dwData))
and
dwData = sizeof(m_sIniPath);<br />
if(ERROR_SUCCESS!=cRegKey.QueryValue(m_sIniPath,"psm_p",&dwData))
These changes might cpmpletely fix your problem.
|
|
|
|
|
In addition to what Blake Miller said, you also need to use the pdwCount value returned, to determine the actual length of the string. The reason for this is that you can not depend on the string returned to be null terminated. Some of the query functions do not return a null terminated string and others that are supposed to do not do so on all Windows OSs. One way to work around this problem is to initialize the receive buffer (szValue) to all 0's and call the query funtion specifing a dwCount that is slightly smaller than the actual buffer size.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
please help me..
I've develop something.
First I made a txt file that contains just some word "Hello, Bye, etc.." and then load it on the IE.
Second check the text on the IE, and then compare the text with some pattern like "Hello".
Third I add some html cord. The function of cord would change background color of the text "Hello" and hand cursor shape, if the pattern is same.
OK. Now I want to add some more function.
1. If I click the text that was already changed background color, and some more things,
('couse same with some pattern like "Hello")
then I want to make pop up my Dialog box(modal) on the IE. The box name is IDD_POPUP.
2. Next, the IDD_POPUP has a static text. I want to show the "Hello" on the static box of IDD_POPUP.
That's all.. plz help me~
------------------------------------------------------------------------------------------------
void CABC::RegexHighlight(CComPtr<ihtmldocument2> spHTML)
///reference - http://www.codeproject.com/miscctrl/chtmlview_search.asp
{
static IRegExpPtr regExp( __uuidof(RegExp) );
static IRegExpPtr regExp_1( __uuidof(RegExp) );
LPCTSTR lpszPattern = " Hello /*some pattern*/ ";
regExp->Pattern = lpszPattern;
regExp->put_Global(VARIANT_TRUE);
IMatchCollectionPtr matches;
IMatchPtr match, tempMatch;
long m_cnt;
int i;
long startPoint, strLength;
IHTMLElement *lpBodyElm;
IHTMLBodyElement *lpBody;
IHTMLTxtRange *lpTxtRange;
bool bFound;
spHTML->get_body(&lpBodyElm);
lpBodyElm->QueryInterface(IID_IHTMLBodyElement,(void**)&lpBody);
lpBody->createTextRange(&lpTxtRange);
CString cstr;
BSTR bstr, tmpbstr;
BSTR bmark;
VARIANT_BOOL ret;
lpTxtRange->get_text(&bstr);
lpTxtRange->getBookmark(&bmark);
cstr = bstr;
matches = regExp->Execute(bstr);
m_cnt = matches->Count;
CString chkStr[1000];
long c_cnt = 0;
bool isChk = false;
for (i = 0; i < m_cnt; i++) {
match = matches->Item[i];
startPoint = match->FirstIndex;
strLength = match->Length;
match->get_Value(&tmpbstr);
CString searchText = tmpbstr;
CComBSTR html;
CComBSTR newhtml;
CComBSTR search(searchText.GetLength()+1,(LPCTSTR)searchText);
while(lpTxtRange->findText(search,0,2,(VARIANT_BOOL*)&bFound),bFound) //lFlags = 2 or 0
{
newhtml.Empty();
lpTxtRange->get_htmlText(&html);
//change the background color, etc..
newhtml.Append(" <span id='regexnum' style='color: Black; background-color: yellow'><font style='cursor:hand'>");
newhtml.AppendBSTR(html);
newhtml.Append("dssd");
lpTxtRange->pasteHTML(newhtml);
}
lpTxtRange->moveToBookmark(bmark, &ret);
}
}
|
|
|
|
|
Hi
How do we insert an image or an icon in a dialog?
/\|-||\/|/\|)
|
|
|
|
|
Just add a picture control to the dialog's template. Change it's type to either Icon or Bitmap. In the Image: combobox, select the id of the image (it must already exist) you want.
If you'll create a temporary dialog-based project that has an About box, you'll see how the icon on the About dialog template looks.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
Just add a picture control to the dialog's template. Change it's type to either Icon or Bitmap.
how do i do that by code?
/\|-||\/|/\|)
|
|
|
|
|
Click on the Picture Control icon in the Toolbox window and then click in the dialog's template where you want the control placed. It's just like adding any other control (e.g., button, listbox).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can i do that by code
/\|-||\/|/\|)
|
|
|
|
|
Exactly what do you mean "by code?" What I showed you will modify your project's .RC file, which is code your project needs in order to run.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i mean i nedd to create this image dynamically at run time so i need to write physically the code not using the rc interface
/\|-||\/|/\|)
|
|
|
|
|
Check out:
CBitmapButton
CButton::SetIcon()
CButton::SetBitmap()
CStatic::SetIcon()
CStatic::SetBitmap()
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok thx i have just discovered how using setbitmap
/\|-||\/|/\|)
|
|
|
|
|
hi again
Ok i need now to move the picture i have created in runtime how do i do that?
/\|-||\/|/\|)
|
|
|
|
|
How about MoveWindow() or SetWindowPos() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I can't use them with my image i have tried
how can i associate ID_image to be able to move it
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
I can't use them with my image i have tried
But since you have not shown what code you tried with, how can I determine if you did it correctly or not?
Halawlaws wrote:
how can i associate ID_image to be able to move it
Based on what little I know of your problem, I'd start with GetDlgItem() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i cant use them
i dont have a class or a struct to call them all i have is the id of the image:ID_IMAGE
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
i dont have a class or a struct to call them...
What does having a class or struct have to do with being able to use MoveWindow() or SetWindowPos() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
What does having a class or struct have to do with being able to use MoveWindow() or SetWindowPos()?
If u dont have a class and u use MoveWindow() the only thing that will move is the dialog u must specify that u want the image.
how do u do that?
/\|-||\/|/\|)
|
|
|
|
|
Perhaps you are confused as to what MoveWindow() does. It changes the position and dimensions of the specified window, whether that window is a dialog, control, or a frame. If the window in which you are wanting to move has child windows (e.g., dialog having controls), all of them are moved too.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi guys,
Can anybody give me a explicit explanation about what is a HWND(handle to a window) , what does it differ from a CWnd object ?? Please provide examples if you can.
I've searched in MSDN but could not get enough information
Regards ,
Nick
|
|
|
|
|