|
I don't know if the mouse gets included in a screen grab. AFAIK to grab the screen (desktop) you use GetDC(NULL). To get the mouse pointer you could fake it by getting the mouse position and then drawing a pointer on the screen grab bitmap at the right point.
If there is a better way I would be interested to know.
|
|
|
|
|
|
I have been working on a plugin for IE that will look for specific data in html pages and modify its presentation. I have the code to get the source, change the source and finally stream it back into the web browser, but I have come accross a problem that I never expected.
When I use IStream to stream the modified data back into the web browser, it no longer associates the html file with the originating web site. So if the web page that I changed had a relative link to a css file with the address of /css/format.css, I end up with a webpage that looks for the file locally (maybe even not at all) rather than the remote directory as was intended. It ends up trying to look for the file locally instead of the web server. Below is an example of the relative address issue.
<!-- InstanceBegin template="/Templates/inside-template.dwt" codeOutsideHTMLIsLocked="false" -->
Is there a way, without further modifying the page, to make the new data reference the server just like the original page did. I don't want to modify the page more because that would entail having to modify other files as well. (i.e., The *.dwt file listed above also has relative links in it as well.)
I have tried searching for ways to do this, but I am not even sure where to begin as I am not even sure what to call the problem. It is as if I need to tell internet explorer what the base address is for the streamed data that is being displayed.
Please let me know if you have any ideas or creative ways to avoid the problem altogether.
|
|
|
|
|
I have a series of small bitmaps I need to print. The bitmaps are approx. 20 pixels wide and 15 pixels high. I would like them to print on the printer at about 1/4" or so high and 3/4" wide. I figured I could use the StretchBlt call to do this. I am using the following code:
// nTxtHt holds the height of a line of text to be printed
CBitmap bmp;
bmp.LoadBitmap (nBmpID);
BITMAP bm;
bmp.GetBitmap (&bm);
int nWd = bm.bmWidth;
int nHt = bm.bmHeight;
int nWide = MulDiv (nWd, nTxtHt, nHt);
CDC memDC;
memDC.CreateCompatibleDC (pDC);
CBitmap *pBmpOld = memDC.SelectObject (&bmp);
CRect rc (CPoint (nX, nY), CSize (nWide, nTxtHt));
pDC->Rectangle (&rc);
pDC->StretchBlt(nX, nY, nWide, nTxtHt, &memDC, 0, 0, nWd, nHt, SRCCOPY);
memDC.SelectObject(pBmpOld);
The framing rectangle prints just fine. The bitmap prints fine in preview. But when printed to printer, it shows up as a dot.
What am I doing wrong here?
|
|
|
|
|
If your printer is 300 DPI, then a 300x300 bitmap will by one inch by one inch. So you need to work out the size of the printer DC, then you can work out how big you need to stretchblt the bitmap.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In VC++6 MFC I'm using the CFileDialog Class to get a filename from the user as in the code below.
How do I write ASCII data to the file that is returned. How can I write "Hello World" to the file. Can I use fprintf? What would the file handle be?
char strFilter[] = { "CANMon Files (*.canmon)|*.canmon|All Files (*.*)|*.*||" };<br />
<br />
CString canLogFile;<br />
<br />
CFileDialog FileDlg(FALSE, ".bcr", NULL, 0, strFilter);<br />
<br />
if( FileDlg.DoModal() == IDOK )<br />
{<br />
f.Open(FileDlg.GetFileName(), CFile::modeCreate | CFile::modeWrite);<br />
CArchive ar(&f, CArchive::store);<br />
<br />
canLogFile = FileDlg.GetFileName();<br />
sprintf(szPrintString, canLogFile);<br />
m_logboxTestVariable.AppendString (canLogFile);<br />
<br />
}<br />
|
|
|
|
|
Freddie Code wrote:
How do I write ASCII data to the file that is returned.
Use CFile::Write() or CStdioFile::WriteString() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello,
I was wondering if someone knows how to retrieve the windows PID as normal text like 123-123456 from the registry (it's binary value) and display it.
Thanks,
D.
|
|
|
|
|
What is the registry key/value that you are interested in?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\wpaevents the OOBETimer value
|
|
|
|
|
Why not use RegQueryValueEx(..., REG_BINARY, ...) ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
And if I want to display this in a static control, what do I do?
|
|
|
|
|
To display anything in a static control, use SetWindowText() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi, I am looking for a very simple way to implement a function with the mouse similar to kbhit() in C++ through windows xp... I just want to have the program be able to read a mouse click and possibly set an integer value depending on if the click was a right or left click... If someone could please help with this I would really appreciate it!
|
|
|
|
|
On what would the mouse be clicked?
Here are some things to search for:
WM_LBUTTONDOWN
WM_RBUTTONDOWN
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I need to modify an industrial application to display chinese characters as well as english text. I have followed many suggestions, tips, advice, etc. in many directions and have wound up right where I began. Is there an easy way to gain this functionality without having to reinvent the wheel? I have enabled the proper fonts and language support packages. I can type chinese characters in Notepad using ALT + the character code, however, this doesn't work in the Developer Studio.
Any suggestions, tips, ideas....???
Thanks so much
|
|
|
|
|
Edit the PreCreateWindow function and add:
cs.style &= ~WS_THICKFRAME;
That should take care of it for you.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi!
How I can show the OpenFileDialog in a control, as it be a panel or another control?
I want to do is a control similar for the .NET Folder View by PiSysLabs
( http: // www.pisyslabs.com/DiskObserver.aspx )
Thanks!
|
|
|
|
|
Hi, is there sample code to kill or shutdown another mfc dialog application (.exe) from an mfc application ? THANKS !
|
|
|
|
|
Why not just post a WM_CLOSE message to it? If that does not work, try TerminateProcess() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for responce. Infact i am learning MFC. Now when i use SDI and compile the program, a window like notepad is opened. I want to view my form (which i included as new resourse with base class CFormView as i was told) not that window. Please tell me how can i do that.
Thank you.
We Believe in Excellence
|
|
|
|
|
Can you be more specific. not that window????. What u want to do?
Work hard and bit of luck is KEY to SUCCESS
|
|
|
|
|
All i want to do is get all of the text together from an array of CString objects and put it into a single char* pointing to a string. I'm doing memory allocation and I can't find away to delete the original temp data. It works, but..."I'm stomping on other memory!"
This should be the easiest thing ever. But i'm worried about a memory leak here. Whenever I try to delete allText before creating a NEW allText allocation, it dies. Any ideas how to fix these memory leaks?
char* CFindInWindowDlg::GetTextLinesBuffer()
{
char* allText = NULL;
char* source = NULL;
int sizeAllText = 0;
if (numLines > 0)
{
// **** 'lines' is my array of CString objects!!!
int sizeAllText = strlen(lines[0].GetBuffer(0));
source = new char[sizeAllText];
strcpy(source, lines[0].GetBuffer(0));
for (int a = 1; a < numLines; a++)
{
// **** 'lines' is my array of CString objects!!!
sizeAllText = MergeLines(&allText, sizeAllText, &source, lines[a].GetBuffer(0));
source = allText;
}
}
return allText;
}
int CFindInWindowDlg::MergeLines(char** allText, int sizeSource, char** source, char* aLine)
{
int newSize;
if ((sizeSource == 0) && (*source == NULL))
{
*allText = new char[strlen(aLine)];
newSize = strlen(aLine);
strcpy(*allText, aLine);
return newSize;
}
newSize = sizeSource + strlen(aLine);
*allText = new char[newSize];
strcpy(*allText, *source);
strcat(*allText, aLine);
return newSize;
}
|
|
|
|
|
c121hains wrote:
int sizeAllText = strlen(lines[0].GetBuffer(0));
source = new char[sizeAllText];
C-style strings are null-terminated, meaning there is a 0 byte to mark the end of the string. strlen() does not include that byte in the length, so you end up not allocating space for that byte.
source = new char[sizeAllText+1];
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
I even hear the Windows "OMG I booted up fine" sound.
-- Paul Watson diagnosing hardware problems.
|
|
|
|
|
Actually the code works fine. Everything is allocated the way i want it to. The only problem is deleting. I can't seem to do that.
|
|
|
|