|
Hi to everybody.
I have used a Regular DLL in VC++ (ver 6.0) but i have some problems when i use the object.
I have create a new object:
"CObOggetto*pOggettoDaRibaltare = new CObOggetto;"
but when i try to use the variables into the object ...
pOggetto->m_sCodiceContratto = "000001";
the application crash like a the pointer is not allocated!!!
The variables are all CString.
Can you help me???
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
Sorry!!!
The code are this:
"CObOggetto*pOggetto = new CObOggetto;"
but when i try to use the variables into the object ...
pOggetto->m_sCodiceContratto = "000001";
Can you help me???
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
You will need to give a lot more information. The fact that the object is created and used within the DLL is not a problem. So, make sure that the object is not destroyed after you allocated it and that you are manipulating the same object.
Could you post some more relevant piece of code ?
Just a guess: is this pOggetto variable a member of another object, or is it local to a function (created, used and then destroyed at the end of the function) ? I would guess that you are declaring a class variable and then creating a variable with the same name in a function (which of course would leave the class variable unitialized).
|
|
|
|
|
Can you debug and check if pOggetto is NULL?
|
|
|
|
|
Hi
Yes. The pointer is null.
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
It is crashing because the program is accessing a member variable by using a NULL pointer. So, the question is why new is returning a NULL pointer. Is the class constructor is trying to allocate a very large block of memory which the system cannot satisfy?
Can you check (debug into) CObOggetto's constructor and see what it does?
|
|
|
|
|
Hi, first of all, you can edit you first message to correct possible errors, instead of adding a new message.
On the other hand...
Why are you using the "" when you create the pointer? Is it a typo? Or are you really using them in your code?
I recommend you to take a look onhttp://www.codeproject.com/KB/DLL/[^]
This user[^] wrote a serie of articles around DLLs that I found quite usefull, check it out as well
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Ok! Next time i'will edit the message to correct.
For the other hand..
In the project i go to "Insert new class"
Class type : Generic Class
Name : COggetto
Derived from: CObject As Public.
In the .h file i put my variables (are 2 CString)
The in the .cpp i put my code:
COggetto* pOggetto = new COggetto;
pOggetto->m_sCodice = "000001"
When i'm in running i see that the pointer pOggetto is created after the "new" but on the instruction " pOggetto->m_sCodice = "000001"
the project crash.
Thank's for your time!
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
Do you mean pOggetto is a valid pointer (Did you check with the debugger?)?
How is declared m_sCodice ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes.
m_sCodice is a CString. Ther is another varibles is a m_sDescrizione also a CString.
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
Lazzari Patrizio wrote: Yes.
You said here that such pointer is NULL .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
that's ok.
I see on quick watch that the variables on the pointer are null.
Sorry for my statement!
Hi! I'm very happy to talk with everybody about VC++.
|
|
|
|
|
If pOggetto is null then you should discover why it is such.
Could you use the debugger to step inside the object constructor?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you post the beggining of your both COggetto.cpp and COggetto.h (I mean the section of variables, constructor, destructor, operators... but without possible member functions done/added by you)
When you use the Wizard to add classes, it implements some standard things, but most of the times you need to add/modify part of them in order to get your class working ok.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Could you please post the actual code (either the CobOggetto constructor and the pOggetto initialization) using the code block button?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i am using URLDownloadToCache method, also implemented my own class class CBindStatusCallbackImpl : public IBindStatusCallback for call back and bindings...
i read in the MSDN that in order to support proxy handling i need to handle IAuthenticate and the method Authenticate...problem is i don't know how ?
couldn't find any example code for that
can any1 help me?
i am desperate
thanks in advanced
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
this is likely way more complex than you want - but its the only thing I can remember that Ive seen supposedly do it
http://vbmhwb.sourceforge.net/[^]
search for WBAuthenticate on the page
'g'
ps.. Im hoping it shows you the general method, Im not suggesting you can use the actual code here
|
|
|
|
|
thanks a lot for your answer...
i couldn't find in the site you gave where to d/l the code that implements the WBAuthenticate...can u direct me or give me direct link please
thanks again
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
its a sourceforge site - try googling for
vbMHWB ActiveX Control
and see if you get a hit - I just checked the link and it works for me
'g'
|
|
|
|
|
ok now i know which link to press
thanks again
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
cool, now, download vbMHWB.zip, unpack it and look at vbWB.cpp, searching for WBAuthenticate
'g'
|
|
|
|
|
your example helped me a lot and now it works 100% so thanks for that
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
One more thing if i may...
i was able to work with IAuthenticate implementation (the method 'authenticate' did the trick)
problem is that the actual authentication occurs only once, and if the user and password are incorrect i don't reach the method 'authenticate' again.
what am i missing wrong here?
thanks again
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
I would have thought you'd have to resend the http request again - but Im no expert
'g'
|
|
|
|
|
one would thought that when user name and password are incorrect either in the callback would return proxy_authenticate_error or authenticate will be called again
ok i will dig more into it
thanks again
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|