|
Or, the common refrain for large projects and pointers?
I am working with some licensed software, so some type/function names are abbreviated as <ObjName>.
void success( const <ObjName>& fir_)
{
firtemp = new <ObjName>(fir_);
std::ofstream firOut;
firOut.open( firFile.c_str(), std::ios::binary|std::ios::out|std::ios::trunc);
firOut << *firtemp;
firOut.close();
}
This is a member function of a class (it is defined inline here) which has a member variable
<ObjName> * firtemp; . firFile is a file-level const string variable.
The licensed software object <objName>> does provide an overloaded definition for the "<<" operator, and the example I'm following uses it in exactly the way I use it above to save the firtemp object to a file.
When I attempt to run this code, the firOut << *firtemp line results in a memory access violation which is fairly consistent ... it moves around very little, as in < 16 bytes or so.
One of the things i've noticed while trying to debug this error is that when I set firtemp as a watch (I'm using VS2005), and set break points at the start of the function then step through ... the value of firtemp changes wildly. Is this expected? Also, if I insert a cout statement for the value of firtemp, it does not agree at all with the value the debugger gives ... again, I'm not sure what to expect here.
Now, in the "Autos" field in the debugger, the "this" parameter has its value in red text for most of this function call ... is this normal? If not, what does it indicate? I searched online and could find no references for this simple question.
Primary Question: Is there anything obviously wrong with what I'm doing here, or is the error having to do with the licensed code/my interface to it? Any hints for trying to find the error, if it is in my interface?
|
|
|
|
|
Don't know if this will help, but why are you creating firtemp on the heap? I would try creating a stack based variable and see what is going on.
|
|
|
|
|
A good question - the example is doing it because there are other member functions that might want to access the object and there is no default constructor for it, so you can't easily have a member variable of the actual object type ... having a pointer is comprise solution.
However, for my useage this is not needed, and I did rewrite it with a local variable/stack allocation. Unfortunately I get exactly the same error. What I may not have noted in the original post is that I can definitely write to the file this attempts to write to, and I can access other member functions of the object, for instance a size() function, with no errors.
|
|
|
|
|
Ok, let's say that we have an application that supports DLL calls, and on every routine call to the DLL, the application's main handle (HWND) is passed.
Example:int __stdcall TheFunction(HWND mWnd)
Now, let's say that the application has a dialog that I want to modify (IE: Change the caption or coloring of text inside an edit box within the dialog). How would I go about gaining control of the dialog handle?
There is no "resource" file for the program, but I have already acquired the dialog ID and control identifier as well, which is located at: http://pastebin.com/ffbc560f
Dialog ID: 740
Control Identifier: 300
|
|
|
|
|
You'd need the application to cooperate, I think. It needs to give you the chance to subclass the dialog (not going to happen without the apps help, one way or another).
Even hooking into the resources won't help - the dialogproc isn't coded in the resources.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Ahh, thank you "Subclassing" is the term I was actually looking for.
|
|
|
|
|
Hi
I am unable to install platform SDK on Vista Operating System.
Each time a information bar is populated when i click on Default.htm file .
Is there any other way to Install Plateform SDK . I have used many hit and trial methods .
I have posted a query previously in the same forum . Naveen sir has suggested that Choose 'Run as administrator'.. I have also tried but same information bar which we normally see when a website tries to install some active x on computer . The information message displays 'Your security settings do not allow website to use Active X Controls installed on your computer. This page may not display correctly'.
I have clicked on this bar and done same changes in my security setting as seen in more information option .But still i am not able to install Plateform SDK..
Please tell me some way to overcome this problem..
'
|
|
|
|
|
How exactly are you trying to install the SDK and which one? I just recently installed the latest platform SDK and didn't have to do anything with default.htm, and in fact can't understand were you would have to. The download comes in ISO form and is about a 1.3GB file. You simply mount the iso with PowwerISO or something similar and run setup.exe.
Dustin
|
|
|
|
|
I am trying to install
Windows SDK Windows .NET Server 2003 RC2 (October 2002). I am having an installation folder which contains diffrent html files , for starting the setup i clicked on default.html file which is suppose to install the whole setup displaying page by page information . The size of my installation folder is 570 MB ..
I have previously installed this platform sdk but on xp operating system..
|
|
|
|
|
I m using SQL Server 2000 as my database.I would like to know what parameter should i pass as Provider in my Open( ) function. ?
hr = m_pConnection->Open(_bstr_t(L"Provider=(WHAT PARAMETER);Data Source=C:\\Program Files\\Microsoft SQLServer\\MSSQLDataLibDB.mdf;"),_bstr_t(L""),_bstr_t(L""),adModeUnknown); 
|
|
|
|
|
See here [^].
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]
|
|
|
|
|
Hi,
I noticed MFC implementation of sockets provides notification thru messages
I have a modless CDialog that needs to make use of TCP/IP services
can I use this CDialog's Message Map to receive the TCP/IP messages
Also rather then have it or a pointer to It (it being the CAsyncSocket Class or
probably my deravation of it as I would like to sprouse it up a bit)
I would like to use it as a Base Class even though there really isn't any
relationship between my CDialog and my implementation of CAysncObject
outside of the fact that I need a CWnd Class for messages
I welcome your critique('s) as that is a way I learn
|
|
|
|
|
ForNow wrote: I would like to use it as a Base Class...
Why? What other methods or properties do you need?
ForNow wrote: ...even though there really isn't any relationship between my CDialog and my implementation of CAysncObject...
There likely is a "has-a" relationship (rather than a "is-a" reelationship mentioned earlier).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
To answer yor first question
for the CAsyncSocket type object I would like to add a buffer of char or TCHAR type
for the data that is being received
Any for the second question
I guess dervation of classes isn't not mean to be a "glue" meaning if a object
just needs use of a Class but has not relationship it should be made a member
truth is since you are taking your valuable time to answer (I mean not being
facetious)
I should give a better overview this Windows MFC app is communacting with a) Console
application b) A program on a different platform (non Windows)
For first (Dos Console) I Created a Object of type CWinthread and use Named pipes
to Communicate
For (b) seems like TCP/IP is the unversial Language
MFC implmentation is CAsycSocket truth is I would like to run this (this "not
instance" just a joke, but this CAysncSocket type object as a Seprate thread
with the currently running Cdialog receving the notification messages
I guess if a create a Thread that uses messages I have to use those DYNCREATE macros
thankx again
|
|
|
|
|
ForNow wrote: ...this CAysncSocket type object as a Seprate thread...
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thankx
A couple questions is passing a object as a parm dangerous only to C"Async"Socket
objects
but if were to to pass a object if another type it would work say um.... CEvent
Object
BTW
the MainFrame has a similar Concept
After Accetping a connection there is a GiveSocket API to give the socket to the
Subtask or Subthread
|
|
|
|
|
or ??? is any object that has am Attach() method dangerous to pass across thread boundries
|
|
|
|
|
ForNow wrote: ...is any object that has am Attach() method dangerous to pass across thread boundries
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
much thankx
Let me a) repeat to see it if I understand
b) say how I will implement my solution
First
After creating the Object e.g. CAsyncSocket mytcpip;
attach(socket) will actually populate the Object this is typically
a first time thing
::FromHandle will get a pointer to the Object CWnd* etc...
My implementation for my TCP/IP connections
I will create the CAsyncSocket object in the Dialog Class method
Create the socket
then Create a User Interface Cwindthread (with a message pump, no need for a Cdialog class all I need is something that has a message pump)
which will attach(socket)
and do send and receives
And let My Cdialog class know when I receive data
thankx again
|
|
|
|
|
I m referring to a tutorial book of database using ADO.
The problem is i have to get the result displayed in CListCtrlEx for which the tutorial book says i have to copy three files-CtrlExt.cpp, CtrlExt.h,
and CtrlExt.Inl-from the DAOVIEW example into the source code directory for my application.
I serached for these 3 files in the VC98\MFC\SRC\
But i could find the files there...so i even tried to download the files to the above folder and then added them to my project but still i get the
error : CListCtrl undeclared identifier
error : Cannot open the file CtrlExt.h
How do i use this CListCtrlEx class so that i can add columns and data to the client application ?
BackGround : Its a MDI with ListView as Base class .
Kindly tell me stey by step process to get rid of this error and use the CListCtrl class.
I m badly stuck here...Help!!
Appreciate your time.
Thanking in advance. 
|
|
|
|
|
You've got several things going on here. Trying to do them all at once might not be your best bet. I would suggest first getting familar with a list control (in 'report' mode) and the related CListCtrl class. When you are able to add columns and items, then start looking at the CListCtrlEx class and the extra features that it offers (you may find it altogether unnecessary). That class can be found here.
There's also the issue with reading records from that database. That is an exercise in itself. You might want to start here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I m already through the CListCtrl class .With those classes i simply created a OnCreate Message Hnadler and created a ListView .There i had to add columns using InsertColumns()...Y here for CListCtrlEx do i have to add files to my project and still it is not working.As a matter of fact i do not even have the files mentioned above, in my DAOVIEW example.
Why is it so ?
modified on Wednesday, May 13, 2009 1:37 AM
|
|
|
|
|
I am using VS2008 on XP and I'm having trouble with the debugger fully terminating the process of my application after I am done debugging. Basically, the machine still thinks the exe is running so that I or the compiler cannot delete the file, leaving me unable to recompile. The problem seems to happen at completely random times and I am not able to reliably reproduce it. I have run ProcessExplorer and can see when the devenv starts the process and seems to release it. It does not appear to be running anywhere else.
The program is fairly small (few hundred lines) and deals with writing a few things to the registry and logging events with the NT event log.
I'm recently upgraded to VS2008 (new program though) and have never had this problem before. Any insights or troubleshooting tips would be appreciated.
Thanks,
Dustin
P.S. Rebooting obviously fixes the problem, but I can't afford to do that 10 times a day.
|
|
|
|
|
Are you able to delete the file manually in such situations....?
|
|
|
|
|
No, it was completely locked.
However, I just figured out the problem. Apparently, after you open an event created be the application the event viewer opens the exe to access the message resources in the file. I didn't figure this out before because simply having the event log open doesn't cause the problem, you must open the actual event. The event viewer remains in control of the exe until the whole thing is closed, not just the event. I was sure I tried that before but I guess I didn't.
Thanks anyways,
Dustin
|
|
|
|