|
I was recently given a project to write a program to fill forms on the company web site. the program collects data and sits idle , when the web site is accessed the program will automaticaly fill the forms with with correct data. all i have left is the form fill part but i can't find any leads on how to do this. could someone point me in the right direction as to how this is done.
|
|
|
|
|
You can write a BHO that watches for the NaviagateComplete event, then checks either the URL (for example, if you know the forms will always be on your company's site) or just looks for HTML elements with the right names/ids.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I am trying to print a bmp image in MFC. I have tried creating a memory DC (compatible with the printer) and using BitBlt but it doesn't work for a printer DC. I have also tried CreateCompatibleBitmap which may work but how do I get the image into the newly created bmp. I tried using SetBitmapBits but no success. Obviously there is more preparations to do for this to work. Anyone done this before?
|
|
|
|
|
In your CView-derived class's OnDraw:
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP1))
{
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
CRect rect;
GetClientRect(&rect);
int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;
pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
}
PeterRitchie.com
|
|
|
|
|
Hi,
In my program I need a windows system file say mouhid.sys, for example.
I found that file inside the cab file in windows\driver cache\i386\driver.cab. If I give this as my source path in my program, it is not detecting the file( I think because of cabinet file).
Is there any way to tell the system to take from that cab file automatically or any spl path that we can mention so that the system automatically detects the file.
Thanks a lot.
|
|
|
|
|
|
Hello,
I've got a class to browse folders similiar to CSXBrowseFolder here on code-project. It worked fine until I needed to run my software on a fresh installed Windows 2000 with IE5.
Selecting e.g. "My Documents" gives me not the real path but an Id like "::{xxxxxxxxx}".
I'm not sure if I'm right, but I think I need to resolve this "link" using the shell functions. But whatever I tried it didn't work.
If I select a usual folder (e.g. c:\test) it works like expected.
I found a message on MSDN, that win2k/ie5 doesn't follow these links. But newer versions do so. Seems I get the Id of the not real existing folder, while IE6 resolves these links automatically.
Maybe someone can give me hint how to solve this problem? Thanks in advance!
Ingmar
|
|
|
|
|
You can convert the file object's display name into a path with the following:
<FONT COLOR=GREEN></FONT>CComPtr<FONT COLOR=BLUE><</FONT>IShellFolder<FONT COLOR=BLUE>></FONT> pshf <FONT COLOR=BLUE>=</FONT> NULL<FONT COLOR=BLUE>;</FONT>
<FONT COLOR=BLUE>:</FONT><FONT COLOR=BLUE>:</FONT>SHGetDesktopFolder<FONT COLOR=BLUE>(</FONT><FONT COLOR=BLUE>&</FONT>pshf<FONT COLOR=BLUE>)</FONT><FONT COLOR=BLUE>;</FONT>
LPITEMIDLIST pidlDocFiles<FONT COLOR=BLUE>;</FONT>
ULONG cbEaten<FONT COLOR=BLUE>;</FONT>
pshf<FONT COLOR=BLUE>-</FONT><FONT COLOR=BLUE>></FONT>ParseDisplayName<FONT COLOR=BLUE>(</FONT>NULL<FONT COLOR=BLUE>,</FONT> <ul> NULL<FONT COLOR=BLUE>,</FONT>
L<FONT COLOR=PURPLE>"::{450d8fba-ad25-11d0-98a8-0800361b1103}"</FONT><FONT COLOR=BLUE>,</FONT>
<FONT COLOR=BLUE>&</FONT>cbEaten<FONT COLOR=BLUE>,</FONT>
<FONT COLOR=BLUE>&</FONT>pidlDocFiles<FONT COLOR=BLUE>,</FONT>
NULL<FONT COLOR=BLUE>)</FONT><FONT COLOR=BLUE>;</FONT>
</ul>
TCHAR szPath<FONT COLOR=BLUE>[</FONT>MAX_PATH<FONT COLOR=BLUE>]</FONT> <FONT COLOR=BLUE>=</FONT> _T<FONT COLOR=BLUE>(</FONT><FONT COLOR=PURPLE>""</FONT><FONT COLOR=BLUE>)</FONT><FONT COLOR=BLUE>;</FONT>
<FONT COLOR=BLUE>:</FONT><FONT COLOR=BLUE>:</FONT>SHGetPathFromIDList<FONT COLOR=BLUE>(</FONT>pidlDocFiles<FONT COLOR=BLUE>,</FONT> szPath<FONT COLOR=BLUE>)</FONT><FONT COLOR=BLUE>;</FONT> But, I'm curious, how are you getting the display name "::{GUID}"? Are you using SHBrowseForFolder? If so, what are you doing with the PIDL?
PeterRitchie.com
|
|
|
|
|
Thanks for the help. I tried it out, but if gives me the same GUID back again I put in?!
For your question, I use
itemIDList = SHBrowseForFolder(&browseInfo);
...do some checks and then
SHGetPathFromIDList(itemIDList, szPathBuffer);
And at this point I've got that GUID in szPathBuffer. I found so many samples, everyone does it that way, but I already tested on 2 win2k machines and it doesn't work. (Except I update to IE6, but this is currently not an option).
Maybe something is wrong with my browseinfo structure? I did nothing special, maybe some flags are needed I didn't set?
Ingmar
|
|
|
|
|
Then you've got a GUID to a virtual folder that does not have a physical location for it.
PeterRitchie.com
|
|
|
|
|
I tested some things, and it seems the problem isn't SHBrowseForFolder itself. But it's more strange: A simple BrowseForFolder-application works well on 2k, but my real application doesn't! I did try and error and I found out, that I get a good path, when I run SHBroswForFolder before I open a database via ODBC (CDatabase) ?!?!
Don't have a good idea now, but it has definitly to do with the DB-Open. Maybe it's a bug? This works great on XP or better on any machine with IE>5.
Ingmar
|
|
|
|
|
It is my understanding the using the following line of code is bad pratice.
delete this;
Is there ever a good reason to use this construct?
Thanks
|
|
|
|
|
Like anything else, if it is used properly it has its uses, but used improperly it can be disatrous. I use it for classes that are to be self deleting, and always make sure it is the very last command the class executes.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
It's how COM object lifetime is managed. Last one to call Release(), essentially tells the object to delete itself. For instance:
ULONG Release(void)
{
ULONG lResult = InterlockedDecrement(&m_dwRef);
if (lResult == 0) delete this;
return lResult;
}
|
|
|
|
|
Okay so COM makes use of it and also with self deleting classes.
I understand the COM aspect but what is a self deleting class?
Let me clarify the question a little. Is there a general rule? When would you use delete this?
Thanks
|
|
|
|
|
smesser wrote:
what is a self deleting class?
A class that deletes itself. Examples are CFrameWnd and CWinThread (when m_bAutoDelete is TRUE).
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Yeah, but that is framework stuff. When as a programmer have you used:
delete this;
Steve
|
|
|
|
|
|
with MFC, it's used to delete a modeless dialog.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have been programming with c++ since the Cfront "compiler" came out of ATT. I have never found a circumstance where delete this seemed like a correct solution. My impresssion is that it is an artifact of bad design. The fact that the MFC and COM implementation require it is not a surprise Along the same line, throwing an exception via a pointer is equally dangerous in my book!
|
|
|
|
|
Brian R wrote:
it is an artifact of bad design
It is a tool that makes it easier to use and then dispose of one time objects without having to keep track of the pointers and memory yourself. Using it is a design decision, not "bad design". Abusing it is bad design, but then abusing anything is.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
PJ Arends wrote:
Using it is a design decision, not "bad design". Abusing it is bad design, but then abusing anything is
I am in 100% agreement with you. Even the infamous 'goto' is cursed as a bad design paradigm. But circumstances govern their use in a few specialized cases. After all 'delete this' has certainly come to my rescue when I had to monitor the lifetime of an object using a reference counter similar to the COM classes. I seem a fair use of 'delete this' in such case. Also there are so many things in C++ that if abused screw up the program, better curse programming skill than curse a language
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
Mayur Mahajan wrote:
But circumstances govern their use in a few specialized cases.
A paper put together in 1966 by BÖhm, Corrado, and Guiseppe proved theoretically that the GOTO statement was unnecessary; Dijkstra considered it harmful; and Knuth said it might be useful in some circumstances.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Well, the main point here is:
We have razor sharp tools in the kit. If you can handle them, use it...else they'll hurt you bad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
thanks all I now have a better understanding of this topic.
|
|
|
|