|
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
*.*
|
|
|
|
|
You could use a global variable, but that's icky.
What you ought to do is declare that integer as a static member variable in a class, and include the header for that class in any CPP that needs it.
e.g. (note, this is just to show the idea how it's done, you should probably have accessor functions instead of making it a public member, but that's beside the point)
(MyClass.h)
class MyClass
{
public:
static int bob;
...
};
(MyClass.cpp)
int MyClass::bob = 0;
...
(SomeOther.cpp)
#include "MyClass.h"
...
void SomeFunc()
{
int number = MyClass::bob;
...
}
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
welp, i gave that a shot, but im getting unresolved external linker errors. i have mine set up exaclt like yours, the only difference is instead of SomeOther.cpp, i have SomeOther.h (figuratively speaking) i dont think that should make a difference...im including the header files in both places. when i say int MyClass::bob = 0; i get a linker error, and also when i try int number = MyClass::bob;.
any suggestions? i've double checked to ensure im including the header file with the declaration of my static int.
*.*
|
|
|
|
|
You do some thing like the following:
extern int g_iMyCurSel;
This can be placed in a header file or source file as long as it is defined in at least one source file. If you wish to place it in several different header files then I would recommend some thing like the following be placed in each one:
// Just in case
#ifndef __G_IMYCURSEL__
#define __G_IMYCURSEL__
extern int g_iMyCurSel;
#endif
Trust in the code Luke. Yea right!
|
|
|
|
|
this too gave me unresolved external symbols.
i put
extern int g_iMyCurSel;
into my header file,
//above the includes in my cpp file
#ifndef __G_IMYCURSEL__
//after the includes in my cpp file
#define __G_IMYCURSEL__
extern int g_iMyCurSel;
//somewhere in my cpp file...
g_iMyCurSel = 0;
//at the end of my cpp file
#endif
this gave me error, linker errors at that.
*.*
|
|
|
|
|
1) This is for use in your header files if and only if you wish to declare the same external variable in multiple header files. You would use it as it appears.
// Start of MyHeader.h
... // unknown code here
#ifndef __G_IMYCURSEL__
#define __G_IMYCURSEL__
extern int g_iMyCurSel;
#endif
... // unknown code here
// End of MyHeader.h
2) If you are going to declare it in 1 and only 1 header file then use:
// Start of MyHeader.h
... // unknown code here
extern int g_iMyCurSel;
... // unknown code here
// End of MyHeader.h
If you only want to declare it only in .cpp file but it needs to be accessed inline inside 1 or more header file then you must do the following before including those header files:
// Start of MyCPPFile.c
... // unknown code here
extern int g_iMyCurSel;
#include "MyHeaderFile.h" // header needing g_iMyCurSel
... // unknown code here
// End of MyCPPFile.c
Trust in the code Luke. Yea right!
|
|
|
|
|
1) Create a header file for the module (.cpp file) containing the global variable.
2) Declare the variable as follows in the header file for your module (.cpp file) as follows:
extern int g_iMyCurSel;
3) Include the header file for your module (.cpp file) before any other header files that needed to have access to your global variable.
Now any file that includes you modules (.cpp files) header file will have access to you global variable.
Trust in the code Luke. Yea right!
|
|
|
|
|
|
If there is a true need for it and you comment it then why not use a global?
There is a reason why global variables work.
Lots of people blindly assume that globals are "BAAAAAAAD!!!!" but if that variable is truly needed across multiple source files then just use a global and be done with it.
Buuuuuuuuuuuuuuuuuuuuuut - 99% of the time the reason you now "need" a global is that there is some structural faults with the design of your application.
I'm going to live forever or die trying!
|
|
|
|
|
Hi
How can I know that a set of VB function is part of COM object?
Ehsan Behboudi
|
|
|
|