|
now,i have the very problem!i found many stuff but can't resolve it!
i want to change the color of toolbar,or change the whole frame
|
|
|
|
|
I found an article on CP, "How to write a Super compact Super Fast C++ Dll for Visual Basic" which explains how to use ATL to create a DLL.
When I use the VS 2005 AppWizard to create an ATL DLL, it ends up creating a lot more files in the Solution Explorer than are present in the sample project from the article I mention. For example, after using the AppWizard I end up with the following in the Solution Explorer Treeview:
http://img130.imageshack.us/img130/5752/testatldllsolutionexplorer1hn.png[^]
whereas the sample project only has the following in the Solution Explorer Treeview:
http://img442.imageshack.us/img442/7792/tvb4jn.png[^]
I'm guessing the difference is probably because the sample file project was created in VC++ 6.
In the example project, the automatically created functions:
DllCanUnloadNow
DllGetClassObject
DllRegisterServer
DllUnregisterServer
have been commented out in tvb.cpp and the entries removed from tvb.def, but in the VS 2005 project they are not commented out and the entries are still in the .def file. The sample project also has the following line commented out in tvb.idl:
//import "ocidl.idl"
What does this line do, and what does the line import "oaidl.idl" do ?
All I want to do is create a DLL which exports my own functions. For example, AddTwoInts(int a, int b).
1) Of the automatically generated files from the VS 2005 ATL AppWizard, what can be safely deleted ?
2) Once that's done, do I only need to add the following to the end of ATL_Test_DLL.cpp
extern "C"
{
int__stdcall AddTwoInts( int a, int b )
{
return( a + b );
}
}
followed by adding the following to the end (ie. after the line with "EXPORTS") of ATL_Test_DLL.def
AddTwoInts
Do I need to do anything else ?
|
|
|
|
|
Hi all,
I have written a plugin to IE. Now I want when user press "Enter" key or click on "Go" button, my plugin will catch the URL on the Address Editbox. How can I do that?
Thanks,
Hung
|
|
|
|
|
|
Thanks Mike,
I have done successful.
Now I want my plugin can return the data for IE window to show on the IE window.
BeforeNavigate2()
{
//Code to redirect to my page and get the content back from the server
......................
//How can I show the content on the IE Window ???
}
Thanks in advance,
Hung
|
|
|
|
|
Hi,
In an ATL COM+ application how do I instantiate a well-behaved COM+ object marked as noncreatable?
I read that when instantiating COM+ applications the right way to do it is using the IObjectContext::CreateInstance rather than using CoCreateInstance. However neither is available when using noncreatalbe objects.
If I do it using CComPtr will the object be created in the current context and therefore be well behaved?
Thanks.
|
|
|
|
|
Hi Friends,
These days i am going through the nice artciles of the ATL Under Hood.
Can anyone of u please have a look over the Program no 28 in the following link http://www.thecodeproject.com/atl/atl_underthehood_2.asp[^]
and give me the reason for different outputs in different modes(Debug / Release).
Though some explaination is given i am unable to understand.
Thanks in advance.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
|
hi friends,
i got Different Problem.
i created one Dll(win32 application). i create one project and put main().
#include "ini.hpp"
int main()
{
char *cp,*cp1;
Config Objcon("../","rrr.ini");
Section objsec = Objcon["server"];
cp=objsec["ip"];
cp1=objsec["port"];
cout<
|
|
|
|
|
bujji_bec wrote: char *cp,*cp1;
bujji_bec wrote: delete []cp; // this one giving problem
delete []cp1; // -----------do----------
Use
delete cp;<br />
delete cp1;
Maxwell Chen
|
|
|
|
|
i tried that one and also used Free also. i am Getting Same problem
b.raju
-- modified at 1:47 Monday 22nd May, 2006
|
|
|
|
|
bujji_bec wrote: int main()
{
char *cp,*cp1;
Config Objcon("../","rrr.ini");
Section objsec = Objcon["server"];
cp=objsec["ip"];
cp1=objsec["port"];
cout<<cp<<"\n"<<"cp1;
delete []cp;="" this="" one="" giving="" problem
delete="" []cp1;="" -----------do----------
}<="" blockquote="">
bujji_bec wrote: i am Getting Same problem
According to the code in the original post, Section::operator [] (LPCTSTR token) allocates some buffer internally. The implementation inside this operator matters how memory is released (by delete ).
Do you mind posting the body of Section::operator [] (LPCTSTR) ??
Maxwell Chen
|
|
|
|
|
Why do you repost your question again ? What was the problem with the answers we gave you here[^] ?
I explained you that you cannot allocate memory in the dll and release it in your program. And furthermore, you don't give any information about what you do in the dll.
What is this class Config ?
Cédric Moonen
Software developer
Charting control
-- modified at 5:43 Friday 19th May, 2006
And also, this is the wrong forum.
|
|
|
|
|
hi friend,
acutally in dll, i am Reading .ini Files. passing Strings or Char pointer and also retrieving Strings or char pointer.finally i delete that one. that is my problem.
sudha
-- modified at 1:45 Monday 22nd May, 2006
|
|
|
|
|
bujji_bec wrote: int main()
{
char *cp,*cp1;
Config Objcon("../","rrr.ini");
Section objsec = Objcon["server"];
cp=objsec["ip"];
cp1=objsec["port"];
cout<<cp<<"\n"<<"cp1;
delete []cp;="" this="" one="" giving="" problem
delete="" []cp1;="" -----------do----------
}
in="" the="" program="" output="" coming="" correct.="" but="" delete="" its="" memory="" issues.<="" blockquote="">
I'm assuming that your Config object is defined in your DLL? That being the case, your memory is being allocated in the DLL's memoryspace, and you are trying to delete it from the application's memory space. This will cause an exception and will crash your application.
To avoid this, you have 2 options:
1) Add a method to your Config class to clean up memory it allocates. This will basically turn it into a factory for the objects it creates (what is made in the factory is also deleted in the factory).
2) Use Boost's/TR1's shared_ptr class to wrap your pointers. This will prevent this problem completely without you needing to call delete at all. Note that to do this, you should modify your DLL to return shared_ptrs.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
He asked this question already some time ago and the answer was the same as yours.
Anyway, the point is that it leads to an interesting discussion about this fact that the program will crash if you release the memory allocated in your dll from your exe. It appears that the problem arise only when both projects link to different run-time libraries.
the discussion starts here[^].
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Ah, so he did. Strange why someone would ask the exact same question 2 days in a row. Most of the answers in the previous thread were accurate enough to tell him not to do it that way.
There are many issues that factor in when someone tries this (too many to list). Suffice it to say that it doesn't work far more often than it does, and in either case, it is bad practice to free memory that was allocated by another module (simply on software engineering practices).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello friends,
I am creating edit control at run time in WTL.
i written following handler for edit control.
NOTIFY_HANDLER(2500, EN_CHANGE, OnUpdateEdit)
LRESULT OnUpdateEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
but i am unable to capture change event of edit box, means this function never execute.
|
|
|
|
|
|
Hi,
What is the CCustomDraw class used for? Can anyone explain why it is specifically used? It has methods like OnItemPostPaint, OnItemPrePaint. What are these methods?
Thanks...
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
|
Hi Michael,
Ofcourse I read all your WTL series. One of the best that I have read.
But my question is, When do we use COwnerDraw and when do we use CCustomDraw ?
Thanks for taking the time to answer my question.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Ownerdraw is for when you want to draw the whole thing, like a customised button. Custom draw only works with some controls, such as ListView. Basically, if the control sends NM_CUSTOMDRAW notifications, you can use Customdraw with it.
Steve S
Developer for hire
|
|
|
|
|
hello friends i have 3 edit boxes in dialog.
i want to apply Undo management on these controls.
can someone help me.
Thanks
|
|
|
|
|
I want to Create another Application with CreatProcess API, when my Windows Service will be started. Problem is that Application's WM_PAINT is not called.Anybody, can tell me
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
CreateProcess(L"D:\\TestingApplication\\DialogTest\\Debug\\DialogTest.exe",
0,0,0,false, CREATE_DEFAULT_ERROR_MODE,0,0,&siStartupInfo,&piProcessInfo);
Musharraf Hussain
|
|
|
|