|
You need a CWindowImpl -derived class for DDX_CONTROL to work. CComboBox is a CWindow class (just implements a wrapper around an HWND and CB_* messages). Add this class definition to your app:
class CComboBoxImpl : public CWindowImpl<CComboBoxImpl, CComboBox>
{
DECLARE_EMPTY_MSG_MAP();
};
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Thanks Michael. Do you have any idea why this is not implemented by default in WTL? I would think this is something that is used a lot - is there a reason?
|
|
|
|
|
Since I'm not the author of WTL I can't say for sure. It's more a documentation problem (there isn't any) so the solution isn't obvious at all (I myself happened to see the answer in a discussion board somewhere on CP)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Here´s an easyer solution:
declare you global CComboBox global variable like you did, But dont put a DDX entry for it on the map, instead on your dialogs WM_INITDIALOG handler,
add this:
m_TypeCombo.Attach(GetDlgItem(IDC_MYCOMBO));
ATLASSERT(m_MyCombo.m_hWnd != NULL);
where (of course) IDC_MYCOMBO is the ID of your combo.
Note that you can do this for any control.
Hope this helps.
|
|
|
|
|
Of course, you then defeat the purpose of DDX in the first place. With DDX_CONTROL you don't have to write all those GetDlgItem/Attach calls.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
I agree, it does sort of defeat DDX, but then again, thats the beauty of WTL, you dont HAVE to used DDX! and "all those GetDlgItem/Attach calls" is actually only one at InitDialog. NE way, i do respect your opinion, but i must say that in this case i disagree with it, i find that just adding a line of code on initdialog is easyer that writting your own dervived class, writting a DDX entry for it, etc.
|
|
|
|
|
Hello,
I am new to ATL/WTL and I don't really understand why I would need these libraries. Actually I only developed my applications with MFC and some ActiveX components. I read some articles about ATL and WTL on CodeProject. In the one hand I read 5 articles about ATL and understood nothing, the writer mostly talk about pointers and vtables... What's his point ? What about saying "ATL is...". Then I read the introduction to WTL and understood that It was somekind of MFC-COM wrapper. Why would I need a MFC-COM wrapper to developer a software ? Moreover It seems that it's not an official library and I can't find any information on MSDN:
"Your search using "All words" for ""wtl""
returned 0 results."
If you have any good articles or books to advice me, that would great. I feel like I am losing something. Is "Developer's Workshop to COM and ATL 3.0" a good reference ? I don't really understand why I would need something else that MFC to develop a Windows Application.
All your help is welcome,
JM
Web: http://goa.ifrance.com
|
|
|
|
|
WTL is not an MFC wrapper, it is a replacement for MFC. It is for developers who want to be in control, at a low level, of what is happening in their applications and who do not want to ship the huge MFC dll. 1mb may not look like much, but on a handheld with 8megs of memory, it is Anyway, another reason to ditch MFC is it's uglyness, but that's a different can of worms...
|
|
|
|
|
Hi,
Well if WTL is that great why can't I find any books or references on it ? Nothing on Amazon nor MSDN. It sounds like a 007 library for spy developers . MFC is not perfect but I like it anyway, it's between the beauty and the beast which means you have both worlds.
I can't dig into WTL or ATL if I can't find anything about useful information about it. The 5 articles from CodeProject don't really explain anything about ATL and the WTL one presents that library in its darker side.
Any books or articles I should read ?
Thanks again,
JM
Web: http://goa.ifrance.com
|
|
|
|
|
Jean-Marc Molina wrote:
a 007 library for spy developers
LOL
Jean-Marc Molina wrote:
Any books or articles I should read ?
ATL Internals is very good, and it's not super-advanced like MFC Internals; it makes a good intro to ATL text in fact.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Hi Michael,
Thanks for the reference but isn't it too Advanced or "Internal" ? I want somekind of Workshop book. For example one of my all time fav book about MFC and Windows app dev is: Inside Visual C++. I thought "Developer's Workshop to COM and ATL 3.0 by Andrew Troelsen" could be that book. People also adviced me to buy:
WROX - Beginning ATL 3 COM Programming
Microsoft Press - Inside COM by Dale Rogerson
I am also a bit scared because I don't know anything about DCOM nor COM+... Oh my god I feel dumb ^^. But first let's learn a few things about ATL/WTL . Here is a very interesting article about MFC vs ATL/WTL:
http://archive.devx.com/free/mgznarch/vcdj/1999/julmag99/atlinherit1.asp
JM double zero ATL/WTL developer
Web: http://goa.ifrance.com
|
|
|
|
|
I don't know of a workshop-style book (something like The MFC Answer Book) for ATL. The Wrox book you mentioned is also good (that was the first ATL book I bought) and covers lots of ATL topics, although GUI doesn't get covered until about chapter 8.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
If you tried to create ActiveX or COM with MFC, try the same with ATL.
No ugly METHOD_PROLOGUE hacks, easy and straitforward.
WTL is ok, also heavy templates aren't as easy to read as non-template MFC code.
Brian
|
|
|
|
|
Hi, you dont have to know about COM to learn WTL, ibe wrote several WTL apps, and i dont know jack-S@#t about COM
What you DO need to know about (at least at a basic level) is about Win32 (the windows API), cause WTL is just a thin wrapper around it(unlike MFC, wich almost completely "hides it" from you) You dont know API? No sweat! if you start learning WTL you will "accidentally" learn API!
I think that this is the major advantage about WTL over MFC, you can writte code on MFC with only very basic knowlage on the windows API, but on WTL you MUST know about it, So why is this an advantage? well consider this, if you were asked to write something without MFC, you probably couldnt do it right? cause when you learned about MFC you learned exacly that, MFC! and MFC works rather Differently that the windows API. If however you learn about WTL (and there for W32 API) and you someday need to write an app using something else, chances are that you WILL be able to do it, cause you allready know the very "heart" of windows programming wich is of course... The API.
In the simplest way of seeing the WTL vs MFC debate, i think it all comes down to this:
If you write programs because you have to, because its "your job" and you want to do it in the easiest fastest possible way (that doesnt involve VB , and are confindent that you will NEVER have to use anything else but MFC, then by all means DO use MFC.
BUT, if you write programs because you LOVE IT, and you wanna have full control of whats happening inside them, plus, you recon that you some day might have to use something else to do it, then i pretty much belive that WTL is a good way to go.
On a side note, i actually belive that WTL is easyer to learn that MFC. it took me about 5-6 months plus 3 full size books to get a relatively firm foothold on MFC, and it only took me about 2 weeks and a couple of sketchy online tutorials to learn WTL.
|
|
|
|
|
Thanks Ernesto I totally agree. I use MFC because of its community and good references (books, websites...). I would like to learn VB too because It would improve my app dev workflow... I won't use WTL because I can't find anything interesting about it. No books, no references, it's not official so there's no support... The idea of developping an other MFC is a great idea but I talked with some guys about it and I don't think It can be a better library. It's supposed to be fast, small and flexible but actually It's a very very light MFC-like library and it lacks a lot of features. Moreover MFC7 is far better that MFC4.2... So I will stick with my good old MFC4.2 and Visual C++ 6 because It perfectly suits my need.
But I will buy COM ATL 3.0 to learn a few things about COM/ATL
Thanks again,
JM
Web: http://goa.ifrance.com
|
|
|
|
|
It is true that MFC7 vs WTL is a totally different question that MFC4.2 vs WTL. For the longest time, WTL was the only method of getting all the new fancy UI without hacking up MFC. But that isn't the case anymore.
One big difference between MFC and WTL is that WTL doesn't try to force a design framework on the programmer. WTL doesn't have this document concept already built in. If you want documents, that is a negative. If you don't want documents, it is a HUGE plus. Also, WTL provides a much simplified internal message system. This has good points and bad. Personally, I found MFC's message system to be overly complex in an attempt to be idiot proof.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
NOTE: Almost the same question it's in the VC++ forum...
I want the equivalent to the code below (used in order to create an instance of a XML doc):
hrInstanciarXMLDoc = this->m_pxmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40)); but I don't want a new XML doc I need a new HTMLDoc.
PS:
I'm using the Paul Di Lascia's HTMLCtrl, it is not more than a HTMLView derived class that can be placed inside a dialog.
I need to create the new HTMLDocument because I want to write the information directly from memory inside the HTML page (this part is done and working well) the problem that I have is that I must create thenew document using the "about:" workaround (but it leaks some memory...)
Thank you in advance...
|
|
|
|
|
How about having an empty HTML document in your Resource file, loading that and then populating it with whatever your need. I'm doing stuff like this in a app I'm developing.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville Franks wrote:
How about having an empty HTML document in your Resource file, loading that and then populating it with whatever your need.
hmmm... sounds interesting. When do we get to see an article?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron wrote:
hmmm... sounds interesting. When do we get to see an article?
I have at least 6 ideas for articles I'd love to write, but when you work for yourself and therefore already work very long hours it is really, really difficult to find the time. That said it will definitely happen one day. For now I try and help folks out on the msg boards when I can, as my little contribution.
Creating and populating CHTMLView's etc. is quite easy to do. Have a look at: http://codeguru.earthweb.com/ieprogram/PKB.html[^]
If you want more info on this topic let me know.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
I am currently working on a application that supports a script language. This language has had numerous modifications and does not suffice anymore. I started to look around for a generic solution and after looking at TCL first I found about Active Script Hosting. I now want to implement my own Active Script Host but do have some questions about the supported languages and possibilities.
The application I'm working on has to be able to send data via several protocols, so I have to be able to easily assign (byte) buffers to my own objects e.g.:
Define cmd : Command
cmd.buffer = 00, 01, 02, 03, 04, 05, ...
Is it possible to do a similar thing in one of the support languages? Is there a preferable language that I should use (e.g. I read JScript support Arrays and VBScript does not)? Is It also possible to include other files into the vbscript/jscript script files?
|
|
|
|
|
1) You can create/add your own named objects. No problem there.
2) I don't think you can have something like
cmd.buffer = 00, 01, 02, 03, 04, 05, ...
but you can have:
cmd.buffer = "00, 01, 02, 03, 04, 05, ..."
or cmd.buffer = "00 01 02 03 04 05 ..."
or cmd.SendBuffer("00 01 02 03 04 05 ...");
>Is it possible to do a similar thing in one of the support languages.
Is there a preferable language that I should use (e.g. I read JScript support Arrays and VBScript does not)?
Most Com object can be used with any ActiveScripting languages. I always trying to keep it that way. If customers want to use Perl, Ruby - fine.
>Is It also possible to include other files into the vbscript/jscript script files?
VBScript, Javascript - no. Your host - yes. Your host can transform files before they submitted to scripting engine. ASP host converted
"abc" -> Response.Write "abc" &vbcr
|
|
|
|
|
When i compile my app for non XP systems, my registry functions all work fine. When i compilthem with WIN32_WINNT 0x0501 and ATLtheme.h included, it messes up. The only real difference i note is that the paths in the non-xp version are MS-DOS like (C:\win~1).In the XP version nothing get's written to the register at all. What should i do to make it work for both versions of my app?
this is the code i use:
<br />
char tFileName[MAX_PATH];<br />
CAtlString tAtlFileName,tAtlFileName2;<br />
<br />
HKEY hKey;<br />
RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run",0 , KEY_QUERY_VALUE, &hKey);<br />
<br />
HMODULE modhandle = GetModuleHandle(NULL);<br />
GetModuleFileName(modhandle,tFileName,MAX_PATH);<br />
tAtlFileName = tFileName;<br />
tAtlFileName2 = "\"" + tAtlFileName + "\"" + " /background";<br />
strcpy(tFileName,tAtlFileName2);<br />
<br />
RegSetValueEx(hKey, "Tim", 0, REG_SZ, (CONST BYTE *) tFileName, (int)strlen(tFileName));<br />
<br />
MessageBox(0,tFileName,"aan",0);<br />
|
|
|
|
|
i want to pass a HANDLE to a com dll.but how can i do this
thank you!
|
|
|
|
|
A HANDLE is just a number ( 32 bit, from memory, or maybe only 16 ).
The real question is, will it have meaning in the context of the COM dll ?
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|