|
In CView::OnDraw you don't need CPaintDC and CClientDC. You have CDC* parameter:
void CMyView::OnDraw(CDC* pDC)
{
pDC->...
}
|
|
|
|
|
Yes, I know. I explainied my problem wrong:
I call the OnDraw() routine when I need to repaint the client area. But when I need a device context in other routines, like OnMouseMove(), I create a CClientDC device context. The problem arouses when I move the ViewPort. I don not know why, but the CPaintDC device context already knows this, whereas the CClientDC does not.
So, whenever I scroll and then draw something with the mouse I get the objects I drew in a position. But when I redraw the whole client area the objects change position....
Thank you
|
|
|
|
|
The general approach is drawing only in one place - OnDraw (or OnPaint, if class is not CView). Drawing from any other places is overwritten by OnDraw, in any case. In mouse message handler you make the changes in drawing objects (for example, change some variables in CDocument) and invalidate the view or part of it.
|
|
|
|
|
I agree with you, but in this case I need to draw outside the OnDraw() or OnPaint(), although I a have a CView class. I solved the problem by writing a clone of OnPrepareDC for a CClientDC device context type, and use before I use the CClientDC class.
By the way, how does one do to invalidade only part of the client area ?
Thank you for your time and patience
|
|
|
|
|
InvalidateRect ?
BOOL InvalidateRect(
HWND hWnd, // handle to window
CONST RECT* lpRect, // rectangle coordinates
BOOL bErase // erase state
);
It was always there.
|
|
|
|
|
Yes it was !!! Thanks
|
|
|
|
|
I have a CHeaderCtrl with icons in some of the columns. When I resize the columns and make it smaller the divider partly overwrites the icon. It appears to be 6 extra blank pixels on each side of the divider. Is it possible to make that smaller.
Thanks for help
|
|
|
|
|
Hi,
I am trying to create a small filepacker for a game. I am using the ZipArchive library from http://www.artpol-software.com/index_zip.html, which is very nice. I've played around and got it working well, but so far I can only extract files to the hard-drive.
What I want to do is this: extract all necessary files from the zip into memory, and then launch the executable (which relies on other files) from the memory. When the game is finished, obviously it will all have to be deleted from memory. I want to do this as it is more "secure" (relatively speaking) than extracting the files to the hard-disk (where anyone can grab them) and then deleting them.
Is this possible? And if so, how do I go about it? Will it slow things down doing it this way? Any advice or information about how to go about this (or where to look for good tutorials on this sort of thing) would be really appreciated.
Many thanks,
KB
|
|
|
|
|
i will suggest you to apply some routine to search the .exe file after you open the zip file. then you can apply shellexecute() function to run that file. this is the best way as i can think of this time..
cheers
Himanshu
|
|
|
|
|
Hi Friends,
I want to give database support for an existing project in vc, so, I inserted one more class whose base class is CRecordSet and gave the the ODBC connectivity to that. When I compiled the project I got the error CRecordset base class undefined and followed by some more errors. I included the <afxdb.h> in my stdafx.h, still I am finding the same errors. Can any body help me, please.
Thank u in advance.
Satya
|
|
|
|
|
We need more info:
1. What are the errors?
2. What are the lines with the errors?
3. You say you included ??? in stdafx.h, was it afxdb.h?
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hi,
Sorry for not putting the header file name. U r right its afxdb.h.
Here are the errors
e:\trail\lan_wan\myrecordset2.h(14) : error C2504: 'CRecordset' : base class undefined
e:\trail\lan_wan\myrecordset2.h(16) : error C2629: unexpected 'class CMyRecordSet ('
e:\trail\lan_wan\myrecordset2.h(16) : error C2238: unexpected token(s) preceding ';'
e:\trail\lan_wan\myrecordset2.h(46) : error C2061: syntax error : identifier 'CFieldExchange'
E:\Trail\Lan_Wan\MyRecordSet2.cpp(17) : error C2653: 'CRecordset' : is not a class or namespace name
E:\Trail\Lan_Wan\MyRecordSet2.cpp(17) : error C2065: 'classCRecordset' : undeclared identifier
E:\Trail\Lan_Wan\MyRecordSet2.cpp(19) : error C2065: 'CDatabase' : undeclared identifier
E:\Trail\Lan_Wan\MyRecordSet2.cpp(19) : error C2065: 'pdb' : undeclared identifier
E:\Trail\Lan_Wan\MyRecordSet2.cpp(20) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
E:\Trail\Lan_Wan\MyRecordSet2.cpp(20) : error C2143: syntax error : missing ';' before ':'
E:\Trail\Lan_Wan\MyRecordSet2.cpp(21) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
E:\Trail\Lan_Wan\MyRecordSet2.cpp(55) : error C2065: 'CFieldExchange' : undeclared identifier
E:\Trail\Lan_Wan\MyRecordSet2.cpp(55) : error C2065: 'pFX' : undeclared identifier
E:\Trail\Lan_Wan\MyRecordSet2.cpp(56) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
E:\Trail\Lan_Wan\MyRecordSet2.cpp(84) : error C2653: 'CRecordset' : is not a class or namespace name
E:\Trail\Lan_Wan\MyRecordSet2.cpp(89) : error C2653: 'CRecordset' : is not a class or namespace name
These errors are coming before including the header file and after header file, I don't know what to do.
regards,
satya
|
|
|
|
|
Simple question for a simple answer...
Can I write a HLP file with VC6? (from AppWizard for example)
Tell me how?
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
I have done this in the past by editing the afxcore.rtf and afxprint.rtf files manually in either notepad or Visual studio (make sure you open the files as text, not auto). Once you have made changes, you can rebuild your helpfile using help workshop.
Helpworkshop can be found under VS ^.0 -> Tools->Help workshop in your start menu. Use it to open your projects .hpj file.
If your doing this for a MFC project, I would recommend switching to the afxcore/afxprint.rtf files listed in one of my articles here in the help section, as they are far less compicated and much easier to understand. From that point, you should be able to add your own .rtf files and topics to the help project.
If you need any more tips, e-mail me direct.
Roger Allen
Sonork 100.10016
This is a multiple choice question, choose wisely
Why did the hedgehog cross the road?
A: To show he had guts?
B: To see his flat mate?
|
|
|
|
|
Thanks for the help... I go to understand a bit more the "Help Workshop" first... but it seems simple...
Thanks
Hello World!!!
from Raphaël
|
|
|
|
|
hello @all,
i try to explain what i want / must do:
i have something like this:
<br />
int i=0;<br />
while(i<5)<br />
{<br />
i++;<br />
}<br />
the only problem is the while loop. without these, the program part runs perfectly. however i need a while loop or something like that.
i think, the problem lie in the fact that the program sends the data to matlab and then directly in the code continues to go. possibly different processes run off parallel.
i think i must have something that waits so long, till matlab is ready with the diagram (i tried Sleep(1000) but it do not work).
maybe somebody know, if matlab has got a 'instruction' or if i can make something like a 'queue'.
thank you very much
sunny
|
|
|
|
|
hi,
have you tried using for loop too. i guess you would have.I don't think two processes can be running in parellel bcz you are calling your diagram from MATLAB then when it's dissolved then only the program execution will continue. that means there is something else wrong.
I will suggest debugging the program step by step by putting a breakpoint just before the loop and then f10 or f11. i guess u know all that. how to debug. I guess you will reach a solution then.
cheers..
Himanshu
|
|
|
|
|
thanks for reply.
i tried a for loop, too. i tried a thread and i tried to debug.....but i still don´t know, what´s wrong.
sunny
|
|
|
|
|
hi,
i guess you are having problems with the debugging side. why don't you try to step into the process to see what it does and well how does it perform..is it going the expected way or not..if anywhere you see unexpected behavior thats the place u were looking for. put all the variables in watch and look for them too. what else..if not then try executing a exe of matlab exmple i guess that should work fine..and produce expected results.because maybe the interfacing u are doing is wrong anywhere..just check it thats all i can say without looking at ur code..
cheers..
Himanshu
|
|
|
|
|
thanks for reply.
the problem when i debug oder run my program is the transition between the: 'data send to matlab' and the 'new start of the function'.
the program falls.
sunny
|
|
|
|
|
When running a console application how do you adjust the properties,such as text color or window position, of the console window? I have tried right clicking the window and using the properties submenus but nothing happens.
|
|
|
|
|
if win9x i don't know, but NT you can do:
color xy
where:
according to cmd.exe in w2k
Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
If no argument is given, this command restores the color to what it was
when CMD.EXE started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.
The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.
Example: "COLOR fc" produces light red on bright white
To do this from your c++ app, call system("color fc");
For the window size, try mode con:lines=x and mode con:cols=y
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I thought of trying my hand at implementing Unicode,
but I noticed that file classes(CFile, fstream) don't accept unicode strings for filenames.
How do I get this problem solved?
|
|
|
|
|
In most cases we have functions that support UNICODE. For example, CreateFile for file operations, CStdioFile class for text files. If function/class we need doesn't support UNICODE, we convert it's parameters by the following way (suppose that SomeFunction(char*) hasn't UNICODE version):
#include "atlbase.h"
// ...
USES_CONVERSION; // ATL string conversion macro
TCHAR s[100];
// fill s ...
#ifdef _UNICODE
SomeFunction(W2A(s)); // convert WCHAR* to char*
#else
SomeFunction(s); // direct call - TCHAR is char without UNICODE
#endif
|
|
|
|
|
Thanks! W2A saved the day
|
|
|
|