|
Try this instead, you were missing sending afddress of rectangle to InvalidateRect:
InvalidateRect(
HWND hWnd, // handle to window
CONST RECT* lpRect, // rectangle coordinates
BOOL bErase // erase state
);
RECT TheRect;<br />
HWND hDesktop = ::GetDesktopWindow();<br />
::GetWindowRect ( hDesktop, &TheRect );<br />
::InvalidateRect( hDesktop, &TheRect, TRUE );
If that does not do it for you, you can just invalidate entire client area of window:
::InvalidateRect( ::GetDesktopWindow(), NULL, TRUE );
|
|
|
|
|
hi blake ,
thnx i lot 4 u r suggestion ,i was able to solve the issue by using
::InvalidateRect(0,0,TRUE);
but still i have a sillly doubt .... i work on Vc++ 6.0 & refering to the msdn ,in Msdn it states that InvalidRect supports only two parameters ,but that never works .can u just brief me about the difference b/w
::InvalidateRect();
InvalidateRect();
bcoz only the ::InvalidateRect works and not InvalidateRect().
thnx in advance
regards
uday
udaykumar
|
|
|
|
|
When you are using MFC programs, typically the function without the colons means it will invoke the MFC version of the function – some function that is a member of an MFC or other C++ class will be invoked.
CWnd::InvalidateRect
void InvalidateRect(<br />
LPCRECT lpRect,<br />
BOOL bErase = TRUE <br />
);
If you want to make sure you call the WIN32 API or GDI version of a function that has the same name as an MFC version of the function, then you put the two colons “::” in front of the function name.
This means the function is invoked at ‘global’ scope and not as a member function of some class.
Here is an example of calling it at global scope:
::InvalidateRect(<br />
::GetDesktopWindow(),
NULL,
TRUE
);
|
|
|
|
|
hi Blake,
Thnx a lot...It was really very kind of u!!!
Thnx again
regards
uday
|
|
|
|
|
hi blake,
thnx a lot!!!It was really good.
thnx again.
regards
uday
|
|
|
|
|
ThatsAlok wrote:
::PostMessage(::GetDesktopWindow(),WM_PAINT,0,0);
Bad idea. That will probably not work. If it does, then you're very lucky
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi Alok ,
thnx i lot 4 u r suggestion ,i was able to solve the issue by using
::InvalidateRect(0,0,TRUE);
but still i have a sillly doubt .... i work on Vc++ 6.0 & refering to the msdn ,in Msdn it states that InvalidRect supports only two parameters ,but that never works .can u just brief me about the difference b/w
::InvalidateRect();
InvalidateRect();
bcoz only the ::InvalidateRect works and not InvalidateRect().
thnx in advance
regards
uday
udaykumar
|
|
|
|
|
if you want to refresh desktop
then use
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);sushil sati
|
|
|
|
|
i can not pass CStringArray from dll....
my dll code here...................
My.h
----
MY_API CStringArray MyName;
MY_API void GetmyName(CStringArray _myname);
My.cpp
------
MY_API void GetmyName(CStringArray _myname)
{
for(int i=0;i
|
|
|
|
|
|
--OR-- Pass the CStringArray address instead of a COPY of the entire string array
MY_API CStringArray MyName;
MY_API void GetmyName(CStringArray* _myname);
My.cpp
------
MY_API void GetmyName(CStringArray* _myname)
{
for(int i=0;i {
_myname->Add(MyName.GetAt(i));
}
}
typedef void (*EXTERNAL_NAME) (CStringArray* _myname);
EXTERNAL_NAME dll_myname;
----
---
--
--
CStringArray aa;
dll_myname(&aa);
for(int i=0;i {
m_ist.AddString(aa.GetAt(i));
}
|
|
|
|
|
great!
this work ...
but i have problem..
i accepted result and then error appear...
i don't know what happen..
Debug Assertion Failed
Program:debug\My.exe
File:dbgheap.c
Line:1011
Expression:_CrtIsValidHeapPointer(pUserData)
Debug Assertion Failed
Program:debug\My.exe
File:dbgheap.c
Line:1076
Expression:_pFirstBlock(pHead)
Application Error
The instruction at "0x10008ba5" refrenced memory at "0xddddddf1":The memory could not be "read".
|
|
|
|
|
Make sure the two files are matched as to their debug versus release builds.
You will get this very commonly if you built your DLL as DEBUG and your EXE as Release and then run them against each other.
The debug build's memory allocator will add extra memory checking data at head and tail of memory blocks, and the release build's memory allocator does not expect this extra data to be there.
Likewise, if memory is allocated by a release build and tested by a debug build, it fails because the memory block's header data appears to be corrupted.
|
|
|
|
|
There is a critical service in my machine which crashes once in a month. I want to write an application which monitors that process and if that crashes sends email, or SMS or if possible restarts the service.
I am trying with Enumerating Process <process.h> . But that doesn't seem to be the solution.
thanx in advance
|
|
|
|
|
Create a watchdog app. Find the handle to the process you need to monitor. Then go into a WaitForSingleObject state. Set a time limit and let the watchdog app time out and process messages occasionally in case you want to shut it down manually.
WaitForSingleObject returns a code that indicates the condition under which the function exits. If it timed out, the process is still running, so you clear the message queue and go back into WaitForSingleObject. If WaitForSingleObject exits because the process ended you send the e-mail, do whatever.
Robert
|
|
|
|
|
Assuming the 'crash' means that the process being monitored has termianted. This will not detect if it has locked up or not - it is still 'running' but uselessly deadlocked or stuck in a loop.
If the monitored process is running as a service, you can periodically query the service control manager to get the service status, too.
|
|
|
|
|
Hi,
I am creating an application, and I would like implement it as an out-of process automation server ( EXE ). I succeeded in doing that, But I have another requirement, which is to make the application singleton. That is, whenever the application is running, and if a request comes in to create an object of the application using say,
Set obj = CreateObject("xxx.yyy")
Then it should return the instance of the currently running application, instead of creating a new one. Could anyone pl. guide me in acheiving this.
Also, It would be really helpful, if you can give me the link to some sample pgms.
Thanks and Regards
Micheal
|
|
|
|
|
I restarted the program I'm working on so it's built on MFC wizards now so new dialogs are easy to integrate into the project. Anywho, how I can disable a combo box? I created a control variable to the combo box but I don't see a function do disable it (and re-enable it later) in code, I only see the option in the Behavior section of the properties window if I select it in the dialog designer mode. I've been looking all around the help files and Google but nothing has surfaced or at least nothing that pops at me.
|
|
|
|
|
EnableWindow()
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Of course I missed that function, now I gotta figure out this data exchange...
|
|
|
|
|
OK, I hope this is just a silly math error, but I'm stumped so far. I'm writing a little log viewer app, and I'm slurping the whole file into memory to parse it. If the user reloads the same file, I don't want to load the whole thing again, just the new data at the end of the file.
I calculate the offsets I'll be reading from/to and the size of the chunk I'll be reading, then pass all that to CreateFileMapping /MapViewOfFile . The problem comes when the file size is over 64K (which is SYSTEM_INFO::dwAllocationGranularity ), MapViewOfFile() fails with ERROR_ACCESS_DENIED .
DWORD dwMappingStartOffset = 0,
dwMappingEndOffset = 0,
dwStartingPosOffsetFromMappingStart = 0,
dwMappingSize = 0;
SYSTEM_INFO si = {0};
GetSystemInfo ( &si );
dwMappingStartOffset = m_dwLastSeenFileSize;
dwStartingPosOffsetFromMappingStart = dwMappingStartOffset % si.dwAllocationGranularity;
dwMappingStartOffset -= dwStartingPosOffsetFromMappingStart;
dwMappingEndOffset = dwFileSize - 1;
dwMappingSize = dwMappingEndOffset - dwMappingStartOffset + 1;
HANDLE hMapping = CreateFileMapping ( hFile, NULL, PAGE_READONLY, 0, dwMappingSize, NULL );
if ( NULL == hMapping )
{
CloseHandle ( hFile );
return false;
}
void* pvFileData = MapViewOfFile ( hMapping, FILE_MAP_READ, 0, dwMappingStartOffset, dwMappingSize );
if ( NULL == pvFileData )
{
CloseHandle ( hMapping );
CloseHandle ( hFile );
return false;
} The other odd thing is that if I change dwMappingSize to 0 on the CreateFileMapping() call - making the file mapping object the size of the whole file - it works fine. I could just do that, but this problem is bugging me, and I'll keep thinking about it until I solve it.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Michael Dunn wrote:
The other odd thing is that if I change dwMappingSize to 0 on the CreateFileMapping() call - making the file mapping object the size of the whole file - it works fine.
From the docs for CreateFileMapping() - "After a file mapping object has been created, the size of the file must not exceed the size of the file mapping object". IMO, this suggests that the size passed to CreateFileMapping() has to be at least the size of the file, not the size of the mapped portion. It's kinda like saying that this parameter gives the size of the virtual address space used by the file mapper, regardless of how much is actually in use.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ah but the rest of that sentence says: if it does, not all of the file's contents will be available for sharing. That's exactly what I want, I don't need a mapping on the entire file. Unless the file mapping is always created from offset 0, which seems to be the case here...
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Michael Dunn wrote:
Ah but the rest of that sentence says: if it does, not all of the file's contents will be available for sharing.
Yep. I read that as meaning that anything after the first <mapping size> bytes is not mappable (if that makes sense ). The way I interpret this size is that it's the maximum file offset that can be mapped by the file mapper, kind of like the address size of virtual memory. Remember old 16-bit machines? Even if you had 2MB of RAM you could only address 1MB of it with pure 16-bit addressing (segment + offset). From your observations, and what I interpret the docs as saying, it sounds like this is the situation.
Oh BTW, I always use the entire size of the file, because it doesn't actually make a difference to memory usage/performance - it's the size of the view that determines memory usage
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
i am a newb and i need an algorithm that can take a string of words and seperate them into seprate words.
|
|
|
|