|
|
thank you! i'll go implement that and report back with the (hopefully positive) result. now *why* have i not been able to find any mention of this while RTFMing? aargh =]
paul
|
|
|
|
|
ok, this worked (somewhat). the plan was to grab the properties i'm interested in from the propertybag and call the property setters (which in turn call the property setters for the controls i'm hosting).
the problem is that neither the hosted controls' nor even my window exist at this point. i got around this by setting a timer, calling the property setters in the timer callback and checking IsWindow() in the property setters. this works fine, albeit at the expense of messy code (some global variable nastiness).
is there a better way of doing this?
paul
|
|
|
|
|
Sample...
MixedWindow Compile Error... Help Me~
ImageList_Read, ImageList_Write.. =.=;;
--------------------Configuration: MixedWindow - Win32 Debug--------------------
Compiling...
StdAfx.cpp
c:\program files\wtl71\include\atlctrls.h(1832) : error C2065: 'ImageList_Read' : undeclared identifier
c:\program files\wtl71\include\atlctrls.h(1832) : error C2440: '=' : cannot convert from 'int' to 'struct _IMAGELIST *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\program files\wtl71\include\atlctrls.h(1943) : error C2065: 'ImageList_Write' : undeclared identifier
Error executing cl.exe.
MixedWindow.exe - 3 error(s), 0 warning(s)
-----------------
StdAfx.h
omission.... "<", ">"
-----------------
/ Add support for ATL/WTL
#define _WTL_NO_AUTOMATIC_NAMESPACE
#include atlbase.h
#include atlapp.h
extern WTL::CAppModule _Module;
#include atlwin.h
#include atlscrl.h
#include atlmisc.h
#include atlctrls.h
#include atlctrlx.h
#include atlddx.h
...
|
|
|
|
|
ImageList_Read[^] and ImageList_Write[^] are both defined in commctrl.h
You will need to ensure that the file is included before atlctrls.h
#include <commctrl.h><br />
#include <atlctrls.h>
Michael
CP Blog [^]
|
|
|
|
|
Thank you...
But...
#include atlmisc.h
#include commctrl.h
#include atlctrls.h
#include atlctrlx.h
#include atlddx.h
Same Error... ㅠ.ㅜ..
--------------------Configuration: MixedWindow - Win32 Debug--------------------
Compiling...
StdAfx.cpp
c:\program files\wtl71\include\atlctrls.h(1832) : error C2065: 'ImageList_Read' : undeclared identifier
c:\program files\wtl71\include\atlctrls.h(1832) : error C2440: '=' : cannot convert from 'int' to 'struct _IMAGELIST *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\program files\wtl71\include\atlctrls.h(1943) : error C2065: 'ImageList_Write' : undeclared identifier
Error executing cl.exe.
MixedWindow.exe - 3 error(s), 0 warning(s)
|
|
|
|
|
I've done a bit of a google for the problem and it seems to be a common issue.
try
#define VC_EXTRALEAN
#define WIN32_LEAN_AND_MEAN
#include <objidl.h>
#include <commctrl.h>
before the atl includes.
Michael
CP Blog [^]
|
|
|
|
|
Hmmm.. can't it be a too low value on #define WIN32_VERSION (or whatever that define is called)?
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Jörgen Sigvardsson wrote:
Hmmm.. can't it be a too low value on #define WIN32_VERSION (or whatever that define is called)?
Having look through the commctrl.h header, it doesn't appear to be a factor. But then Microsoft Headers aren't the best layed out in the world.
I may have a play when I'm on a machine with WTL installed, but I've not had this problem in the past.
Michael
CP Blog [^]
|
|
|
|
|
The problem is (obviously) that ImageList_Read and ImageList_Write are not defined. The reason they're not defined because __IStream_INTERFACE_DEFINED__ is not defined. This is not defined because ObjIdl.h is not included.
ObjIdl.h contains definitions for IStream, which is what the ImageLists are serialised to/from.
There may be some issues with the point at which you include the file, and you may have to a #undef _INC_WINDOWS at some point. There are foggy wisps of memory regarding this, but I'm not sure if it applies to this problem.
Hope this helps,
Phil
--
All things considered, you can't really consider all things ...
|
|
|
|
|
Hi,
1. I have to create a CStatic text and I need it to be without background. How can I do it? Can u write a sample code as simple as you can, please?
2. I have to create a CStatic icon (bitmap) and I need it to be without background. How can I do it? Can u write a sample code as simple as you can, please?
Answer this as fast as you can
Thank you veeeeeeeeeerrrrrrrrrrrryyyyyyyyyyy much
Greatfull,
Ajnstajn
|
|
|
|
|
Bad forum!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
How can I make my app just multiple dialogs instead of just the one that is defined in enum { IDD = * } ?
I want to make it so that the window (the displayed dialog ) changes when you press a button in the toolbar....
Any help is very welcome
|
|
|
|
|
You'll need to create a seperate CDialogImpl derived class for each dialog and then call them using the DoModal function, or hide the current window and show the new dialog.
Michael
CP Blog [^]
|
|
|
|
|
Please help me.
Let's say we have an COM interface IAppInterface from another application named App.
What I want to do is to create my COM class and implements the IAppInterface.
So I created a new ATL project MyObject, added a simple ATL object, and chose "Implement interface" from the menu.
But after building this project, I cannot see IAppInterface from MyObject. What's wrong?
I know I should do some thing in the .idl file. What should I do?
By the way, I'm using Visual Studio .NET 2003.
Thanks.
|
|
|
|
|
Hi, I would need a small help.
I have developed a static C++ library, in which a class APDU is defined.
Now I am developing an in-process server ATL whose class of implementation will have to
contain as variable member an object APDU.
Accordingly I would like, that the interfaces (what I am creating with the
wizard) they accepted as parameter an object APDU.
EXAMPLE
(We suppose that my server ATL has to print the content of an APDU)
I create my server ATL
(step 1)File--> New--> Project--> ATL COM App Wizard--> project name=server
(step 2) Server Type=DLL
I insert a new object ATL
Insert--> New ATL Object--> Simple Object--> Short Name = example
To this point I want to add a type APDU property to the file idl
Right mouse button-->Add Property
How do I do to make APDU appear the type in the curtain menu that show the
possible types??
Thanks
Anthony
|
|
|
|
|
> How do I do to make APDU appear the type in the curtain menu that show the
possible types??
You don't. Just type your type. All you have to make sure is that the IDL compiler recognizes your type. May or may not be easy.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Hi
I have a component implementing a proprietary protocol (say,
Protocol.dll)and does the communciation over serial port. I have defined ATL
objects for each type of packet, and nearly all has a property called
"description" which returns a BSTR.
One ATL object encapsulates the serial communication. So I can set the baud
rate, port number etc.
A connection point event is defined corresponding to each packet that may
arrive to the PC (from the device). Say ProtocolPkt1, ProtocolPkt2,
ProtocolPkt3 etc.
Now we typically use 2 serial ports. One that does proper protocol
communciation and another that dumps trace staements. To take care of the
trace statements I have one event defined (LogData) in the same event
interface described above.
I have an application (say Mainwindow.exe) that uses the above component,
connects to both the ports and has separate event sinks to handle the 2
ports separately. The protocol data and the log data coming from the 2 ports
are to be shown in separate windows. Whenever an event notifies that log
data is received it is simply dumped in a window. Whenever any event
notifying any of the protocol packets is received, the corresponding packet
is created from the bytes received in the event, interpreted and displayed.
Now onto the problem. When some protocol packets are received, the
description property has to be called. When both the ports are connected the
log data comes fine. But when the description property of say ProtocolPkt1
event is called, the BSTR returned is prefixed with some log string that
came in the LogData event. Further the application displays a crash when it
is closed.
Some more observations.
1. This does not happen when the BSTR returned is very short. Typically only
when the string returned is long and computed in some for loop, does this
corruption occur.
2. This does not happen when I use the debug version of Protocol.dll.
I hope I have made myself clear. If any information is required please let
me know. Any pointers that can help me proceed would be greatly appreaciated
Thanks
aby
|
|
|
|
|
>> 2. This does not happen when I use the debug version of Protocol.dll.
Have you tried looking at this article Surviving the Release Version?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Make sure that the code that fires the event manages the life time of the BSTR.
I suspect that the first client is releasing the BSTR and hence ur second client sees garbage.
For events and BSTR the caller allocates and frees the bstr. if u are using _bstr_t always pass a copy to the event( bstrVar.copy())
Hope this helps..
prashu
|
|
|
|
|
Hmm.. never send a copy of a BSTR to a COM method. That means that the method is responsible for cleaning up the string. This however is against COM rules, as [in] parameters MUST be managed by the caller. If the string has to be marshalled through the method call, then the string passed in will be lost (memory leak), and the callee will free a bstr which it does not own (the marshaller owns it).
Thus, if you are using a _bstr_t or a CComBSTR, pass the BSTR pointer (or adress of if passing as an [out] argument) managed by these classes.
[in] parameters are managed by called
[out] parameters are allocated by callee, and passed for ownership to caller
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Hi!
I recently upgraded from VC 6.0 to VS.net 2002. I am using WTL v7.0. I created a simple modal dialog application and added a web browser control to it. The compilation was successful but the application refuses to create a dialog. Can anyone tell me what I should do to get my app up and running?
After this happened, I created a similar project in VC 6.0 and it seems to work well there.
When I open the same project (that I created in VC 6.0) in vs.net 2002 and convert it to VC 7.0 project and compile it, I get a problem
hRes = _Module.Init(NULL, hInstance);
I replaced this piece of code with
hRes = _Module.Init(NULL, hInstance, &LIBID_ATLLib);
I presume this is because of some ATL incompatibility?!
Can anyone please help me with this?
Thanks!
Ram
|
|
|
|
|
Hi,erveryone, I don't know how to debug my asp component,Can you help me ?Thanks!
|
|
|
|
|
You need to register the DLL in MTS or Component Services first. I will assume you are in Windows 2000/XP so I'll refer to those. Using MTS, the procedure is analogous.
1.- In Component Services, right click on the Application containing your component. Click properties.
2.- Copy the Application ID to clipboard
3.- In Visual C++ with your component project opened. Go to Project Settings.
4.- Be sure it is selected Debug configuration. Go to Debug Tab.
5.- Under "Executable for debug session:" write:
C:\WINNT\system32\DLLHOST.EXE (obviously the path should be the path where DLLHOST.EXE file is in your system)
6.- Under "Program arguments:" write:
/ProcessId:{the application ID you previously copied to clipboard}
7.- Now place a breakpoint where you want to start debugging
8.- Run the component (you will be warned that DLLHOST.EXE doesn't have debug information... just click OK)
9.- Run your ASP Page. When the breakpoint is reached, Visual C++ IDE will be activated for you to continue debugging your component as any Visual C++ program.
10.- If you make changes to your component, you may need to shutdown the component services Application before you can debug it again.
I hope this helps
Jaime
|
|
|
|
|
Hi,
I am developing multithreading COM EXE server. In one of the methods I have called CoCreateInstance, which is made threadsafe by using CSingleLock(&(oneMutext)). After some time of server starts, this CoCreateInstance raises an exception. Also heap get corrupted at this instance.
Can anybody help me in resolving this issue.
Mandar
|
|
|
|