|
You need to save your data somewhere and paint everything in response to the WM_PAINT message only.
Whenever a part of your window needs to be repainted, you will receive a WM_PAINT message and you need to do the drawing there, and only there !
|
|
|
|
|
I was thinking, if it was possible to know when the window went out of focus, I could copy that section of the screen into the clipboard, and then repaste it when the WM_PAINT was called.. wouldn't that be easier, if its possible that is
------------------------
Impossible is Nothing
|
|
|
|
|
nevermind, ur suggestion worked out perfectly, and it wasn't nearly as difficult as i thought it would be. Thanks!
------------------------
Impossible is Nothing
|
|
|
|
|
ok I'm having another problem tho, It seems sometimes it jus stops painting. I don't know why this is happening, but by minimizing and restoring the program it starts to work again. Anyone know why this might happen?
------------------------
Impossible is Nothing
|
|
|
|
|
One message to reply to all your questions
First, your suggestion of using the clipboard when the window loose focus is not really good (it is even very scary): imagine that all applications will do that. Do you imagine what a mess it would be ? And the poor user which desperately tries to copy/paste something
In fact, once you understand the philosophy, everything makes perfect sense. I suggest that you google to find some tutorials about win32 programming (you'll probably find some usefull articles on this website). If you plan to program in win32, it is highly recommanded.
Now, for your last question: in fact the WM_PAINT message is not sent continuously: it is sent only when your window needs to be repainted (so when you minimize it, when something comes in front of it, ...). But, if you need to refresh it (for example because new data needs to be displayed), you need to invalidate it, which will cause a WM_PAINT message to be sent. For that, you can call InvalidateRect[^]
While searching for the link to this function, I came upon this link[^] which is probably what you need to get started.
Enjoy
|
|
|
|
|
Hello,
I've tried the follwing code. everything works fine except conversion from _variant_t to char*.
Any idea of how to do it?
Many thanks for your advice.
int yy = 4;
int zz = 1024;
float ff = 13589.025;
char* chh = "MyString";
_variant_t** test = new _variant_t*[4];
for(int i= 0; i
|
|
|
|
|
Arris7 wrote: Any idea of how to do it?
_variant_t var(_T("hello"));
CW2A ansiBuffer((_bstr_t)var);
cout << ansiBuffer << endl;
led mike
|
|
|
|
|
I wanted to try Visual Studio Express as a debugging medium.
I brought over a project and tried to compile it.
It complained that it couldn't find afxwin.h which is all the MFC core stuff. I looked around and couldn't find it either on that computer.
My question is: can I add something to make the express edition support MFC?
Thanks,
Ilan
|
|
|
|
|
IlanTal wrote: does visual studio express support mfc?
no
|
|
|
|
|
I am new to VC++.Can anyone tell about the concept COM with MFC.PLZ Give any article And sample mfc program with com.
|
|
|
|
|
Is the search engine broken?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
See these[^] articles are helpfuls?
|
|
|
|
|
Thank you
|
|
|
|
|
|
I am using "CreateFile" function for accessing CD-ROM drive in the service program but it is resulting in error. I checked error through GetLastError() and found error code = 5 (Access Denied).
But calling "CreateFile" function from other program (non-service program) is working fine for accessing CD-ROM drive.
Any idea/help would be highly appreciated.
Thanks
A_K_C.
|
|
|
|
|
check the account type of the service, for instance, a LocalSystem one should have access to the CD-ROM device.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yes, I have checked the service access and it is LocalSystem type service.
So what may be wrong with the service if it is already LocalSystem type? Probabily there is need to set security attributes of the service component through DCOMCNFG tool.
Thanks.
|
|
|
|
|
Hi
I am writing a program in Windows CE for a Palm PC.When I send a string that contains Turkish Letters which is not included in ANSI characters.And this characters are seen diferent in the Palm PC from what I sent.So I want to check these letters when it comes to Palm PC and I want to change the unicodes of these letters to make them seen the same that I sent.So my question is that How can I get the unicode value of a letter in a string.For example;
CString string = "letterX"; //Suppose that X is a Turkish letter
//The Unicode value of X is 351
int number1 = string.GetAt(6); //That doesn't work.It gives negative value.
unsigned short int number2 = string.GetAt(6); //That doesn't work.It gives
// 65534 which is not true.
How can I get the real unicode value of X?
Thanks
|
|
|
|
|
1. Do you have UNICODE and _UNICODE defined? If not, then your CString contains 'char', not 'wchar_t' characters.
2. What does 'send a string' mean? Over a network?
3. The negative number sounds like sign extension at work. Since UNICODE characters are 16 bit, you can mask off bits above that
int number1 = string.GetAt(6);
number1 &= 0xFFFF;
Does that help at all?
I'm confused as to why 351 would be reported as 65534, which corresponds to -2. Is this the negative number you got in the first place?
Steve S
Developer for hire
|
|
|
|
|
1.I am using embedded visual c++ and in that program Unicode was defined as default.
2.I am writing the program for a palm PC which will communicate for example with a computer.
3. int number1 = string.GetAt(6);
number1 &= 0xFFFF;
that lines gave again 65534.I don't know why it is giving this value.
|
|
|
|
|
I found the answer.
I am putting here because maybe there may be someone who wonders the answer.
UCHAR character = string.GetAt(6);
|
|
|
|
|
Hi !
Everybody.
How do I convert WCHAR * to TCHAR * ?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
|
A WCHAR is a set type (an unsigned short).
TCHAR is a type macro that varies depending on whether _UNICODE is defined or not:
If _UNICODE is defined, TCHAR is a wchar_t
If _UNICODE is not defined, TCHAR is a char
So, if _UNICODE is defined, no conversion is necessary.
If _UNICODE is not defined, you may need to convert the string pointed to by the WCHAR* to a char
string. You can use MultiByteToWideChar() API for this.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hello,
I'm currently working on an application that communicates with a Java application. The communication is done using the standard input/output streams (when Java spawn the native application, it can retrieve its I/O streams). Everything works fine except when a byte with value '10' is sent (which correspond to a line feed character). In that case, a cariage return ('13') is added just after it. I know that when working with files, you can avoid this behavior by opening the file in binary mode (instead of text mode). But how can this be done with the cout ? Is there any way to change this behavior without closing the stream and reopening it ? (And even that I don't know if this is possible).
For information, I write data to the stream using the write function:
cout.write(pMyData,myDataSize);
Thanks
|
|
|
|