|
What's the dpi on the printer DC?
A 32x32 icon will be pretty small on a 1400dpi printer
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, without other mapping,
about 0.023 inch per side.The final rendering software may pass that off as noise and decide to print a blank page.
Regards
Bram van Kampen
|
|
|
|
|
thank you for your reply!
my printer is HP LaserJet 3052, with 1200dpi.
So do you have any idea what I should do in this case?
|
|
|
|
|
Create a New Bitmap of fixed dimensions of your choice, Bitbuild your Icon in it, using stretch mode, and then print this new bitmap.
Regards,
Bram van Kampen
|
|
|
|
|
I have a visual c++ program and I am trying to get the value of an environment variable using the getenv function. Seems pretty simple but when i call it in the debugger I get the message "Please enter path for libcpd.pdb." Does anyone know why this happens on this function?
Note: The program compiles and builds witjh no errors. Only when I run it I get the problem
Here are my includes (although I dont think it has anything to do with this):
stdio.h
stdlib.h
iostream.h
cstdlib.h
windows.h
Rock
|
|
|
|
|
rocktx wrote: ...I get the message "Please enter path for libcpd.pdb."
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hello,
I am trying to get all links on an web page. Unfortunately, the "get_anchors" doesn't seem to retrieve all anchor elements. I have pages full of links and all I get are few or none.
I'm using Visual C++ 2003. I have an MFC Dialog application with embedded webbrowser control.
Here's my code: (btw, GetDocument function calls IWebBrowser::get_Document() function and it works fine with things other than getting anchors).
HRESULT hr;
IHTMLDocument2 * pHtmlDoc = GetDocument();
CStringArray sURLArray;
if (pHtmlDoc != NULL)
{
IHTMLElementCollection * pColl = NULL;
hr = pHtmlDoc->get_anchors(&pColl);
if(SUCCEEDED(hr))
{
LONG nElem = 0;
hr = pColl->get_length(&nElem);
if(SUCCEEDED(hr))
{
for(long i = 0; i < nElem; i++)
{
_variant_t vIndex(i);
IDispatch * pDisp2 = NULL;
hr = pColl->item(vIndex, vIndex, &pDisp2);
if(SUCCEEDED(hr))
{
IHTMLAnchorElement * pAnchElem = NULL;
hr = pDisp2->QueryInterface(IID_IHTMLAnchorElement, (void**) &pAnchElem);
if(SUCCEEDED(hr))
{
BSTR bstrHref;
if(SUCCEEDED(pAnchElem->get_href(&bstrHref)))
{
CString strLink(bstrHref);
if(!strLink.IsEmpty())
sURLArray.Add(strLink);
SysFreeString(bstrHref);
}
pAnchElem->Release();
}
pDisp2->Release();
}
MessageBox(sURLArray.GetAt(i));
}
}
pColl->Release();
}
pHtmlDoc->Release();
}
Taking a look now at the code. I think that I should have used if(FAILED(...)) return; instead of if(SUCCEEDED(...)) .. it would have been more readable without all these brackets.
Any help is appreciated
Thanks
|
|
|
|
|
So the value of nElem is simply less than it should be?
Mohammed Tarik wrote: I think that I should have used if(FAILED(...)) return; instead of if(SUCCEEDED(...)) .. it would have been more readable without all these brackets.
Since nElem is the culprit, everything below it is superfluous.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, and sometimes it's zero.
|
|
|
|
|
What URL are you using? I just tried it with a few and get_length() returned the correct value.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am testing with "flightcenter.co.uk" and "google.com". The first one returns some URLs while the second doesn't return any !!
|
|
|
|
|
Mohammed Tarik wrote: The first one returns some URLs while the second doesn't return any !!
Do the anchors have a name or id attribute?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No, the URLs returned were strange and I couldn't even find their corresponding anchors. They were like "javascript:submitCJ10.....http://somesite"
As you can see from
hr = pColl->item(vIndex, vIndex, &pDisp2);
I am not trying to put any constraints on the returned URLs.
|
|
|
|
|
Mohammed Tarik wrote: No...
get_anchors() only returns those that do.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
So, in order to return all the links on a page regardless of name or id attributes, I have to write my own code? Do you know of any other function that can do this?
Thanks a lot for your help
|
|
|
|
|
I found that get_links can do it.
Thanks again.
|
|
|
|
|
Doesn't that return LINK and AREA elements?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well, at the beginning of my first post, I mentioned that I need to get all links on a web page. I chose get_anchors() because I found a sentence mentioning it in one of CP articles where the author said that it is used to get hyperlinks.
I guess that get_links() would do a better job for me after some processing.
Sorry for the inconvenience.
|
|
|
|
|
Hi,
How can I get the all connected harddrive to my pc and logical drive name corresponding to physical drive?
I think WMI can help me right?, if yes please help mw with any suitable link.
|
|
|
|
|
Fedrer wrote: How can I get the all connected harddrive to my pc and logical drive name corresponding to physical drive?
Use GetLogicalDriveStrings() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Not quite a newbie, but just how do you have the system shell open your application on right click->open?
This of course assumes you already associated that file type to your application.
Someone please enlighten me.
Thanks:
|
|
|
|
|
I am not sure I understand your question properly. How does it matter if you right click and open a file or you double click and open a file?
If I got your question right, do have a look at ShellExecute()[^]
|
|
|
|
|
Okay,
Say I wrote an application to view jpeg bitmaps. Then I tell windows to open jpeg files using my application by going into explorer, right click on a jpeg file choose properties, then click "Opens with" ---> change. Set to myApp.exe as associating executable. Now, let's suppose after doing this when I double click or right click--> open, myApp executes... But guess what? Where's the bitmap?
There is something missing... You need at the very least, some means to pass the file path info to myApp. As a command argument ?? A pointer to file structure?? As a shellexecute parameter , But wait, shell execute is only useful if all you're interested in is to run another application from within your program. You would then have to write a shell helper that attaches to explorer, but this seems far too much overkill to me. I'm missing something here, so I'm hoping some MSVS C++ gurus out there could help me get to an answer quicker. As I said, I'm not a newbie-just point me in the right direction.
|
|
|
|
|
The file path is passed as a command-line parameter to your app.
You need to retrieve that filename and open/render the file.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|