|
Nice method. Thanks!
The below is tested one.
void main()
{
std::string messages = "MSG: Apple. MSG: Banana.";
std::string::size_type p = messages.find ( "MSG" ) ;
std::string::size_type p2 = std::string::npos ;
while ( p != std::string::npos )
{
p2 = messages.find ( "MSG", p + 1 ) ;
string ss = messages.substr ( p, p2 );
cout << ss << endl;
p = p2 ;
}
}
Maxwell Chen
|
|
|
|
|
How to find - which area of Window made "invalid" ?
When else window moves over my CDialog,
I need to find which area is declared as "invalid",
to redraw background of appropiate childs,
but nt All each time.
- in OnEreaseBackground(CDC* pDC)
Thanks.
|
|
|
|
|
GetUpdateRect(..);
might be of some help to you.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Thanks.
How to set for control another Client area ?
|
|
|
|
|
vgrigor wrote:
How to set for control another Client area ?
I didnt get your question.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Need to enlarge child window area,
ao hay react according to event on that other area.
|
|
|
|
|
If you have the pointer to the child window or a window handle to that child window then you can use SetWindowRect(...) to resize the window.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
thanks, but it is need to get size to
draw as previously.
But react as bigger thing.
some clipRect function does not that ?
|
|
|
|
|
Sorry i am out of ideas
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
No problem - not all people here have ones.
|
|
|
|
|
GetUpdateRect / GetUpdateRgn , depending on whether you want to deal with the full complexity of a region, or just the rectangle that contains all the invalid parts.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi ALL,
I want to retrive the URL of the currently displayed page for that I am using the following code
in SetSite() function:
<br />
SetSite() <br />
{<br />
CComBSTR bstrURL;<br />
hr = GetSite(IID_IServiceProvider, (void**)&spSrvProv);<br />
<br />
hr = spSrvProv->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2,<br />
(void**)&spWebBrowser);<br />
<br />
if (FAILED(spWebBrowser->get_LocationURL(&bstrURL)))<br />
return false;<br />
}<br />
But the contains of bstrURL is emtpy. where I am making a mistake?
Also want to know when Setsite function is invoked before or After loading the page,
When debugged its my guess that it is called before loading the page,
if this is the case how i can get the URL?
Can anyone please help me.
Thanks in Advance.
AL
|
|
|
|
|
I have one BMP file. i want to load that bmp file into a form. Please tell me the procedure.
Thanks
JP
ALL THINGS ARE POSSIBLE UNTIL THEY ARE PROVED IMPOSSIBLE-AND EVEN THE IMPOSSIBLE MAY ONLY BE SO,AS OF NOW
|
|
|
|
|
In the OnDraw function write codes as follow
CBitmap img;
img.LoadBitmap(IDB_IMG);//IDB_IMG is ID of the resource.
CDC * pMemDC=new CDC;
pMemDC->CreateCompatibleDC(pDC);//pDC pointer to DC of current window
pMemDC->SelectObject(&startImg);
pDC->StretchBlt(0,0,cr.right,cr.bottom,pMemDC,0,0,1024,768,SRCCOPY);
delete pMemDC;
I am a Chinese and my English is very poor,so I wish you correct my mistake.
YangXiaowei(China)
|
|
|
|
|
CString szFilename("path to ur bmp file");
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL,szFilename,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp;
bmp.Attach(hBmp);
CClientDC dc(this);
CDC bmDC;
bmDC.CreateCompatibleDC(&dc);
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
BITMAP bi;
bmp.GetBitmap(&bi);
dc.StretchBlt (0,0,500,500,&bmDC,0,0,bi.bmWidth
,bi.bmHeight,SRCCOPY);
// please see the parameters for StretchBlt() and pass them accordingly
bmDC.SelectObject(pOldbmp);
|
|
|
|
|
how to pass through two level http proxy? or are there any information article about it? thanks
|
|
|
|
|
As the Thread title Suggests I am having a problem taking 2 chars (which make up a byte) from the array and placing it into an Integer Variable all the while allowing it to retain its value. I have books here that Explain Type Conversion, but it does not go into Copius Detail on char to int conversion.
The 2 char values I am trying to take from the array will end up being a HEX Value within the Integer Variable.
I am trying to do 2 things:
1). Convert 2 chars from the array into an Integer HEX Value
2). Convert that New HEX Valued Integer to a Decimal Integer Value.
For the Sake of this thread, I will give an example:
RawPacket[8] = 3
RawPacket[9] = 9
Now this comes from the following Data within the array:
[code]
4840200039 |Array Data
----------
0123456789 |Corresponding Array Position
[/code]
What I want to do is take that 3 and 9, put it together and put 39 into an int variable.
Then take that 39 and convert it into a decimal value which in this case would be 57.
Another Example:
[code]
484020005C |Array Data
----------
0123456789 |Corresponding Array Position
[/code]
What I want to do is take that 5 and C, put it together and put 5C into an int variable.
Then take that 5C and convert it into a decimal value which in this case would be 92.
I have had some algorithms given to me, but none of them worked.
Hopefully someone here can help me if possible.
Thank you
|
|
|
|
|
I dont know if there would be a better way than this one. Please try this function:
#include <stdlib.h>
#include <iostream.h>
int Convert(char a, char b);
void main(){
cout << "" << Convert('A', 'A') << endl;
}
int Convert(char a, char b){
int intTemp, intVal = 0;
char strBuffer[3];
strBuffer[0] = a;
strBuffer[1] = '\0';
intTemp = atoi(strBuffer);
if (intTemp != 0){
intVal = intTemp << 4;
}
else{
switch (toupper(a)){
case 'A':
intVal = intVal | 0xA0;
break;
case 'B':
intVal = intVal | 0xB0;
break;
case 'C':
intVal = intVal | 0xC0;
break;
case 'D':
intVal = intVal | 0xD0;
break;
case 'E':
intVal = intVal | 0xE0;
break;
case 'F':
intVal = intVal | 0xF0;
break;
default:
return 0;
break;
}
}
strBuffer[0] = b;
strBuffer[1] = '\0';
intTemp = atoi(strBuffer);
if (intTemp != 0){
intVal = intVal | intTemp;
}
else{
switch (toupper(b)){
case 'A':
intVal = intVal | 0x0A;
break;
case 'B':
intVal = intVal | 0x0B;
break;
case 'C':
intVal = intVal | 0x0C;
break;
case 'D':
intVal = intVal | 0x0D;
break;
case 'E':
intVal = intVal | 0x0E;
break;
case 'F':
intVal = intVal | 0x0F;
break;
default:
return 0;
break;
}
}
return intVal;
}
SDE
|
|
|
|
|
Hi
I have 5 seperate Device contexts in which i load 5 bmp's and position them on the screen such that it looks as if it is 1 bmp.
How to combine these 5 dc's into 1.
Thanks and regards,
Salil
|
|
|
|
|
I assume they are memory dc....
Cant you make one more memory dc and bitblt each dc onto this memory dc? this way you convert all 5 memdc's to one dc.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Hi,
This is how my OnDraw() looks like and i am having trouble scrolling it
Thanks and regards,
Salil.
CString szFilename("d:\\vc\\mfc\\2001.bmp");
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL,szFilename,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp;
bmp.Attach(hBmp);
CClientDC dc(this);
CDC bmDC;
bmDC.CreateCompatibleDC(&dc);
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
BITMAP bi;
bmp.GetBitmap(&bi);
dc.StretchBlt (0,0,len_in_pix,ht_in_pix,&bmDC,0,0,bi.bmWidth
,bi.bmHeight,SRCCOPY);
bmDC.SelectObject(pOldbmp);
CString szFilename1("d:\\vc\\mfc\\2002.bmp");
HBITMAP hBmp1 = (HBITMAP)::LoadImage(NULL,szFilename1,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp1;
bmp1.Attach(hBmp1);
CClientDC dc1(this);
CDC bmDC1;
bmDC1.CreateCompatibleDC(&dc1);
CBitmap *pOldbmp1 = bmDC1.SelectObject(&bmp1);
BITMAP bi1;
bmp1.GetBitmap(&bi1);
dc1.StretchBlt (0,br_in_pix,len_in_pix,ht_in_pix,&bmDC1,0,0,bi.bmWidth
,bi.bmHeight,SRCCOPY);
bmDC1.SelectObject(pOldbmp1);
CString szFilename2("d:\\vc\\mfc\\2003.bmp");
HBITMAP hBmp2 = (HBITMAP)::LoadImage(NULL,szFilename2,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp2;
bmp2.Attach(hBmp2);
CClientDC dc2(this);
CDC bmDC2;
bmDC2.CreateCompatibleDC(&dc2);
CBitmap *pOldbmp2 = bmDC2.SelectObject(&bmp2);
BITMAP bi2;
bmp2.GetBitmap(&bi2);
dc2.StretchBlt (0,br_in_pix+ht_in_pix,len_in_pix,br_in_pix,&bmDC2,0,0,bi.bmWidth
,bi.bmHeight,SRCCOPY);
bmDC2.SelectObject(pOldbmp2);
CString szFilename3("d:\\vc\\mfc\\2004.bmp");
HBITMAP hBmp3 = (HBITMAP)::LoadImage(NULL,szFilename3,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp3;
bmp3.Attach(hBmp3);
CClientDC dc3(this);
CDC bmDC3;
bmDC3.CreateCompatibleDC(&dc3);
CBitmap *pOldbmp3 = bmDC3.SelectObject(&bmp3);
BITMAP bi3;
bmp3.GetBitmap(&bi3);
dc3.StretchBlt (0,2*br_in_pix+ht_in_pix,len_in_pix,ht_in_pix,&bmDC3
,0,0,bi.bmWidth,bi.bmHeight,SRCCOPY);
bmDC3.SelectObject(pOldbmp3);
CString szFilename4("d:\\vc\\mfc\\2005.bmp");
HBITMAP hBmp4 = (HBITMAP)::LoadImage(NULL,szFilename4,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp4;
bmp4.Attach(hBmp4);
CClientDC dc4(this);
CDC bmDC4;
bmDC4.CreateCompatibleDC(&dc4);
CBitmap *pOldbmp4 = bmDC4.SelectObject(&bmp4);
BITMAP bi4;
bmp4.GetBitmap(&bi4);
dc4.StretchBlt (0,2*br_in_pix+2*ht_in_pix,len_in_pix,20,&bmDC4
,0,0,bi.bmWidth,20,SRCCOPY);
bmDC4.SelectObject(pOldbmp4);
|
|
|
|
|
1) Create 2 compatible device contexts: a DC (dcTemp) to temporarly hold current bitmap and a DC (dcOut) to hold the results of bliting.
2) Create a compatible bitmap large enough to hold all 5 bmp's.
3) Select large bitmap into dcOut. (save pOldOutBitmap here)
4) Select bitmap[0] into dcTemp. (save pOldBitmap here - need when finished)
5) Determine what position to blit bigmap to.
6) Blit bitmap[0] (dcTemp) to position in dcOut.
7) Select bitmap[1] into dcTemp.
8) Determine what position to blit bigmap to.
9) Blit bitmap[1] (dcTemp) to position in dcOut.
....
// Now all the bitmaps are in 1 DC.
N) Select pOldBitmap (dcTemp.SelectObject(pOldBitmap);).
N+1) Blit result to client area (pDC->BitBlt(...,&dcOut,...);).
N+2) Select pOldOutBitmap (dcTemp.SelectObject(pOldOutBitmap);).
That is all there is to it.
If you want to increase draw speed then you should create the large bitmap as a member variable and then create a function to copy, using above method, the 5 bitmaps to it. That way you do not need to do all the coping in the OnDraw function, just blit the stored bitmap to the client area.
If you want to you could create an array of bitmap IDs and use a loop to preform the repeated select, calc. position, and dcOut blits. That is how I whould do it, because then to add another bitmap all you need do is add its ID to the array.
Well I hope this helps.
Good Luck!
INTP
|
|
|
|
|
Maybe a newbie question, but I'll ask anyway. Using visual c++ 6.0, I click and drag a bitmap onto the dialog box, set it to a picture I've imported and there it is on the screen at runtime. Now say I want to click a button that would make that "static" bitmap move across the screen to another location by simply accessing the x,y cooridnates and doing some type of UpdateWindow? The code I've seen on here for pages and pages of DC rect this and that just seems a great deal to do for something that should be so simple.
thanx
Dimenser
|
|
|
|
|
There is nothing simple about it! It only looks that way to the user. Doing drag and drop is actualy easier, since Windows has built in support for that; otherwise it would be just as hard.
INTP
|
|
|
|
|
Hi
have a messagebox window which has some text and an "OK" button
I have used EnumWindows to track down the handle to the messagebox window
from there i can get a cwnd* to the window.
I would like to know how to tell the messagebox to close by simulating a button click onthe OK button.
SPY++ tells me control id for the OK button is 2
so i figured a postmessage BN_CLICKED to the messagebox window with the ID set to 2 woudl work..but no luck
the messagebox needs to be closes properly not just hidden or minimized
does anyone have any suggestions/what am i missing?
regards
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|