|
Michael Dunn wrote:
The quickest way is to use a _bstr_t, which provides the character set conversion:
Ok Mike, maybe you can clear this up for me, maybe (please):
What is the purpose (for example) of having all these different types/names for string like data types? After reviewing the MSDN article[^] here I see things like, LPCSTR , LPCTSTR , LPCWSTR , LPTSTR , LPWSTR , PCSTR , PCTSTR , etc.... I think you get the point. I understand these are names, but why in the hell are there so many, they seem to be so closely related to each other.
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
The LP and P prefixes mean the same thing these days. The difference is a leftover from the days when there were near and far pointers (L = long, indicating a far pointer).
I just posted an article about strings[^], and I have part 2 almost done which covers the various wrapper classes and how to convert among them.
--Mike--
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
|
|
|
|
|
Michael Dunn wrote:
I just posted an article about strings[^], and I have part 2 almost done which covers the various wrapper classes and how to convert among them.
Thanks Mike, that's exactly what I was looking for, C++ keeps becoming more and more inviting every day.
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
thanks for the valuable knowledge sharing........
cheers
leonwoo
|
|
|
|
|
I am working on a ATL Com object. I want to ask what is the difference between ReleaseMinSize and ReleaseMinDependency. I observed that size of ReleaseMinDependency is much less that ReleaseMinSize. I am interested in both reducing size as well as distributing minimum DLL's with my DLL.
Can any one tell the difference
Ahsan
|
|
|
|
|
With RelMinSize your code links to atl.dll and the CRT DLLs. What I do is build RelMinDep so I don't have to worry about shipping other DLLs, then set the compiler optimizations to minimize size (default is maximize speed) and add the linker switch /opt:nowin98 which shaves a few more K off the binary's size.
--Mike--
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
|
|
|
|
|
I did do a few worker/window threads with MFC but I don't have a clue where to start so I can use threads with ATL...
Can someone point me to a tutorial or some doc?
Thanks!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
There is no thread wrapper class, you just use _beginthread() or _beginthreadex() to create new threads.
--Mike--
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
|
|
|
|
|
Thanks Mike!
Although I get this error when trying to use _beginthread()
error C2664: '_beginthread' : cannot convert parameter 1 from 'void (void)' to 'void (__cdecl *)(void *)'
I did follow the example on MSDN, my function doesn't return any value but it won't work!!!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
As the error message says, your thread func has the wrong signature. It takes a void* (not void) and needs to be declared with the __cdecl calling convention.
--Mike--
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
|
|
|
|
|
Wouldn't it be better to use CreateThread() to minimize the CRT (and perhaps elminate the need for it)?
--
Please state the nature of your medical emergency.
|
|
|
|
|
I don't think I've ever made a non-trivial ATL project that didn't use the CRT. I always use a string function, or an STL collection, or something. So I personally don't care about keeping the CRT out and saving what, 40-50K?
--Mike--
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
|
|
|
|
|
All I want to do is to use atlgdi.h but things get bad when I include atlapp.h. I can't get the project to compile, I always get this error:
unresolved externals... CAppModule or CServerAppModule...
Anyone has a bulletproof stdafx.h?
I'm going mad!
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
Here's what my typical WTL project uses
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__F9127740_BA37_42DC_8669_904CB2CFC7D4__INCLUDED_)
#define AFX_STDAFX_H__F9127740_BA37_42DC_8669_904CB2CFC7D4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <atlwin.h>
#include <atlapp.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atlmisc.h>
#include <atlcrack.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__F9127740_BA37_42DC_8669_904CB2CFC7D4__INCLUDED)
<b>Todd Smith</b>
|
|
|
|
|
Whenever you use anything from ATL and WTL (well, anything beyond the simple wrapper classes like CComPtr) you must have a global variable called _Module , similar to how MFC apps must have a global CWinApp object. Just make a dummy project with the AppWizard and copy the #includes from the stdafx.h that the wizard generates.
--Mike--
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
|
|
|
|
|
That's what I did and I always get an unresolved external with this command:
extern CServerAppModule _Module
I also tried:
extern CAppModule _Module
There's no lib to link, right?
---------------
Concentrating on Ideas
http://www.edovia.com
|
|
|
|
|
Just like with any global variable, you also need to define the variable in one of your CPP files.
CAppModule _Module;
--Mike--
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
|
|
|
|
|
Sh*t hits the fan when you combine ATL7 and WTL7 in a COM-dll project..
ATL7 uses totally different "module"-strategy than ATL3. WTL7 however relies on the old ATL3-strategy.
What you need to do then is to
#include <atlheaders.h>
#define _Module (*_pModule)
#include <wtlheaders.h<
#undef _Module
--
Please state the nature of your medical emergency.
|
|
|
|
|
Hello,
I have a resizable dialog with a group box control. Resizing is done via WTL's classes & macros. It looks like the group box control's background is not repainted neither initially nor after resize. Does anybody know how work around this problem?
Thanks.
--Daniel
|
|
|
|
|
Groupboxes do not peacefully coexist with the WS_CLIPCHILDREN window style when resizing. You can remove the clip children style from the property page, but be prepared to suffer some screen flicker.
|
|
|
|
|
I am trying to develop an ATL Web Service. It works fine on Win2000, but I want to deploy it on a NT Server machine with .NET framework installed.
Unfortunatelly, trying to add a web reference from a client application to the server will give me http 500 error.
Are there any tricks to be performed or is it just not possible?
Thanks!
Best regards,
Alexandru Savescu
|
|
|
|
|
Is this the same as trying to create a virtual directory for an IIS server on NT 4? If so, I've got a VB script that works.
|
|
|
|
|
It has nothing to do with the virtual directory. I can create that manually and it works fine.
I have also tried to make an ATL Server application (not WebService). Trying to access the srf file gets me the following error "The remote procedure call did not execute"
Any ideas? According to the documentation one can create ATL Server application on NT 4 Server. Maybe there is also something they forgot to mention....
Best regards,
Alexandru Savescu
|
|
|
|
|
I´m trying to show the Folder dialog. Does any body knows where can I get a sample ATL/WTL project with this.
|
|
|
|
|
SHBrowseForFolder() is the API. There are wrapper classes here on CP (but I haven't looked to see which ones use ATL.)
--Mike--
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
|
|
|
|