|
My application is having one Main window. Which has two child windows. I am showing the child windows side by side.Once if we scroll any of the child windows scrollbar. Both should scroll together.
Please let me know if you have any idea.
Thanks in advance
|
|
|
|
|
Whenever a scroll operation happens in a child window, the window will receive a WM_HSCROLL or WM_VSCROLL message depending on what scroll operation is done.
To make the other child window also do the similar scroll operation you could propogate the same scroll message to the other child window from the WM_HSCROLL or WM_VSCROLL handler using PostMessage .
|
|
|
|
|
The trouble with forwarding messages to another window is what happens (as in the questioners case) if that window has the same behaviour? Each window will send WM_*SCROLL back and forth until someone gets bored.
Cheers,
Ash
|
|
|
|
|
The lParam for these messages are there to handle this situation.
|
|
|
|
|
Good point, I forgot about the NULL lParam,
Cheers,
Ash
|
|
|
|
|
Thanks.. It was really helpfull
|
|
|
|
|
If I were you I'd stick the scroll bars on the frame window. When someone clicks the scroll bar you can scroll the child windows, either by forwarding them the scroll bar messages or using a custom message.
Cheers,
Ash
|
|
|
|
|
Hello all
I want to programa maze in c.
Does anyone have a paper about it.
Thanks in advance.
|
|
|
|
|
Writting a 'maze type game' would be a great project but no one here is going to do your reaearch for you.
If you genuinely want to write a program then try to research it yourself (there are plenty of great articles on this website and Google is a good place to start too), then come back with specific questions.
Good Luck!
Ali
|
|
|
|
|
Hi,
I'm now using the File* to save the data into text file. But i notice that if the file i want to save is in open mode, then the program will crash. Any way to prevent it? Below is snap of my code..
In *.h file
FILE *handle;
in *.cpp file
fopen_s(&handle,cPathName,"wt");
fprintf(handle,"<?xml version=\"1.0\"?>\n")
|
|
|
|
|
fopen_s has a return value that you must check for errors.
This way you will write only if the open operation was successful, thereby avoiding the crash.
|
|
|
|
|
Are you checking that handle actually points to something? i.e. check the handle for being NULL. If you call any file function with a zero pointer it might very well crash if it dereferences a NULL pointer.
Cheers,
Ash
|
|
|
|
|
Please check if the "handle" is NULL.
fopen_s(&handle,cPathName,"wt");
if (handle != NULL)
{
fprintf(handle,"<?xml version=\"1.0\"?>\n")
}
|
|
|
|
|
Hi,
If use bitblt to change the Background of a bitmap
The later I use that bit map in some other fuction will the background remain or is the bsckground only
valid while the bitmap is selected in the DeviceContext
Thankx
|
|
|
|
|
BitBlt works on a device context.
A device context can only have one bitmap selected into it.
So what ever you draw to that DC will remain valid through out its life time.
So taking the device handle from the device context to draw else where will work as you expect.
|
|
|
|
|
Hi,
I have the following code which paints a Gray Baxkground on a Bitmap consisting of a yellow around
and a while background
CBitmap *bm = new CBitmap;
bm->LoadBitmap((UINT) IDD_BITMAP);
CDC *cdcimage = this->GetDC();
cdcimage->SelectObject(bm);
CDC cdcimage1, cdctrans;
COLORREF oldback = cdcimage->SetBkColor(RGB(255,255,255));
COLORREF oldtext = cdcimage->SetTextColor(RGB(0,0,0));
cdcimage1.CreateCompatibleDC(cdcimage);
cdctrans.CreateCompatibleDC(cdcimage);
cdcimage1.SelectObject(bm);
BITMAP bm_struct;
bm->GetBitmap(&bm_struct);
CBitmap bmask;
bmask.CreateBitmap(bm_struct.bmWidth,bm_struct.bmHeight,1,1,NULL);
cdctrans.SelectObject(&bmask);
cdcimage1.SetBkColor(RGB(125,125,125));
cdctrans.BitBlt(0,0,bm_struct.bmWidth,bm_struct.bmHeight,&cdcimage1,0,0,SRCCOPY);
cdcimage->BitBlt(0,0,bm_struct.bmWidth,bm_struct.bmHeight,&cdcimage1,0,0,SRCINVERT);
cdcimage->BitBlt(0,0,bm_struct.bmWidth,bm_struct.bmHeight,&cdctrans,0,0,SRCAND);
cdcimage->BitBlt(0,0,bm_struct.bmWidth,bm_struct.bmHeight,&cdcimage1,0,0,SRCINVERT);
cdcimage->SetBkColor(oldback);
cdcimage->SetTextColor(oldtext);
later I pass the handle
stgm.hBitmap = (HBITMAP)*bm;
to an OLE Richedit interface
However the bitmap remain as it on the file with a white background
any ideas
thankx
|
|
|
|
|
Hi
I do all my painting to CRichedit DC
I think I need do it to a memory DC then give the bitmap handle
to OLE
|
|
|
|
|
When a new SOCKET is generated by a client connection to the server
I understand the SOCKET in question holds a unique integer number.
What I would like to know is; if the client in question associated with this number logs off or de-connects, is this number then available for other connecting clients or is it ‘gone when its gone’.
I am using the code from Boby Thomas Pazheparampil, May 2006 implementation of the client server text messaging in the articles. Also please note that I have outputted the number associate when a client connects in this program and they roughly start in 1800 series and descended at various intervals(1780,1778 etc) doe anybody know why this is so, and the limits of the number of connections also?
I am developing a program where the appropriate id of auser is associated with the socket.
Thanks in advance for helping
Simon
|
|
|
|
|
Basically your question is, if the operating system reuses socket handles?
Yes, I would guess that with a long running server application there is no other way for the operating system. On Windows this definitely happens, see Winsock Programmer's FAQ[^]. In my networking applications I separate session/user handling from low-level networking, which means every user gets a unique ID assigned. There are many ways to create an ID, for example use the current UTC time paired with a random value. Alternatively, if you just need an unique internal reference, you could use this pointer of your C++ object.
Not sure if this answered your question?
M
|
|
|
|
|
I need to synchronise contacts from our DB with user profiles in an exchange server. Can anyone suggest which API / SDK to use to achieve this from a C++ application? The idea is users can flag contacts in our application as being one they want synchonised with their mobile phone eg. each account manager will want contact details for their customer accounts.
|
|
|
|
|
Hi,
This is not exactly a programming Q.
I have wireless HP mouse.
It has two side button for backward / forward page.
I want to map one of the key as ESC.
How I can do it?
BT
|
|
|
|
|
a.k.a BT wrote: This is not exactly a programming Q.
So why put it in a forum reserved for C/C++/MFC?
It's time for a new signature.
|
|
|
|
|
if by programming it can be done.
I think its possible. Thats why I posted.
BT
|
|
|
|
|
VK_BROWSER_BACK and VK_BROWSER_FORWARD ,
How to capture these events and through ESC key event globally?
BT
|
|
|
|
|
a.k.a BT wrote: if by programming it can be done.
I think its possible. Thats why I posted.
But your first message said :
a.k.a BT wrote: This is not exactly a programming Q.
It's time for a new signature.
|
|
|
|