|
To OvwerRide the function "OnRButtonDown" maybe can work
|
|
|
|
|
Hi,
Thanks for your suggestion.I tried it but it didnt worked..as It can trap right click on the application..not on IE..opened afterwards..IE still has its own context menu..Please help and show any pointers..Thanks a lot in advance..
Himanshu
|
|
|
|
|
xxhimanshu wrote:
..I want to disable Right Click Context menu there..
I do not think this is possible. You would have to change the way IE is responding to a right click ! Maybe you can try to set a global hook, trap the right click if it is made in IE, and destroy the menu as soon as it appear, but I am not sure this would work, and this would not be very easy.
~RaGE();
|
|
|
|
|
Hi,
I knew it is not easy..but I need to do that..can you show me some piece of code as how to create a global hook which traps the mouse events and then find a click in IE window...I shall be highly grateful..
Thanks a lot in advance..
Himanshu
|
|
|
|
|
Subclass the IE window and prevent the default behaviour of the WM_RBUTTONDOWN/WM_RBUTTONUP messages.
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,
I knew it is not easy..but I need to do that..can you show me some piece of code as how to disable the mouse events ...I shall be highly grateful..
Thanks a lot in advance..
Himanshu
|
|
|
|
|
1. Create a new window class derived from CWnd (eg. CMyIEWnd ), and override OnRButtonDown() and OnRButtonUp() . Leave the two functions empty, ie. They should do nothing.
2. Create an instance of your window class, eg. CMyIEWnd window; or CMyIEWnd *pWnd = new CMyIEWnd;
3. Get a handle to the IE window. I assume you can do this, because I don't know the way your application is structured.
4. Call SubclassWindow on your CMyIEWnd class, passing the handle to the IE window to the SubclassWindow function, eg. window.SubclassWindow(hIEWindowHandle); or pWnd->SubclassWindow(hIEWindowHandle);
5. Override OnDestroy() in your window class (CMyIEWnd ) and call UnsubclassWindow() , to unhook your window from the IE window.
Hope this helps,
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"
|
|
|
|
|
Hey ! I try to do my best to discourage another user to block right-clicking in IE, and you give the solution. That's not fair !!
~RaGE();
|
|
|
|
|
Rage wrote:
Hey ! I try to do my best to discourage another user to block right-clicking in IE, and you give the solution. That's not fair !!
Well, be contented by this: If he's trying to run IE as a separate process, it won't work . My solution will work if he's using the web browser control inside his app, IMO that's a good place to block the context menu, so I gave a solution.
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"
|
|
|
|
|
Its a *lot* of work changing the behaviour of another application.
But if you are hosting the WebBrowser ActiveX control in (e.g.) a dialog box in your application, there
are things you can do. You may be able to subclass the window (as suggested by Ryan Binns), or you may
be able to follow the instructions given in: WebBrowser Customization[^] in the MSDN library.
You would implement the IDocHostUIHandler yourself, and handle the IDocHostUIHandler::ShowContextMenu
interface method to disable the right click menu.
Of course, this wouldn't be trivial either!
Would it be that terrible if the user could see the html source of your about box?
Iain.
|
|
|
|
|
Here is a function to finish a verification on Floppy Disk
bool CA::VerifyTest()
{
PVERIFY_INFORMATION lpInBuffer=new VERIFY_INFORMATION;
LPDWORD lpBytesReturned;
DWORD ErrorCode;
lpInBuffer->Length=(DWORD)
m_NumCylinders*m_Heads*m_SectorsATrack; //Number of total bytes
lpInBuffer->StartingOffset.u.LowPart=0;
lpInBuffer->StartingOffset.u.HighPart=0;
lpBytesReturned=new DWORD;
if(DeviceIoControl(
m_hFloppyDisk, // handle to the floppy disk(Already having its value)
IOCTL_DISK_VERIFY, // dwIoControlCode operation
lpInBuffer, // input buffer
sizeof(VERIFY_INFORMATION), // size of input buffer
NULL, // lpOutBuffer; must be NULL
0, // nOutBufferSize; must be zero
lpBytesReturned, // number of bytes returned
NULL // OVERLAPPED structure
)
)
return true;
else
{
ErrorCode=GetLastError();
return false;
}
}
The "ErrorCode" is "1", what's wrong with this?Somebody help me!
Thank you in advance!
|
|
|
|
|
If you'll post the code that initializes m_NumCylinders, m_Heads, m_SectorsATrack, and m_hFloppyDisk, I'll try and reproduce the problem.
|
|
|
|
|
Yes,
m_NumCylinders, m_Heads, m_SectorsATrack and m_hFloppyDisk have been initialized before the function is called.
The ErrorCode means "Incorrect function."
ERROR_INVALID_FUNCTION is designated as 1 in MSDN
In addion, the functin can work well if
m_hFloppyDisk=CreateFile(
"\\\\.\\D:",//1 A drive in HD
GENERIC_WRITE,//2
FILE_SHARE_WRITE,//3
NULL,//4
OPEN_EXISTING,//5
FILE_ATTRIBUTE_NORMAL,//6
NULL//7
);
Is it meaning that the control code "IOCTL_DISK_VERIFY" cannot work well with FDD?
Am I right or not?
|
|
|
|
|
bool CA::SequentialVerify()
{
HANDLE hDrive;
VERIFY_INFORMATION InBuffer;
DWORD BytesReturned;
DWORD ErrorCode;
hDrive = CreateFile(
"\\\\.\\C:",//1
GENERIC_WRITE,//2
FILE_SHARE_WRITE,//3
NULL,//4
OPEN_EXISTING,//5
FILE_ATTRIBUTE_NORMAL,//6
NULL//7
);
InBuffer.Length=1024;//m_NumCylinders*m_Heads*m_SectorsATrack;
InBuffer.StartingOffset.u.LowPart=(DWORD)0;
InBuffer.StartingOffset.u.HighPart=(DWORD)0;
if(DeviceIoControl(
hDrive, // handle to device
IOCTL_DISK_VERIFY, // dwIoControlCode operation
&InBuffer, // input buffer
sizeof(VERIFY_INFORMATION), // size of input buffer
NULL, // lpOutBuffer; must be NULL
0, // nOutBufferSize; must be zero
&BytesReturned, // number of bytes returned
NULL // OVERLAPPED structure
)
)
{
CloseHandle(hDrive);
return true;
}
else
{
ErrorCode=GetLastError();
CloseHandle(hDrive);
return false;
}
}
That's a modified function. You can have a try.
It can work well on Hard Disk like above while it can't when displacing "C:" with "A:"
Can you give me some suggestions? I'll wait for your answers.
Thank you!
|
|
|
|
|
Perhaps the MSDN documentation that states "Floppy disk drivers, however, need not handle this operation" means something.
|
|
|
|
|
I want to find an ActiveX control which can load jpeg/bmp/tif file and display on UI on the fly. I can find many class files in codeproject. However they are helpless for me. I must use AvtiveX control.
Anybody know this?
Software Engineer
Xilin
Software Engineer
|
|
|
|
|
Hi,,
Just wondering if anyone knows how do i overlay a bitmap or draw a frame
onto a video source... I've created a Histogram filter, which inherites from CTransform filter.
HRESULT CHistogram::Transform(IMediaSample *pIn, IMediaSample *pOut)
|
|
|
|
|
Retrieve a pointer to the input bitmap data by using IMediaSample::GetPointer and then you can convert that to a bitmap and draw with an API. Alternatively, you can write your own simple draw routines by moving around the buffer and changing individual pixels.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hello all
I'm writing an application which puts an icon in the systray. I want to code this application in such a way that whenever processing is done at the back the icon needs to be changed indicating some activity. Initially I'm putting the icon in systray using following code
NOTIFYICONDATA tnd;//declared as member variable
tnd.cbSize= sizeof(NOTIFYICONDATA);
tnd.hWnd = m_hWnd;
tnd.uID = IDR_TRAYICON_OFF;
tnd.uFlags= NIF_MESSAGE|NIF_ICON;
tnd.uCallbackMessage = WM_TRAY_ICON_NOTIFY_MESSAGE;
VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_TRAYICON_OFF)) );
tnd.uFlags= NIF_MESSAGE|NIF_ICON|NIF_TIP;
lstrcpyn(tnd.szTip, (LPCTSTR)sTip, sizeof(tnd.szTip)/sizeof(tnd.szTip[0]));
Shell_NotifyIcon(NIM_ADD, &tnd);
After whenever I want to change the icon I'm using the following code
if(tnd.uID==IDR_TRAYICON_ON)
{
tnd.uID=IDR_TRAYICON_OFF;
VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_TRAYICON_OFF)));
Shell_NotifyIcon(NIM_MODIFY,&tnd);
}
else
{
tnd.uID=IDR_TRAYICON_ON;
VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_TRAYICON_ON)));
Shell_NotifyIcon(NIM_MODIFY,&tnd);
}
But I'm not getting the results as expected. The Icon is not changing, Can any one help me in this.
thanks for your help
Hari.
|
|
|
|
|
tnd.uID simply identifies which icon the program is wanting to deal with - it's not the icon resource identifier. I just usually set it to 0 for the first icon, 1 for the second etc. To modify the icon, you have to specify the ID of the current icon so that the tray knows which one you are talking about. Once you add the icon, you can't change the ID. Do something like this:
NOTIFYICONDATA tnd;
tnd.cbSize= sizeof(NOTIFYICONDATA);
tnd.hWnd = m_hWnd;
tnd.uID = 0;
tnd.uFlags= NIF_MESSAGE|NIF_ICON;
tnd.uCallbackMessage = WM_TRAY_ICON_NOTIFY_MESSAGE;
VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_TRAYICON_OFF)) );
tnd.uFlags= NIF_MESSAGE|NIF_ICON|NIF_TIP;
lstrcpyn(tnd.szTip, (LPCTSTR)sTip, sizeof(tnd.szTip)/sizeof(tnd.szTip[0]));
Shell_NotifyIcon(NIM_ADD, &tnd);
nCurrentIcon = IDR_TRAYICON_OFF; And to change it...
if(nCurrentIcon==IDR_TRAYICON_ON)
nCurrentIcon = IDR_TRAYICON_OFF;
else
nCurrentIcon = IDR_TRAYICON_ON;
VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (nCurrentIcon)));
Shell_NotifyIcon(NIM_MODIFY,&tnd); Hope this helps,
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'm working on an MFC application and have a bunch of app settings that I need to save/load somewhere. What is the best way to go about it? I don't want the user to see the saved file, so I was thinking using the registry or .INI files would be a good bet. In any case, I'm not real sure about how to program to the registry or to an INI file, can anyone offer any help or links?
Thanks!
|
|
|
|
|
Correct. I recommend registry. Here are some key MFC registry wrapper functions.
GetProfileInt()
GetProfileString()
WriteProfileInt()
WriteProfileString()
Kuphryn
|
|
|
|
|
Normaly I would search through the MSDN library first.
There is more than one article (+code) at codeproject.
To find the aticles just do the following:
1) In the search text box type in "registry",
2) Select "Titles" from the combobox.
Trust in the code Luke. Yea right!
|
|
|
|
|
The registry it the recommended way unless there are more than 2K of INI settings. Either INI file or registry do not keep the data from the user unless you encrypt the data.
John
|
|
|
|
|
any suggestions? i have an integer set equal to the value of GetCurSel(). i need to use this value in multiple functions, which i have spaced out over different header files. is there a way to acces this one value from all my other files? I've searched the msdn library for info on #ifndef, but i took away the impression thats solely for creating namespaces, which i think might be a little too far out of what i need to do.
thanks,
keegan
*.*
|
|
|
|