|
time to learn about NT services.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
Does anyone know how GetWindowExt function works?
I've written in my View class:
(in OnInitialUpdate)
CSize sizeTotal(1000, 1000);<br />
SetScrollSizes(MM_LOMETRIC, sizeTotal);
then somewhere in the program I write
CClientDC dc(this);<br />
OnPrepareDC(&dc);<br />
CSize size = dc.GetWindowExt();
And size.cy equals to -254!
Does anyone know the clue?
|
|
|
|
|
Space Ace wrote:
then somewhere in the program
where in the program? are you calling it before the window has been shown ?
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
Chris Losinger wrote:
where in the program?
Well, I'm calling it in OnLButtonDown (just as a test). By this time the window is definitely already shown.
|
|
|
|
|
what happens if you don't call OnPrepareDC ?
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
Chris Losinger wrote:
what happens if you don't call OnPrepareDC ?
This way it doesn't work either. In this case it returns 1 which is obvious: if we don't call OnPrepareDC the map mode is not set.
|
|
|
|
|
Its odd. My app wil be working fine. Then alll of a sudden, it will start crashing if closed with the x button on the right hand size . I'm jsut performing a read operation by pressing a button once in each run. Then if I go back into VC and rebuild and run again its okay for a while, then misbehaves again...No code changes are happening, it just decides to misbehave. it always reads the same file at this point.
What can be the reason, and how do I prevent this problem. This way i can distribute my project thinking it works fine, then all of a sudden it will start crashing with the user and I'll be in trouble..help!
(happens in release and debug mode both)
|
|
|
|
|
I'm jsut performing a read operation by pressing a button once in each run
You have to give some details...
rechi
|
|
|
|
|
Its an MDI MFC database app. Its function (its a little test project) is to open a recordset, and read in some data into an Access database. One of the fields is a blob (ole object), several are text, and one is a memo. When the app runs it asks you to browse for the blob you want to store. Automaticallly after this it opens a test data file (.txt), reads in a buffer, and writes it to the memo field. The text fields are filled with hardwired values. Anyways this is the app, which "corrupts" itself after being run from the IDE repeatedly with no code changes! A rebuild all repairs things. Its pretty sporadic and happens unexpectedly.
Thanks for being interested,
ns
|
|
|
|
|
sounds like a memory overwrite to me
check all your buffers are big enuff for what they have to store
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Add a handler for OnSysCommand() and set a breakpoint in it. That will help you trace thru the crash. The nID your're interested in debugging is SC_CLOSE .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
The nID your're interested in debugging is SC_CLOSE. <br />
<br />
Sorry but whats an nID and whats SC_CLOSE? Like WM_CLOSE? Is OnSysCommand accessible through the class wizard? I didnt see it in my view class. or in the mainframe class either. Its not in the "Add windows message handler" context menu either...So how shall I add an OnSysCommand handler?
Sorry to bug you so much about stuff thats obvious to you (but a mystery to me!)
thanks
|
|
|
|
|
When you click the "x" button, Windows sends you a WM_SYSCOMMAND message. This message is also sent when you invoke commands from a top level window's system menu (the menu at the top left). To differentiate the different system commands, Windows sets the nID parameter sent along with the message.
The MFC handler for WM_SYSCOMMAND is OnSysCommand . You can add this handler using ClassWizard. The nID is the parameter name and is set to SC_CLOSE to identify that the user clicked the "x" button (or selected "Close" from the system menu).
That's the code path you want to step thru to see where your app is crashing.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
how to edit any column item in a list control in report style?
I can edit only first(zeroth) column items!
|
|
|
|
|
Simply use CListCtrl::SetItem with nSubItem set to the subitem index you wish to change. Example:
LVITEM pItem;
pItem.iItem = 2;
pItem.iSubItem = 3;
pItem.mask = TVIF_TEXT;
pItem.pszText = (LPTSTR)(LPCTSTR)"Your Text";
m_ctlListBox.SetItem(&pItem);
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This solution would also work.
-----
string szNewText(TEXT("new text"));
// Indicates index of row you want to change.
int nLCIndex = 0;
m_ListCtrl.SetItemText(nLCIndex, 0, static_cast<lpctstr>(szNewText.c_str()));
-----
Kuphryn
|
|
|
|
|
hi,
I want to read data in the form of a table from a text file without letting the user to set the coloumns to be read.If a particular column does not exist,I put reasonable default values in that.
How to do that?
Also,how to check if the read data is an int or char* etc?
HElp me.
|
|
|
|
|
You're supposed to know the format of data before you ask for it. Otherwise you should read it as std::string's. You'd use getline and specify the delimiter you've used in your files ( a , or a tab I'd guess ), then you could step over it and put default values into anything that is 0 length, and figure out which fields are numbers.
|
|
|
|
|
The best solution is to use a data structure. You could create this data structure yourself and thus you know the exact format.
Otherwise, you could use the getline and string technique, but then you will need an algorithm to determine the integrity of each role of data in the file.
You could use isdigit() to determine the data type of each byte in the file.
Kuphryn
|
|
|
|
|
In a text field you can put strings, in a number field, numbers, in an OLE Objectfield you can put binary data. In a memo field what type of data is put in? How do you retrieve it? Like for binary data we use GetChunk. So for a memo field, how do you put it in to the Access db and subsequently extract it?
Thanks,
ns
|
|
|
|
|
Use the help file
to read about the difference between
text and memo
|
|
|
|
|
Is there a link to this? All the MSDN memo entries appear to be for FoxPro...
Thanks,
ns
|
|
|
|
|
Use the Access-Helpfile by pressing F1
Use the index tab and type memo
|
|
|
|
|
Ah! I see. I hadnt even thought of Access help!
ns
|
|
|
|
|
Hope it helps you
I'd posted the lines but I've
only some in german
|
|
|
|