|
You might also want to ask here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
Create mfc dialog base application and put an activex control on dialog (calender control or web browser control). Initialize activex control with some data
execute the application. activex control on Dialog box displays the data.
right click on activex control-> context menu appears
how to avoid this context menu and any other mouse/keyboard operations on activex control
|
|
|
|
|
check whether activex control exposes any functions to suppress menus.
If not, override PreTranslateMessage() function for your parent window, and simply do return for the messages that generates menus on ativex control
for eg, for Mouse right button click/double click:
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_RBUTTONDOWN || pMsg->message == WM_RBUTTONDBLCLK)
return TRUE;
return CDialog::PreTranslateMessage(pMsg);
}
you may do further filtering by checking pMsg->pt or pMsg->hwnd members also.
|
|
|
|
|
it's not working for windows media player activex control
|
|
|
|
|
"check whether activex control exposes any functions to suppress menus"
on windows media player activex, set enableContextMenu property to False.
or call put_enableContextMenu(FALSE)
|
|
|
|
|
hello guys...lets suppose we have 3 buffers, how can we allocate and lock memory for these three buffers?? thanx for ur thoughts
|
|
|
|
|
|
have a look at the VirtualAlloc, VirtualLock API ...
M.
Watched code never compiles.
|
|
|
|
|
You ought to explain what you mean by "lock." Depending on who you are it might mean "allow only one thread to access the memory", "disable paging for the memory", "don't allow memory to move in the virtual address space" or one of several others.
Cheers,
Ash
|
|
|
|
|
You can use the GlobalAlloc and GlobalLock APIs.
Or you can use HeapAlloc which is what is internally called by the new operator .
|
|
|
|
|
Hi all, I am using Visual Studio 2005 with MFC application. I have create a transparent window with following codes:
HINSTANCE hInst = ::GetModuleHandle(NULL);
WNDCLASSEX wc;
wc.cbSize=sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject( NULL_BRUSH );
wc.hCursor = LoadCursor( NULL, IDC_CROSS );
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hInstance = hInst;
wc.lpfnWndProc = (WNDPROC) CCaptureDlg::WndProc;
wc.lpszClassName = L"Test";
wc.lpszMenuName = 0;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.hIconSm = NULL;
m_hWnd=::CreateWindowEx(WS_EX_TRANSPARENT|WS_EX_TOPMOST,L"Test",0, WS_VISIBLE|WS_POPUP,0,0, m_ComputerResolutionX, m_ComputerResolutionY,0,0,0,this);
In that Window "Test", I can drag and draw a rectangle but when I keep dragging and moving the mouse around the screen, it does not clear off my previous drawing, is there a way to clear off my previous drawing? I have tried FillRect as following but still does not work:
case WM_MOUSEMOVE:
{
if (pClass->m_MouseDown==1)
{
HDC hdc;
hdc = ::GetWindowDC(hwnd);
RECT re;
SetRect(&re, 0,0,pClass->m_ComputerResolutionX,pClass->m_ComputerResolutionY);
HBRUSH brush =(HBRUSH)::GetStockObject(NULL_BRUSH);
if (pClass->m_tempPoint.x!=p.x && pClass->m_tempPoint.y!=p.y)
{
static int count = 0;
TRACE(L"Test %d\n", count++);
FillRect(hdc,&re,brush);
pClass->m_tempPoint=p;
}
CPen mypen(PS_DOT, 1, RGB(0,0,0));
HPEN pen = (HPEN)mypen;
SelectObject(hdc, pen);
SelectObject(hdc, brush);
::Rectangle( hdc, pClass->m_InitPoint.x, pClass->m_InitPoint.y, p.x , p.y);
}
break;
}
Or is there another way to remove my previous drawing on this transparent window other than FillRect? I would be pleased to learn about it. TQ~
Teaching and learning is a cycle...
Learning something new enable to teach others;
Teaching others enable self learning.
|
|
|
|
|
You should not be drawing to your window in the message handler for the mousemove. The mouse move code should set the limits and other details of your shape, but the actual drawing should be done in your OnDraw() or OnPaint() handler. There are lots of samples on MSDN[^].
It's time for a new signature.
|
|
|
|
|
what if i use bitblt to draw the rectangle?
However, there is a problem i faced, after i've bitblt, the background turns to be black color. I just don't why?
"BitBlt(Hdc, 0, 0, pClass->m_ComputerResolutionX, pClass->m_ComputerResolutionY, pClass->m_MemDC, 0, 0, SRCCOPY);"
The bitblt was done in WM_PAINT.
Anyone has any ideas?
|
|
|
|
|
I'm not sure why this question was posted to me.
It's time for a new signature.
|
|
|
|
|
Additional to the words of Richard
this "dotted rectangle"[^] could be used...
virtual void BeHappy() = 0;
|
|
|
|
|
Hi,
How to resize the controls in a form view to fit to the availble size.
I have developed one formview application with screen of 1024X768.
When this application runs in another system having more or less resolution
it seems to be ugly.
How to resize the controls in a formview regardless of the resolution?
|
|
|
|
|
This[^] layout manager should do the work.
|
|
|
|
|
|
I was wrong. I forgot to add the 'class' in the syntax of the template! Extremely sorry for the inconvenience.
modified 7-Feb-12 1:20am.
|
|
|
|
|
Visual C++ 6.0 has lots of standard compliance problems[^], but it will be not fair to accuse it before analyzing your code.
|
|
|
|
|
Post the code please.
It is best to always assume that the tool, API etc are correct and the problem is in our code. And it usually will turn out to be so. Especially since, as you say, there were no problems with the earlier template class.
...byte till it megahertz...
|
|
|
|
|
Post SOME of the errors and the relevant code.
and in general rule, if an installer was not finished, you need to wait for it to finish and/or "repair" and/or re-install .
Watched code never compiles.
|
|
|
|
|
Hi guys!
I am currently doing a client/server connection through the sockets. And facing some problems.
My task definition: Create a socket for each connected clients to the server. Use the threads to maintain waiting process and message send-receive process.
So, right now I have 2 clients and one server. I created 2 threads, first one supports to listen when clients try to connect to server. The second one provides to receive and send the messages.
However, the problem is : when I create first thread (hThread1), the second has not turn means always hThread1 works and does not allow to start to hThread2.
Please help!
Anywhere I attach essential sides of my code and let's discuss it. Even though I am new at C++, I believe I could do it with you guys.
Thnks!
DWORD createSocket(char *, int); //prototype of createSocket function for each clients
DWORD receiveMsg(SOCKET); // prototype of a receive message function
DWORD threadId;
HANDLE hThread1 = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)createSocket(IP_Addr, port), port, 0, threadId);
if (hThread1 == NULL)
{
cout<<"Error at creating thread..."<
|
|
|
|
|
mashhur wrote: My task definition: Create a socket for each connected clients to the server. Use the threads to maintain waiting process and message send-receive process.
Start with a working networking example, creating a multi-threaded server in C++ is not a trivial task.
Have a look at Internet and Networking and Winsock FAQ[^].
Hope this helps!
|
|
|
|