|
Joan Murt wrote:
RELATED QUESTIONS:
- Why do I need to change the contructors...
You want to call the base class constructor at the construction of the page. This way, every class in the hierarchy gets its turn to look at the parameters involved. Only Heaven (and maybe the programmer) knows what information it needs from the parameters, but fact is that CPSAutoRedimensionable in turn will have to call the ctor of CPropertySheet with these parameters.
Joan Murt wrote:
what happens to the dialog resource that's asked in the creation of the new class?
EveryPage has something like
enum { IDD = IDD_PROPPAGE_ASSAY };
in its header file. In the code file IID is handed over to the CPropertyPage ctor, which in turn loads the resource.
Joan Murt wrote:
In VC++6 when you make a new class that's a CPropertyPage, you must tell which dialog resource will it use...
If I don't know which I will use, what do I have to type there?
Normaly, I work the other way round: I create a page with the resource editor and after it looks like my design, I let the code wizard produce a class for it. The resource can be freely modified afterwards, but the connection to the class remains (via the resource name in the enum-statment above).
|
|
|
|
|
Hi Joan,
Steps 4 and 5 are right, but do not suffice: additionally, you've got to replace CPropertySheet with CPSAutoRedimensionable everywhere where CPropertySheet appears, notably in BEGIN_MESSAGE_MAP .
As for why you should change the ctors, it's basic inheritance stuff: a derived class is responsible to call ctors of its base class(es) (except if the default ctor applies); as you've changed the base class, this has to be propagated to the ctors as well.
what happens to the dialog resource that's asked in the creation of the new class?
Property pages are nothing but special dialogs embedded into a property sheet. As dialogs, they must be attached to a dialog resource. If this is not very clear to you, look for some tutorial on property sheets.
Also, I'd like to recommend you Erwin Tratar's Layout Manager for Dialogs, Formviews, DialogBars and PropertyPages
[^], which turns managing resizing into a child's play.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I've created a project and link is statically with MFC. (I always prefer to link statically with MFC so that i can easily survive from distributon problems).
Well, now i want to make few enhancements in this project. For this purpose i've reated an "Extension DLL". But what documented is that Extension Dlls must be linked dynamically with MFC. Suppose i use this dll in my project that is already linked statically with MFC, then do i need to distribute MFC dlls with this project ???
|
|
|
|
|
MFC Extension DLL is an add-on for MFC DLL, it requires it by design. You need to distribute the MFC DLL with your extension DLL. Also it's not good practice to use statically linkëd app with the extension DLL - you should link your main app with MFC dynamically if you are using MFC extension DLLs.
Pavel
Sonork 100.15206
|
|
|
|
|
Not if you still have MFC statically linked.
Also, it is possible to convert DLLs to LIBs (can't remember the name of the tool offhand) which can simplify matters even though it meants the .EXE file gets larger.
Elaine
Would you like to meet my teddy bear ?
|
|
|
|
|
According to MSDN:
Because the new block can be in a new memory location, the pointer returned by realloc is not guaranteed to be the pointer passed through the memblock argument.
Does this mean I have to manually delete the previous pointer or will this stomp on the memory just allocated...?
I'm thinking freeing the previous pointer would cause serious problems...but i'm unsure...
Could you fill me in please...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
You have truncated the text where it says the buffer is potentially reallocated, which means a balance free.
Now you have the CRT code, in realloc.c, it executes this :
if ( (retp = _malloc_base(newsize)) != NULL ) {
memcpy(retp, pblock, oldsize);
_free_base_lk(pblock);
}
Which is the answer to your question.
There is also another way of seeing whether the previously allocated block has been freed or not : the dummy characters. In DEBUG mode, your block will be filled with either of these :
<br />
char _bNoMansLandFill = 0xFD; <br />
char _bDeadLandFill = 0xDD; <br />
char _bCleanLandFill = 0xCD; <br />
In your case, that's DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD.
How low can you go ? (MS rant)
|
|
|
|
|
So in laymen terms, thats a NO...i don't have to free the previous pointer...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Exactly.
I wanted to have a neat post about that, so to reference it whenever someone ask the same question. That said, I am pretty sure next time I'll have to rewrite the whole sh*t again.
How low can you go ? (MS rant)
|
|
|
|
|
I use Spy++ "window Search" dialog. I drag and drop mouse pointer over target window. In result Spy++ shown me the handle of window, caption and class name.
Suppose I got class name like "sysListView32". Now i want to know that which system dll is exporting this class. How can i find that ??
|
|
|
|
|
Well Spy++ won't help you there. I think your best shot is to check MSDN - I think in this case it's commctrl32.dll (not sure about the spelling though )
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Class shown in Spy++ is result of RegisterClassEx call made when window is created. This is not class exported from Dll.
|
|
|
|
|
Hi, This is a problem about DLL and EXE. The DLL was past debugging and made a *.dll and *.lib. Everything is wrong in Exe.
In DLL:
First, I made a class named CDecoder.
Inside it I declare member m_FormatTable
CFormatTable m_FormatTable;
I followed wizard to make a class CFormatTable which wrapped a table named "Format" in my database.
CDecoder's member function Initialize() use CFormatTable to load necessary data from the database.
In Exe,
I wrote:
CDecoder Decoder;
Decoder.Initialize();
and got the following:
------------------Configuration: HydroExe - Win32 Debug--------------------
Linking...
Creating library Debug/HydroExe.lib and object Debug/HydroExe.exp
Decoder.obj : error LNK2001: unresolved external symbol "public: __thiscall CFormatTable::CFormatTable(class CDatabase *)" (??0CFormatTable@@QAE@PAVCDatabase@@@Z)
Debug/HydroExe.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
HydroExe.exe - 2 error(s), 0 warning(s) What's wrong?
Extreme programming. Do the No.1
|
|
|
|
|
Did you export the class CFormatTable from the DLL ?
Check out
|
|
|
|
|
Link did not show up
http://www.codeproject.com/dll/dllexport.asp
|
|
|
|
|
I am getting a wierd error and I think it is because something may be declared wrong, I guess I am just not sure where: Any clues?
Inside header file:
friend ostream &operator << (ostream &, ListNode &);
Inside .cpp file:
ostream &operator << (ostream &strm, ListNode& *Node)
{
while(Node != NULL)
{
...
}
return strm;
}
Errors:
<br />
--------------------Configuration: records - Win32 Debug--------------------<br />
Compiling...<br />
records.cpp<br />
C:\Documents and Settings\User\Desktop\cs208\hw6\records.cpp(101) : error C2061: syntax error : identifier 'ListNode'<br />
C:\Documents and Settings\User\Desktop\cs208\hw6\records.cpp(102) : error C2805: binary 'operator <<' has too few parameters<br />
C:\Documents and Settings\User\Desktop\cs208\hw6\records.cpp(104) : error C2065: 'Node' : undeclared identifier<br />
Error executing cl.exe.<br />
<br />
records.obj - 3 error(s), 0 warning(s)<br />
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
It seems like the compiler doesn't recognize the ListNode type. Make sure that you have included the header file that contains the declaration for ListNode.
- Anatari
|
|
|
|
|
Anatari wrote:
Make sure that you have included the header file that contains the declaration for ListNode
This is in the same file that the implementation of the list exists.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
in the line:
<br />
ostream &operator << (ostream &strm, ListNode& *Node)<br />
are sure you didn't mean to write:
<br />
ostream &operator << (ostream &strm, ListNode& Node)<br />
Just trying to help even if i'm way off =)
- Anatari
|
|
|
|
|
Anatari wrote:
Just trying to help even if i'm way off =)
I still get the same error.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
I'd concur that a reference to a pointer is a bit funny. What is a ListNode ? Have you tried putting class ListNode; above the operator ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
Have you tried putting class ListNode;
Nope, but just did....AND IT WORKED! What is the purpose of doing a forward reference here? ( please explain ) I also switched it so that it was only passing a pointer not a reference to the pointer (it's getting late ). Thanks Christian.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Hi,
I'm trying to get the address of the windows proc of a running application using:
WNDPROC AppWndProc = (WNDPROC)GetWindowLong(m_hWnd, GWL_WNDPROC);<br />
DWORD errVal = GetLastError();
The call to GetWindowLong fails (returns null) and the value returned from GetLastError() is 5, which is an access denied result.
I'm not sure if i'm missing something, but how is it that this application is preventing me from getting this address ? Is there some way to prevent people from using GetWindowLong ? I want to subclass this app so that when a user moves it i can be notified as well.
Thanks
|
|
|
|
|
Are you in a separate process? If so you will need to do something else to get your DLL loaded in their process. Any address that is returned to you by this function will only be valid in the process that contains the window.
Your problem may be related to that fact, but I am not certain.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi,
I posted this before, but no one responded.
I'm new to C ++/mfc and I'm trying to modify a chat program to have the capability to transfer files as well as messages.
I found help from with code to send the file from this forum, but when I implemented it, I keep getting an error, "Unknown error while accessing unnamed file".
I put a button on the client side, and when the person clicks on it, the file dialog box is supposed to open, and the person can choose the file to send.
I get the dialog box, but I get the error right after I choose the file.
I put messages throughout the code to see where the program has reached, and it seems to be going through fine! It's also reading the data!
I'm really confused!!
I'm pasting the code below. If anyone has any idea what I'm doing wrong please respond.
-------------------------------------------------
void CMainFrame::OnSFile()
{
MessageBox("File Transfer");
CSocket cSocket;
cSocket.Create();
cSocket.Connect((LPCTSTR(m_strServerIP)),m_iFTPort);
csocketfile sf(&cSocket);
CArchive ar(&sf, CArchive::store);
/*code for CFileDialog goes here*/
static char BASED_CODE szFilter[] = "All Files (*.*)|*.*||";
CString strPath;
CFileDialog m_ldFile(TRUE,".*","*.*",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
// Initialize the starting directory
//m_ldFile.m_ofn.lpstrInitialDir = _T("C:\\");
// Show the file open dialog and captures the result
//if IDOK
if (m_ldFile.DoModal() == IDOK)
{
strPath = m_ldFile.GetPathName();
CFile myFile(strPath,
CFile::modeRead | CFile::typeBinary);
MessageBox("here");
//get file info
DWORD length = myFile.GetLength();
MessageBox("here2");
char *data = new char[length];
MessageBox("here3");
myFile.Read(data, length);
MessageBox("here4");
//send it across
ar << myFile.GetFileName();
ar << length;
ar.Write(data, length);
delete[] data;
myFile.Close();
}
MessageBox("here5");
}
----------------------------------------------------------------
|
|
|
|