|
mikobi wrote:
...the program broken down. what to do ?
Describe, in detail, what the problem is. Simply saying that it is broken is not very helpful.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
When I clic on the print button on the printpreview screen there is this message : this program will be stopped because it does an operation not permit. If this error continue, let contact your reseller.
I learn my self
|
|
|
|
|
So what does the code look like that runs when the Print button is clicked?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all,
Now I have a list controls; the list is set in Icon mode and I use it to display thumnail image (look like explorer in winxp to show images in thumbnail mode).
When I put scroll (Vertical) position at the min position (zero value); items rectange (GetItemRect(0,&rect, LVIS_BOUNDS)) at the first line always is zero value! How can I change this value? (mean I can make a distance between item and the ceil of list control rect);
Similarily with items at the last line when I put scroll position at the maximum value: bottom value of these items always dash the floor of list controls rect! Can I change this distance?
In otherwise, if list control is a box; I see items always are fixed in the box; How can I enlarger this box???
Please tell me some ideas!
Thanks!
|
|
|
|
|
I dont think you can change the layout algorithm of the list control.
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls
|
|
|
|
|
yes i wana make a vector for a object
eg. **************PROPERTY.h FILE***********
#ifndef Property_h
#define Property_h
#include <string>
#include <vector>
using std::string;
using std::vector;
class Property
{
public:
Property();
Property (string a_address, string a_suburb, int a_price);
void print() const;
void getProperty();
//int readFile(vector<property>, myCard);
void listAll(vector<property> propvect); <<<<<< thing to look at error possibly here
int menu();
private:
string address_string;
string suburb_string;
int price_int;
};
#endif
**********PROPERTY.CPP FILE************
#include <iostream>
#include <string>
#include "Property.h"
#include <vector>
#include <fstream>
using namespace std;
Property::Property()
{
}
Property::Property(string a_address, string a_suburb, int a_price)
{
address_string = a_address;
suburb_string = a_suburb;
price_int = a_price;
}
void Property::print() const
{
cout << address_string << " " << suburb_string << " " << price_int << endl;
system("Pause");
}
void Property::getProperty()
{
cout << "Enter address: ";
getline(cin, address_string);
cout << "Enter suburb: ";
getline(cin, suburb_string);
cout << "Enter price: ";
cin >> price_int;
}
int Property::menu()
{
int option = 0;
cout << endl;
cout << "Menu:" << endl;
cout << "1 - List all properties" << endl;
cout << "2 - Property search" << endl;
cout << "3 - Add a property" << endl;
cout << "4 - Save property list" << endl;
cout << "5 - Exit" << endl << endl;
cout << "Please enter option: ";
cin >> option;
string remainder;
getline(cin, remainder);
cout << endl;
return option;
}
void Property::listAll(vector<property> propvect) <<<<<<< FUCTION THAT HAS THE ERROR
{
for (int i = 0; i < propvect.size(); i++)
{
cout << "$" << propvect[i].address_string << " ";
cout << propvect[i].suburb_string << " ";
cout << propvect[i].price_int << endl;
}
}
***********PROPERTY_TEST.CPP ********** TEST HARNESS FOR PROPERTY PROGRAM
#include <iostream>
#include <string>
#include <vector>
#include "Property.h"
using namespace std;
int main()
{
int option = 0;
bool done = false;
vector<property> propvect;
Property Properties;
// readFile(vector<property>, myCard);
do
{
option = Properties.menu();
switch (option)
{
case 1: Properties.listAll(vector<property> propvect);
/*Properties.print();*/break;
case 2: //search(properties, items); break;
case 3: Properties.getProperty();
propvect.push_back(Properties); break;
case 4: //saveProperties(properties, items); break;
case 5: done = true; break;
default: cout << "Illegal menu option" << endl;
}
} while(!done);
return 0;
}
____________________________________________________________________________________________
now when i run it without the ListALL fuction it works but when i run it with the ListALL fuction i get syntax errors can anyone see what im doing wrong.
|
|
|
|
|
you'll need to edit your post to make sure all the <'s and >'s show up. as it is now, we can't tell how you've declared the vectors.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 10:04 Saturday 10th September, 2005
|
|
|
|
|
|
I have created a SDI application (with no Document/View) support. I 'm trying to attach a CBitmap button, but dose not displayed at all.
Here is my code (that handles the WM_CREATE message on the CChildView class):
<br />
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CWnd::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
RECT rect;<br />
rect.left = 20;<br />
rect.right = rect.left + 20;<br />
rect.top = 100;<br />
rect.bottom = rect.top + 20;<br />
<br />
CBitmapButton bnPlay;<br />
if(bnPlay.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, <br />
CRect(&rect), this, IDC_BN_PLAY)==0)<br />
{<br />
AfxMessageBox("BnPlay cannot be created", MB_ICONSTOP);<br />
return -1;<br />
}<br />
<br />
bnPlay.LoadBitmaps(IDB_BNPLAY);<br />
bnPlay.SizeToContent();<br />
return 0;<br />
}<br />
The result of this code is an empty window...
|
|
|
|
|
|
I have created a CBitmapButton in the main window of an SDI application, but I can't figure out how to implement the button. I would like to use it to open a dialog. Here is the code I used to create the button. Thanks for any help you can give.
RECT rc;
rc.top=10;
rc.left=10;
rc.right=95;
rc.bottom=95;
CBitmapButton *Winbut = new CBitmapButton;
Winbut->Create(NULL,WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,rc,this,IDB_SITBUT);
Winbut->LoadBitmaps("SITEIMAGEU","SITEIMAGED","SITEIMAGEU","SITEIMAGEX");
Winbut->SizeToContent();
|
|
|
|
|
The last parameter of the create function is the ID of the control you are creating. It is an integer.
Let it be 200.
Then declare a function in the header for the class.
afx_msg void OnButtonWhatever();
In the message map in the .cpp file:
...<br />
...<br />
ON_COMMAND(200,OnButtonWhatever)<br />
END_MESSAGE_MAP()
Then implement the function:
void [Your Class Name Here]::OnButtonWhatever()<br />
{<br />
MessageBox("The button was clicked. He He!");<br />
}
this is this.
|
|
|
|
|
Thanks for the help. Worked like a champ.
|
|
|
|
|
hi all,
i am trying to export a class template from a static library using __declspec(dllexport). The library will compile fine, however importing it into my second project and attempting to instantiate it produces a number of unresolved external symbol linker errors, for each method. Is it possible to export templates from a static library?
|
|
|
|
|
you need to provide the entire definition of the template, in order to 'export' it. a template is not a class - it's just a recipe that the compiler uses to make a real class. any compiler using your lib will need the whole template definition to build that class.
this[^] might help.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 16:50 Friday 9th September, 2005
|
|
|
|
|
thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?
|
|
|
|
|
|
thanks, that link explains why it doesn't work. so, tbe answer is no? oh well, i'll figure something out
|
|
|
|
|
zildjohn01 wrote:
so, there is no way to export the actual template, so that clients can recreate the templates with any types they need?
put the template in a .H file and let anyone who wants to use your template #include that .H file.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
good afternoon,
The memory leak report looks like this:
{404} normal block at 0x00FD8CD8, 49995 bytes long.
Data: < > 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
{399} normal block at 0x00FD8770, 1309 bytes long.
Data: 48 65 61 64 65 72 20 4C 65 6E 67 74 68 3A 20 30
{166} normal block at 0x00FBDAC0, 14844 bytes long.
Data: <5 a p > 35 00 00 00 90 D2 61 00 70 81 13 00 00 00 00 00
c:\dev\c++\billing\voldisc\voldiscdlg.cpp(592) : {147} normal block at 0x00E25028, 64 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
the Last part with all CDCDCDCDCDC seem like unintinized object, but it looks alright in the code,
DiscountData = new DISCOUNTDATASTRUC;
what about all the 20202020202020, it has 49995 bytes long.......is it the leak size? this application works, but it has all the memory leak..
thanks.
|
|
|
|
|
valerie99 wrote:
the Last part with all CDCDCDCDCDC seem like unintinized object,
Right, it is an uninitialized object and is used for debugging purposes. You can see it, and others, in dbgheap.c . Initialize all of your pointers to NULL .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
thanks for your reply,
"it is an uninitialized object and is used for debugging purposes", do you mean this should not effect the release version of the program? it seems like stop and didn't create the report when I ran debug version ....
|
|
|
|
|
valerie99 wrote:
The memory leak report looks like this:
{404} normal block at 0x00FD8CD8, 49995 bytes long.
If you can run the program in the same exact way, you can put this:
_CrtSetBreakAlloc(404);
in the beginning of the program (where 404 is the number in brackets above) to get the program to break when it allocates the memory that doesn't get freed. I put mine at the beginning of my app's InitInstance. That might tell you something; I've found it to be a very useful tool. But like I said, it needs to be run in the exact same way so that the number doesn't change.
|
|
|
|
|
thanks for the command, I have tried this tip on my APP's InitInstance, it stop at the DBGHEAP.C, when I look at the call stack, it hit this part of code int nResponse = dlg.DoModal();, and the least are MFC stuff......couldn't really tell where it cause the problem
it brought up another question, all the numbers inside {}, some of them are connected next by each other, like 191, 192, 193, is it means one uninitized pointer causing couple crashes or something like that? I don't really know how to read this. thanks again!
|
|
|
|
|