|
normally you wouldnt need to explicitly qualify the base class variables and functions, unless they are static....
could you post some code?
|
|
|
|
|
You are right! I just tried to remove the front portions of it.
Before
class classOne {
public:
void functionOne()
{}
};
class classTwo: public classOne {
public:
void functionTwo()
{
classOne::functionOne();
}
};
I have removed the classOne:: from the function, and it works perfectly now. I was having some problems implementing class initially, that's why I have kept the front portion.
Thanks a million!
|
|
|
|
|
First of all Thanks for reading this post.
In my project I have a Access databse. I want to take a backup of the database file, when the user wants to , from the application.And restore it whenever user wants to.
The database file is in the current directory.
May be by a function OnBackup()
In this function i want to implement a mechanism, by which the software gets the pointer to the file (mdb file) and then save this file to his/her desired target.
I understand that this can be one by getting pointer to the file by using GetFile() function and by saving it using OnSaveDocument() function.
But then how to invoke OnFileSaveAs kind of diaolog box?
Please provide the complete detail how to do it. Or may be some source code.
Or else , suggest me some other beter mechanism to do backup/restore of a file.
|
|
|
|
|
For the file save as dialog , look up the CFileDialog class of MFC. In the constructor of the dialog box, you can specify it as an open or save dialog box.
Then you can use other win api function / or file classes for copying the mdb file.
|
|
|
|
|
Helllllo people .. i'm new in vc++ but i want to learn ... now i have a mfc mdi wizard with base class CFormView and i want to put on a new document something but in dynamic mode with Create function ... something like a button or a static text ... the problem is that i don't know where and how to do this .. i have tryed and the best result is that the button was there for a moment just and then gone .. i don't know where ... my last tryings are
CMDIChildWnd * bb=((CMDIFrameWnd*)AfxGetMainWnd())->MDIGetActive();
CButton info1;
CRect rct(50,50,200,200);
info1.Create("Info1",WS_CHILD,rct,bb,130);
info1.SetWindowText("Pleease !!!");
please help me ... and forgive my english
|
|
|
|
|
Your button object is define as a local variable,try to define a member variable to do this.
Thinking in difference!
|
|
|
|
|
Hi,
in my project (WinAPI), I have a subclassed scrollbar control. I need the arrow buttons to be drawn disabled and to draw the rest myself. And because I also need to get mouse input for the non arrow area, I subclassed the window proc and let the control draw to a memory dc (adding the WS_DIABLED style just before the redraw and removing it just after the redraw), then I draw the rest myself and blit it onto the DC it was previously supposed to be blitted to. The problems are:
1)Though the style is WM_DISABLED, I get the arrows drawn badly.
2)The right (it's a horiz bar) arrow doesn't draw at all till I click it... Dunno why. Why? I could call explicitly WM_PAINT, UpdateWindow or whatever, only the left is redrawn till I click it (and when I resize, it starts all over again)
|
|
|
|
|
I have a customer running our application on Windows XP Home version.
The program was compiled with Visual Studio V6. When the customer
accesses a specific dialog box, the program faults inside of "NTDLL.DLL".
Can anybody give me an insite as how to solve this problem? I do not have
a lot of details since this is coming from the vendor that sold the
product.
Thanks in advance for the help!
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
If you have spare machine on which to install Windows XP Home, do so. Then install visual studio as well. THen ghost it so you can repeat this in a matter of a few minutes when ever you need to from a CD.
Build you Application in release mode WITH debug inforamtion. When the exception occurs you then see the call stack, and work out which line in your code made it fall over.
Happy programming!!
|
|
|
|
|
Does anyone know any good resources(tutorial, sample code...) for learning about rich text boxes that aren't part of a view. Thanks.
-Ken Mazaika
|
|
|
|
|
and that isn't in a dialog box...sorry about ommitting that before.
-Ken Mazaika
|
|
|
|
|
hi all and please help,
my program have alot of "new", to initialyze my classes and member variables, and "delete" to close the app. But i found my app to be verry slow. Now a test app proved me that 5000000 "new double" takes alot of time to allocate , while a big "new double[5000000]" takes no time at all .
My question is, what is the "good" way to workout a kind of "new BYTE[5000000]" and easely manage that memory, for double, classes... normal allocations?
I think this means, big mem allocation will cause fragments and mucho "sizeof". Am i just on the wrong track
Some Links to tutorial on mem allocation is wellcome
thanks to all
|
|
|
|
|
Why on Earth would you like to call 'new double' five million times? Pointers themselves will use 20 megabytes.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Francg wrote:
I think this means, big mem allocation will cause fragments and mucho "sizeof". Am i just on the wrong track
I think if you allocate memory all at once with a single call to new the system will try and make the memory one contigous block. So I would think thats the better way to do it when trying to avoid fragmentation.
However to allocate that much memory is probably not a good idea...a better approach(IMO) would be to allocate a segment of multiples of sizeof(double) . Fill that memory and than reallocate another segment fill it up and so on. However this would be very un-efficient using new and delete so I would suggest using windows heap or virtual functions or the crt malloc/realloc/free functions.
Using the latter keeps your code more platform independent.
HTH
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
If you create massive instances of a class on the heap, it is worthwile to create an own heap for this preallocates larger blocks of memory and maybe also optimzed for the data size of your class.
To ensure a class uses an own heap for its instances, it is best to write a class level operator new and a class level operator delete. Take a look in VC help or a good C++ book for more details about overriding operator new/delete for a class.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Hi. I am trying to checkmark the nodes of a tree at start up based on whether they are present in my database already or not. Here is my code:
HTREEITEM hCategory = m_CategoryTreeControl.InsertItem(rs.Field("Category").AsString(), hAllCategories, TVI_SORT);
m_CategoryTreeControl.SetCheck(hCategory, TRUE);
This is in the OnIt function of my dialog. When I start the dialog up, the nodes don't get checkmarked. I have no idea what I am doing wrong. Any help would be appreciated.
|
|
|
|
|
From MSDN docs on TVS_CHECKBOXES:
If you want to use this style, you must set the TVS_CHECKBOXES style with SetWindowLong after you create the treeview control, and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues.
Make sure you're not hitting these 'timing issues'.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Hi,
Anybody know how to do this? I want to pop up a little menu when the user right clicks on a label in a CFormView derived view.
Thanks in Advance,
Aaron
|
|
|
|
|
WM_CONTEXTMENU ?
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Capture one of the following messages for the window...
WM_RBUTTONDBLCLK
WM_RBUTTONDOWN
WM_RBUTTONUP
Jeremy Falcon
Imputek
<nobr>"C# is the answer to a question nobody asked." - Chris Losinger
|
|
|
|
|
Static controls have to have the SS_NOTIFY style set if you want it to recieve mouse messages.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
i get the hwnd of a window of a process containing two buttons on it how will i get their hwnd and perform any action like thay clicked with out key bord and mouse event i mean programatically?
r00d0034@yahoo.com
|
|
|
|
|
look up FindWindowEx... getting the handle to the child window with a given window text
- Roman -
|
|
|
|
|
If you have the HWND of a window, you can get the child windows by (at least) a couple of methods...
GetDlgItem if you know the ID# of the child windows.
e.g.
HWND hWndChildOne = ::GetDlgItem (hWndParent, IDOK);
HWND hWndChildTwo = ::GetDlgItem (hWndParent, IDCANCEL);
////
CWnd *pChildOne = pParent->GetDlgItem (IDOK);
CWnd *pChildTwo = pParent->GetDlgItem (IDCANCEL);
or GetWindow if you know the order.
hWndChildOne = ::GetWindow (hWndParent, GW_CHILD); // Get first child
hWndChildTwo = ::GetWindow (hWndChildOne, GW_HWNDNEXT);// Get sibling
To "pretend" they were pressed, you can do something like the following:
PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM) hWndChildOne);
PostMessage (hWndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID (hWndChildOne), BN_CLICKED), (LPARAM) hWndChildOne);
I hope that helped.
Iain.
|
|
|
|
|
Hi,
Has any one ever had any issues with controls being repainted (controls becoming invisible at times, but data is still there) when having list controls and an OCX on the same dialog? For instance, the program's list controls that had focus when minimized would disappear when the program was restored. When I fixed the probelm by invalidating the dialog on moving the controls, the OCX control on the dialog will disappear at times. Any suggestions?
Thank you so much,
G
|
|
|
|