|
hi,
I have this problem that wenn i begin printing a drawing with Visual C++ it doesn't fill a rectangle. i just use the function:
<br />
void CRSARuitLocaties::SelectPrintRuit(CDC *dc, CRect r, FLOAT Factor, int Ruitnr)<br />
{<br />
m_strFilter.Format("Nr = %d", Ruitnr);<br />
Open();<br />
<br />
int x,y;<br />
<br />
CBrush* brush;<br />
CBrush* oldBrush;<br />
<br />
brush = new CBrush(RGB(255,0,0));<br />
<br />
while(!IsEOF())<br />
{<br />
oldBrush = dc->SelectObject(brush);<br />
<br />
x = r.left + (m_xmiddel / Factor);<br />
y = r.top - (m_ymiddel / Factor);<br />
<br />
dc->FloodFill(x, y, RGB(0,0,0));<br />
dc->SelectObject(oldBrush);<br />
MoveNext(); <br />
}<br />
<br />
delete brush;<br />
<br />
Close();<br />
}<br />
the locations are right, i've checked...
|
|
|
|
|
|
|
my problem is:
I have a file, where I write some data(for example name, description, date). and I have to delete one record. how do I have to do this?
|
|
|
|
|
Using C or C++ functions?
How are u writing to the file
Anyway consider using fseek or CFile:Seek and be sure u dont open in append mode
|
|
|
|
|
I am writing like this:
"ses" is my serializable class
I want to save "name" and "date"
ses.Add(name);
ses.Add(date);
and after I am writing into the file.
mode "write".
|
|
|
|
|
I have two modeless dialogs (two different classes). Each has a textbox. I want to see when the user pressed Enter - SO I overrride OnCommand() in both of the CDialogs. Now if I press enter in the Dilaog#1 textbox, the OnCommnad of that class will run. But wil the OnCommnad of the other class run too? Or does the message (WM_COMMAND) generated on pressing Enter pertain only to the window in which the enter key was pressed?
Appreciate your help,
ns
|
|
|
|
|
You can you PreTranslateMessage defined in each dialog class.
BOOL CYourClass::PreTranslateMessage( MSG* pMsg )
{
if ( (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN) )
{
return TRUE;
}
return CYourBaseClass::PreTranslateMessage(pMsg);
}
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Thank you! I will try it.
Appreciate your help,
ns
|
|
|
|
|
Exactly what I needed.
Appreciate your help,
ns
|
|
|
|
|
Is it possible to use get to read a file in as a string without the whitespace characters.
I have done this effectively by using >> and a loop but I was wondering if I could do it with get.
btw I have called File.setf(ios::skipws) without success.
|
|
|
|
|
>> will skip whitespace, otherwise you should use getline and then remove the whitespace afterwards. Or you could create your own inserter which does not read whitespace. iostreams has no inserter for CString, so if you're using MFC, just write it for CString and all will be well.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Thanks for the info, I guess I'll stick to >> and my while loop...
|
|
|
|
|
I would appreciate it if someone could give me the correct syntax (or parameters) to use on the add method of the worksheets object. I have an application where I am doing Excel automation. I have been able to add data to the three existing worksheets but when I try to add a fourth sheet to the end I get a method failure message. If I use 'vtMissing' for all four parameters of the add method, the new worksheet gets added to the beginning. I then tried to use the move method, but I get a method failure error if I try to put the sheet number that I want to move after.
VC++ 5
Oracle ODBC
ADO
Excel 2000
|
|
|
|
|
Hello
Per a few suggestions I have looked for and found one of the splitter demos on this site. As I have mentioned before I am very new to Visual C++. The splitter demo I found is at the following location: http://www.codeproject.com/splitter/SimpleDlgSplitter.asp
I am looking over it and would like to know how I can change it to have two windows side by side and how to chnage the left window so that it is dialog based. I have found the portion of the code to allow me to changethe size of the window. Any help that anyone can provide will be greatly appreciated as I embark on learning a new programming language.
Thanks
Spamdogg
|
|
|
|
|
Our local computer club would like to find a way to automate the dial up networking information for our club's Internet connection as an installation program that would be easy for new computer users to run in order to set up their connections. Does anyone have any suggestions on how to do this or know where to find documentation on this. Am assuming you'd have to insert/modify information in the registry, but I'm not sure what information would be needed. Has anyone run across registry documentation on the subject or know of an easier way of doing this? Thanks.
http://www.distasis.com/cpp/
|
|
|
|
|
Hi all,
How would one go about determining IE's current cipher strength (as displayed by the About box) programmatically, from a VC++ app?
What should be assumed for older versions that don't display it anywhere at all?
While I'm at it, where is the current IE service pack number stored?
|
|
|
|
|
Hi,
Just a general question. Which do you think is faster or better for copying two arrays: memcpy or a for loop over the arrays?
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
At one place I worked the company policy was to use memcpy where possible. Hopefully the compiler had an optimized version of memcpy for the platform and if not we could get someone to write one in assembly. It was supposed to be faster in most cases than a for loop, but the actual speed difference will depend on the individual compiler and how it optimizes the code.
|
|
|
|
|
memcpy is way faster, because the compiler will change it for a few specific processor instructions (see "#pragma intrinsic" on MSDN).
But sometimes it can bite you, specially on templates: if you are working on C++, memcpy can corrupt your data, because a loop array copy routine must call copy constructors and assignment operators to do its work.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
Hi,
I meant using memcpy on primitive data types only. But I guess it is way faster than a for loop.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
In all likelihood, memcpy is probably faster. A 'for' loop would invariably involve many, many invidual memory accesses (reads and writes) to various addresses. Just loading those addresses in registers for each loop iteration will be a lot slower than a raw memcpy.
However, you're not specifying what type of arrays you have...if they contain strings, structs, or anything using pointers, memcpy won't replicate the data being referenced; you'll only get copies of the pointers. In that case, if you then destroy the original array, your copy's pointers will now be pointing an invalid addresses.
|
|
|
|
|
> if you then destroy the original array, your copy's pointers will
> now be pointing an invalid addresses.
...by "destroying the original array", I meant "including any data referenced by any pointer it contains".
|
|
|
|
|
memcpy, without a doubt. it's much faster to copy data 32-bits at a time, than one BYTE at a time, or one sizeof(CMyObject) at a time; and it's even faster when that data is aligned on DWORD boundaries. memcpy takes both of these into account.
i needed a function to do a bitwise inverse of a buffer. i wrote one as a simple for loop and one that operated on 32 bit values, aligned on 32-bit boundaries. the difference was significant (the optimized routine took less than 15% of the time that the simple for loop did).
int z;
BYTE *pb = pBuf;
UINT32 uLeadUp = (DWORD)pBuf & 0x03;
for (z=0;z < uLeadUp;z++)
{
*pb = ~(*pb);
pb++;
}
uLen-=uLeadUp;
UINT32 dwords = uLen / 4;
UINT32 leftovers = uLen % 4;
DWORD *p = (DWORD*)pb;
for (z=0;z < dwords;z++)
{
*p = ~(*p);
p++;
}
pb+=4;
for (z=0;z < leftovers;z++)
{
pb[z] = ~pb[z];
}
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
I remember when this came up.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|