|
I had that problem too: Back then I've figured out that the reason for that behaviour was screwed up message pump: WM_PAINT from dialog becoming visible was getting processed before WM_ERASEBACKGROUND of hidden one is getting processed -- both containing same screen device context.
The only solution I came up with back then was: instead of playing with Z-order and visibility -- I was just moving window that becomes "invisible" somewhere to Hawaii without changing visibility, while moving "visible" one to the right position.
Another side effect as I recall right now was: if you use IE WebBrowser window as your property window and change it visibility to not-visible -- it's getting destroyed -- therefore moving technique in my case was the only appropriate solution...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Thanks for the response.
I actually found the apparent "what was causing this", but I still don't understand the "why". I had a call to SetFocus that was setting the focus to the list control (before it would have been painted). Removing this SetFocus call appears to have solved the problem.
I had used Spy++ to look at the WM_PAINT and WM_ERASEBKGND messages. In agreement with your posting, the order of messages didn't make much sense and would fairly clearly cause the problem I experienced.
If anyone has any insight on the "why" of this problem, curiosity is killing this cat.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
Where was SetFocus() being called from?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
It was being called after I was done adjusting the visibility and Z-order of the child dialogs but before the message pump was allowed to run. I'm pretty sure it was the last thing to happen before returning to the message pump.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
i need to be able to load a bitmap and let the user split it up into multiple parts and save the parts to files but i don't know how to split it up... or do the saving...
the user just sets the rows across and down then the program cuts up the bitmap into pieces and save them to a folder...
thanks,
-Slim
*SlimGradey*
|
|
|
|
|
Spilling a bitmap into multiple parts is the easy part, so I'll address that.
If you are going to spilt the bitmap into equal parts then it is simply a matter of creating 1 bitmap for each part and then blitting from the origanal to the new bitmap.
Example:
(0,0) (100,0) (200,0)
+-----------+-----------+
| | |
| part 1 | part 2 |
| | |
(0,100) +-----------+-----------+ (200, 100)
| | |
| part 3 | part 4 |
| | |
(0,200) +-----------+-----------+ (200,200)
1) Create compatible bitmap 1 (100, 100)
part1.blit(0,0,100,100,hdcSource,0,0)
2) Create compatible bitmap 2 (100, 100)
part2.blit(0,0,100,100,hdcSource,100,0);
3) Create compatible bitmap 3 (100, 100)
part3.blit(0,0,100,100,hdcSource,0,100);
4) Create compatible bitmap 4 (100, 100)
part4.blit(0,0,100,100,hdcSource,100,100);
Now you have 4 bitmaps that only contain a part of the origanal.
The trick is saving them to disk!
You can start with by searching for dibsection (and GetDIBits()) in MSDN and at codeproject, codeguru, and sourceforceforge. To use dibsection (or GetDIBit()) you will need to use CBitmap:Bitmap() or ::GetObject(pBmp,sizeof(BITMAP)) and do some calculations in order to figure out what the BITMAPFILEHEADER and BITMAPINFOHEADER will need to contain in order to save the file.
Note: GetDIBits() is your best bet. All you need to to do is create a BITMAPINFOHEADER and pass it to GetDIBits() let it fill in the BITMAPINFOHEADER for you, then let it calculate the amount of storage needed for the image (pixel bits) then call it again to retrieve the image. Then create the BITMAPFILEHEADER and write the results to disk. In reality it's a bit more complicated, but a search of MSDN and the WEB should ease you burdon.
I leave the rest up to you! Search MSDN on how to use GetDIBits().
INTP
|
|
|
|
|
How do i handle events for a Cbutton object created at run time ? Are there many ways of doing this ?
|
|
|
|
|
If you know the ID of the generated buttons at build time (or the range) you could put an ON_COMMAND( id, handler ) entry in the container's message map, but you'll want to put it outside the section managed by the class wizard.
Check out ON_COMMAND_RANGE as well, which might be more useful.
Steve S
|
|
|
|
|
Hi ,
If i do that how do I maintain an unique identifier for my Button !
as of now I am doing this
resetButton->Create("Reset Data",0,bRect,parent,0);
Engineering is the effort !
|
|
|
|
|
Assuming that the CButton is being placed on a dialog and it is not always needed, then use the dialog editor to place the button and set the visibal propety to false. That way you can change it to true only when it is required.
If you are placing the button on a window, you could try processing the command in the preprocessor function before it is passed to the window, or add you own WM_COMMAND() to the message map and add the function to handle it manualy.
INTP
|
|
|
|
|
How do you add messages to the mess. map for controls that are not created using the Dialog Editor, but in run time?
|
|
|
|
|
Having a problem with some registry keys. The MFC command ReqQueryValueEx requires that the name of the key be passed as a pointer to a null-terminated string, or to use their wrapper, an LPTSTR. My project accepts a vector of std::strings. Is there an easy way to convert those into LPTSTR's? I've tried every cast and conversion I could think of, but I don't know these types too well. Thanks.
"He looked rather, in his coat, like a sack full of elderly squirrels attempting to escape."
- Douglas Adams
|
|
|
|
|
LPTSTR is equivalent to char* or wchar_t*, depending on whether you've an MBCS/ANSI or UNICODE build respectively.
Steve S
|
|
|
|
|
Sorry, I should have been more clear with my first post, I was in a hurry. I thought the problem was most likely with how I'm using RegQueryValueEx. Here's what my code looks like:
queryD = RegQueryValueEx(curKey, names[m].c_str(), NULL, &datatype, (LPBYTE)buffer, &bufferlength);
where: curKey = open HKEY, names = std::vector{std::string}, datatype = DWORD, buffer = TCHAR[], and bufferlength = DWORD
This compiles and runs, but does not successfully open any of the keys that it is passed, the return value is 234. As a longtime *nix programmer just making the move to MS programming, I'm starting to get frustrated with this. Any help you could offer would be greatly appreciated.
|
|
|
|
|
badsmonkey wrote:
...the return value is 234.
Which means there is more data. Go forth and get it!
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
What, exactly do you mean?
|
|
|
|
|
Exactly what it sounds like. RegQueryValueEx() is telling you that more data exists. Consult the docs for more details.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
Hi there !
I need to use a web service written in VB.NET .
i want to write a C++ client to use the service. how can
we do it in C+
Abhi....
|
|
|
|
|
Read this[^]. It may not be the ideal approach you are looking for but it is a start.
Good luck.
P.S. You need to install Microsoft Soap Toolkit 3.0 (or 2.0).
[Edit] The service URL has to be in the format "http://MyServer/MyDir/MyService.asmx?wsdl" (note the ?wsdl at the end) [/Edit]
My articles and software tools
|
|
|
|
|
You may try something like that, assuming your Soap request envelope is stored in lpcsSoapEnvelopeFileXML:
MSXML2::IXMLDOMDocument2Ptr request(__uuidof(MSXML2::DOMDocument30));<br />
BOOL bretval;<br />
<br />
request->async = false;<br />
bretval = request->load(lpcsSoapEnvelopeFileXML);<br />
if(bretval)<br />
{<br />
MSXML2::IXMLHTTPRequestPtr serv (__uuidof(MSXML2::XMLHTTP30));<br />
serv->open ("POST",lpcsURL, false);<br />
serv->setRequestHeader ("Content-Type", "text/xml; charset=utf-8");<br />
serv->setRequestHeader ("SOAPAction", lpcsFuncURL);<br />
serv->send (_variant_t(request->xml));<br />
<br />
MSXML2::IXMLDOMDocument2Ptr response;<br />
response = serv->responseXML;<br />
<br />
csResponce = (LPCSTR)serv->responseText;<br />
}<br />
return csResponce;
On return you have to parse csResponce text or response XML...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
ThankX igor1960
It works nicely.
Abhi....
|
|
|
|
|
ThankX igor1960
It works nicely.
Abhi....
|
|
|
|
|
i am writing a download software, but i don't know the protocol of mms . where i can find this ?
help me ~
thanks
i love j2ee and vc.
|
|
|
|
|
i am writing a download software, but i don't know the protocol of mms . where i can find this ?
help me ~
thanks
i love j2ee and vc.
|
|
|
|