|
Hehehe, don't you just hate when that happens.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I always just declare my own tstring :P
typedef std::basic_string<TCHAR> tstring;
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Hi,
I have a an out of process COM EXE that runs on local server.
This (.EXE) is statically linked to a dll. There are 3-4 directories in which
the set of dlls reside (different versions of dll), and I have to decide which set of dlls to use at run time.
This is what I try in the calling program:
Get the current environment variable (using GetEnvironment Variable)
Append the chosen dll folder (from the set of 3-4 folders, because by this
time I know which set of dlls to use) to the PATH variable
Call SetEnvironment Variable.
Now call Coinitialize() and CoCreateInstance()...
I expect the COM EXE to come up using the overridden PATH variable because
the child process is supposed to inherit the parent's environment.
While this is behaving as expected in most cases, in certain cases it is
not behaving the way I want it to behave. At times (especially when called from within an NT service), the COM EXE does not inherit the revised PATH variable but instead inherits the original PATH variable.
What are the situations when CoInitialize() results in initializing the COM EXE with a different environment than the parent? Is there any way to force the child to inherit the revised PATH variable from the parent?
Regards,
Gopi
|
|
|
|
|
Like topic says. I try to stay away from MFC as much as possible but I need to convert some MFC classes to ATL and I haven't found equivalents to those 2 classes.
Anyone knows?
Thanks!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
If you are using ATL7 then you get some good array/list templates - CArray<> and CList<>/
|
|
|
|
|
MSHTML certainly parse HTML code.
For Example,,,
To,,
I want to stop parsing.
Since MSHTML is automatically parse the moment I inputted the character, I am in trouble.
Please help me!!
|
|
|
|
|
The key thing that you need to do is use the IPersistStreamInit interface. This will allow you to get the data. This function goes a step further and verifies that IE is holding a HTML doc, however you could change this to grab any data.
HRESULT GetDocumentContent(IWebBrowser2 *pWebBrowser2, CComBSTR &bstrHTMLText)
{
bstrHTMLText.Empty();
CComPtr<IDispatch> pDisp;
HRESULT hr = pWebBrowser2->get_Document(&pDisp);
if (FAILED(hr))
{
return hr;
}
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML = pDisp;
if (spHTML)
{
CHAR *szData = NULL;
OLECHAR *htmlText = NULL;
try
{
CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> spData = spHTML;
CComPtr<IStream> spStream;
::CreateStreamOnHGlobal(NULL, TRUE, &spStream);
spData->Save(spStream ,FALSE);
STATSTG stat;
spStream->Stat(&stat, STATFLAG_NONAME);
szData = new CHAR[stat.cbSize.LowPart];
ULONG length;
LARGE_INTEGER pos;
pos.QuadPart = (__int64)0;
spStream->Seek(pos, STREAM_SEEK_SET, NULL);
spStream->Read(szData, stat.cbSize.LowPart, &length);
htmlText = new OLECHAR[length];
::MultiByteToWideChar(CP_ACP, 0, szData, length, htmlText, length);
bstrHTMLText = htmlText;
}
catch (...)
{
}
delete[] htmlText;
delete[] szData;
}
else
{
}
return S_OK;
}
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thank you,
But I could'nt.
That's source complied suceedly.
And, HTML Code was put.
,,,,,
I want to read original HTML code.
Example,,
Original:
a
bc d
MSHTML:
a bc d
I want to put original source.
|
|
|
|
|
Í have the following problem, my app (wtl exe)loads dll´s dynamically (also wtl NOT COM) which display dialogs(pages) on a client area of my main app (also a dialog). The problem that I´m having, is that when changing between pages I check for valid data before displaying the next/chosen page. This checking is performed in the dll(in the class that wraps the page), and on an error, should display a MessageBox. However, the messagebox is NOT Modal, and is destroyed after being visable for 1 second or so... 'I´ve even gone as far as changing my dll interface to take a HWND of the main apllication so that I can call the messagebox so...
int nRet = ::MessageBox(hWndOfMainApplication,"Bollocks!", "Error!", MB_OKCANCEL | MB_TASKMODAL);
I´m at my wits end and don´t know why this is happening,
Any Ideas???
Thanks in advance
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Anyone could point me to a nice tutorial so I can learn how to access an Access database with SQL queries? What I did so far is to use the ATL OLEDB Consumer in the class wizard and create a consumer that uses CCommand. The documentation I found on MSDN is quite confusing...
I used to do this quite easily with MFC but it seems a nightmare to do (at least to understand) with ATL... I almost regret not including support for MFC in my ATL project...
Thanks guys!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
ATL consumers provide database access using OLE DB - the most efficient way to access SQL database. OLE DB however has relatively steep learning curve. One thing you can do to quickly be able to deal with databases in your ATL project - is to use ADO instead. ADO is a VB-friendly layer on the top of OLE DB. Just import ADO type library by including it in your stdafx.h:
#pragma warning(disable:4146)
#import <msado15.dll> no_namespace rename("EOF", "_EOF")
#pragma warning(default:4146)
Then you can use ADO interfaces in your project (check MSDN documentation). It's not as efficient as OLE DB (single fields are converted into VARIANTs), but it's a quick and easy start.
Forget about MFC database classes in ATL. MFC only supports ODBC.
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
Hex is for sissies. Real men use binary. And the most hardcore types use only zeros - uppercase zeros and lowercase zeros.
Tomasz Sowinski
|
|
|
|
|
Vagif Abilov wrote:
OLE DB however has relatively steep learning curve.
Not with the ATL-classes...?
It's the same old procedure; issue query, move to top, scan and process until end.
With VS.NET and attributed classes, it's as simple as ADO I'd say - without the VARIANT-mess.
--
Master, I'm so glad to feel your presence. But you don't seem to share my impatience. I relied upon you to break the silence. I cannot understand your reluctance.
Master, I feel so warm and I'm so happy, oh master.
Give me some more of the warm little beasts
I'm so fond of.
|
|
|
|
|
I'm trying to figure out a way to easily parse and formating date/time values using STL. Unfortunately, I can't seem to find much information regarding the time_get and time_put facets. I can use strftime and the other associated crt calls but I would prefer to stay in stl for this if I can.
Does anyone have a good sample, or reference to a sample on how to do this?
Thanks in advance,
Shawn Nagase
|
|
|
|
|
Does anybody knows how can I solved the following problem.
When I make a ATL Project with the ATL/WTL AppWizard and I try to use the ClassWizard, I get the following error:
The ClassWizard database c:\app\app.clw does not exist. Would you like to build it from your sorce files?
After selecting my source files, it won't rebuildem.
Does anybody knoes how can I correct(prevent) this problem.
This happens also in my first time Visual C++ installation.
|
|
|
|
|
ClassWizard is for MFC apps. For ATL, you can right-click a class in ClassView, and if it's a window class the menu will have "add message handler" and other commands for adding handlers to the ATL msg map.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
duh!!! sorry for the expression.. but you dont use the class wizard in ATL dude.. that;s for MFC !! forget ATL if you wanna stick to classwizard... or mebbe vice versa! LOL
happy programming
One more addition to the addiction of coding!
If you want a helping hand, you'll find one at the end of your arm.
|
|
|
|
|
Environnement: VC6, ATL3, Win98
Here's my problem: I followed Michael Dunn's article[^] but instead of using simple controls, I create dynamically an instance of an activeX control, to place it on the added property page. I use the function CreateWindow in the OnInitDialog function, with the parameters "AtlAxWindow" and the CLSID of the activeX I want.
<br />
BOOL OnInitDialog(HWND hwnd, LPARAM lParam)<br />
{<br />
[...].br />
HWND hCtrl = CreateWindow("AtlAxWin", _T("{BA9DD568-114B-11D4-98DA-00104B458137}"), WS_VISIBLE | WS_CHILD, x, y, iWidth, iHeight, hwnd, (HMENU) IDI_MYACTIVEX, _Module.GetModuleInstance(), NULL);<br />
[...].br />
}<br />
If this works nicely on Win95, WinME, Win2000 and WinXP, the creation of the activeX blocks under Win98, at least with non-microsoft ActiveX. The Shell extension is frozen as is explorer
Does anybody have any clue of what may be happen, or if there are known issues about Shell extensions with W98?
TIA!
K.
Who gives a f*ck
If my life sucks ?
I just know one day
I won't give up
Beg For Me/KoЯn
|
|
|
|
|
Hi,
I have to loop through a large amount of text messages, and for each of these messages, I have to tokenize every words. I find it quite slow, for example, tokenizing 300 messages takes around half an hour! Each message can take from 1/4 of a sec. to ~30 secs.
I'm using these caracters to determine the tokens separators:
"% #=+,&*[]”“…:/(){}!®<>.\\|;~?`^¿\"\n\a\b\f\r\t\v"
Why is it so slow? Is there a faster way to retreive tokens?
Thanks!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
That is one hell of a list of tokens there. CStringT is going to be using mbsspn which will run slower if you just need ASCII. Also, even if you are just using strspn, it will have to build a bitmask of the valid terminators each call. LOTS of wasted time.
I would just toss CStringT and work with a character array directly. Build yourself a mask of the valid terminators and scan the string by hand. You will be shocked at how fast your program will run.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I wrote an ActiveX control. This control read a bitmap and resize itself to the bitmap.
I set m_bAutoSize to TRUE. And use SetWindowPos to set it's size. But it just can't work. What can I do? Thanks
|
|
|
|
|
Why is there an "erase" function *and* a "remove" function in STL lists? Wouldn't a single overloaded function have served equally well?
What's the difference between the two? Why would you use one over the other?
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
erase works on iterators
remove works on the value stored in the list.
hence
list<int> int_list;
int_list.push_back(1);
int_list.push_back(2);
int_list.push_back(2);
int_list.remove(2); //removes both the 2s stored in the list
int_list.erase(int_list.begin(), int_list.end()); // remove all items
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Because the naming in STL sucks. begin() is a verb yet it doesn't actually do any action. empty() isn't clear unless you memorize what it does (does it empty the list, or check if it is empty?). And so on.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Yeah, I was always told that STL was so efficient and logical. Bull pucky.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I have a love/hate relationship with STL too. So many great jewels in a sea of ****.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|