|
Hi Max,
you can override OnRButtonDown event.
Create your own menu and display it when Right mouse button is clicked.
Anurag Gandhi.
|
|
|
|
|
I draged and droped an added registered activex control FPCapX on simple dialog in dialog based application used to display image from hardware attached.
When I start using any of its method which interact with hardware ,it gives this assert in debug mode,and in release mode it simply does not work.Control works very simply in VB applications. Actually each of this methods internally calls InvokeHelper function where the assert comes. When I searched on google about bug I found that
Activex Control is not initialised. Can anyone help on this please.
|| ART OF LIVING ||
|
|
|
|
|
|
thanks for your answer but I didnot understood where com comes into picture.
I have one COM project,though I got more theoritical knowledge than practical due to that project,I know some thing of COM.
I have added current control as per first article only.
Now my question is ,if as per your suggestion if I have to
write cointialise(NULL),where should I write.Because as per my knowledge you need to write coinitialise only for RAW COM development.
Will you please help me out.
|| ART OF LIVING ||
|
|
|
|
|
ok, obvious I dont work with ActiveX controls as much as I should, yes, I usually work with RAW COM ..
see if this thread has useful info (basically the programmer was trying to perform requests to the ActiveX object before it was initialised - in a MFC Dialog app, DoModal() inits the dialog which then inits the control)
http://p2p.wrox.com/topic.asp?TOPIC_ID=36521[^]
oh, and I went to the website for the control, and its documentation is next to useless - Id recommend you send them a note, if it was a bonafide purchase, and ask them to supply you a working example - A halfway decent supplier should always do this
'g'
|
|
|
|
|
Thank you very much for your help and efforts you took for me.
Actually in that article one is trying to set values to activex control before its dialog gets initialised. but I am trying to use capture mwthod of activex far after dialog is loaded and when user clicks button capture. One more point i want to tell you, if instead of drag and drop from control toolbar if I create control using create function of it,it doesnot give assertion but it simply does nothing.
|| ART OF LIVING ||
|
|
|
|
|
well, I take it we are talking about the same thing http://info.bioenabletech.com/Products/VB-OCX-SDK/sdk-user-guide/sdk-user-guide[^]- from http://www.bioenabletech.com/[^]
as I said, their website is pretty horrible - I cant even display their SDK help 100% ... I'd send them an email or call them and ask for a working example in c++ for MSVC6 Dialog app....
I notice their SDK says VB-OCX-SDK, but I cant imagine why an activex would only work with VB... unless there's something I dont know about how VB instantiates an activex control thats different from c++ (always possible)
Apart from it being a licensing issue (is there a .lic file ?), without much more to go on I can help much
'g'
|
|
|
|
|
yes this is same control from same company,its ftp site . I was also puzzeled by seeing term VB_OCX_SDK. How come anything be like this .
Anyway I am trying to contact the company.
We have purchased software for sixty days,thats what company which I newly joined told me. I dont know its purchased or trial version. But control works very simply with VB. There is slight difference
in VB when we add component BioFP in VB it adds to controls FPCapX and FpVerifyX. But in vc when you go in Add registered Activex Controls
you can directly see two controls FpCapx,FPVerifyX.Which after inserting gets added to control toolbar. When I tried to search ocx there is only one ocx in system32 ie BioFp. Neither FpCapX nor FpVerifyX. How come I dont know ? There is no file called FpCapx.ocx or BioFp.FpCapx.ocx .
Note In VC when this controls from toolbar are added they respectively create same classes as thier names.
|| ART OF LIVING ||
|
|
|
|
|
Hi all:
Just been wondering the difference between map and pair.
I think:
map<val1, val2=""> where val1 and val2 can be variables of deeper depth, like another map or vector or pair, but for
pair<val1, val2=""> where val1 and val2 are of simple variable types, like string or char.
Am I right?
Thank you
|
|
|
|
|
without looking it up or pointing you to a refernce, no, you are incorrect.
A Pair can store containers like map, vector, or even other pairs, as either val1 and/or val2. The difference lies in how they are used - a Map is often called an associative container - I often think of the left hand element val1 being an index to the right hand element - that is, (could get myself into trouble here), one tradionally searches or iterates the left hand side or val1 to return the corresponding val2 element.
(maybe someone else has a better explanation)
'g'
|
|
|
|
|
All a pair does is hold two things, that's it. They can be anything at all.
A map is a container class where the types of the keys and values are fixed. Some parts of the map interface use a pair object to return a key/value pair (for example, using * on an iterator returns a pair ).
|
|
|
|
|
Hi All,
Is anyone aware how to back patch an exe as a post build step? The requirements are a bit vague (to the reader) at this point, but they will make sense on my next article.
In a nutshell, if I have the following declaration:
unsigned int i = 0;
and would like to place a value (for example 1234) in it's place after the compilation pass, how would I perform the operation? Or would I simply compile again once the value of i is determined.
Thanks In Advance,
Jeff
|
|
|
|
|
I remember in (a galaxy/time long ago) when we used to write particular data to the end of the exe - when the exe next opened, it would detect if the data was there by a signature and use that (IIRC we also had to recalculate the checksum of the file) .. I dont think that would help you, this was in DOS days
I offer two suggestions (not sure if they will help) :-
a) store the data in the resource table - it can be modified by adding a custom post build step to fang off a program to edit the resource value
b) Using Matt Pietrek's notes on the PE format etc, maybe you can create a value in the .DATA segment (or such), and write directly back into the exe, by locating that segment/value in the compiled exe ??
apologies if this isnt what you want
'g'
|
|
|
|
|
Hi Garth,
Garth J Lancaster wrote: Using Matt Pietrek's notes on the PE format etc, maybe you can create a value in the .DATA segment (or such), and write directly back into the exe, by locating that segment/value in the compiled exe ??
I pretty much crawled his code in Dynamic TEXT Section Image Verification[^], an article which detects Hardware Faults and Unauthorized Patching.
I'm now writing the Self Healing Code compliment to the previous article.
Garth J Lancaster wrote: store the data in the resource table - it can be modified by adding a custom post build step to fang off a program to edit the resource value
This was the direction I was going to lead the article. However, I've gotten some interesting results from Compiler code generation, so I think I'm going to stay with back patching (not only will it be mentioned, I will now credit you with it - it is always nice to share). My research did turn up Adding and extracting binary resources[^] by Adrian Cooper which I was going to cite and modify for use.
Jeff
|
|
|
|
|
cool, thanks - I realise only one of those methods was 'back patching' in a true sense (ie I wasnt sure if resource editing could be considered as such, more as a way to acheive a similar result, given assistance from MS tools - it would probably form a whole new article going into the differences and why/why nots of each technique)
Looking forward to reading your article (as always )
'g'
|
|
|
|
|
Hi Garth,
Garth J Lancaster wrote: Looking forward to reading your article (as always )
Thank You very much.
Three samples are written, probably two to go. If I went with just a couple of samples and a few screen shots, the article would be up already. It looks like this is going to be another long read with lots of pictures (the way I like to read when grabbing a concept).
Jeff
|
|
|
|
|
|
Got my '5'
Im thinking (more to myself), about the implications of hooking and things like 'Detours' in all of this .. I'd have to do some more study to determine the feasibility of someone clever enough bypassing the tamper check routines themselves - ie injecting a routine that simply says the images match ...
but nice work and good reading
'g'
|
|
|
|
|
Hi Garth,
Garth J Lancaster wrote: I'd have to do some more study to determine the feasibility
Perhaps we can coauthor something together.
Garth J Lancaster wrote: someone clever enough bypassing the tamper check routines themselves - ie injecting a routine that simply says the images match ...
Yep - they are there. I presume my EXE will be thoroughly scrutunized and reversed.
BTW, I spent years with Fravia+, Mammon+ and the gang at HCU, so it is a qualified opinion.
Garth J Lancaster wrote: but nice work and good reading
Thank you very much.
Jeff
|
|
|
|
|
I am getting the structure in http://msdn2.microsoft.com/en-us/library/aa380981.aspx
It has an unsigned long -> shi502_permissions
And MSDN says that :
shi502_permissions
Specifies a DWORD value that indicates the shared resource's permissions for servers running with share-level security. This member is ignored on a server running user-level security. This member can be any of the following values. Calls to the NetShareSetInfo function ignore this member.
Note that the Windows Server 2003 family, Windows XP, Windows 2000, and Windows NT do not support share-level security. For more information about controlling access to securable objects, see Access Control, Privileges, and Securable Objects.
Value Meaning
ACCESS_READ Permission to read data from a resource and, by default, to execute the resource.
ACCESS_WRITE Permission to write data to the resource.
ACCESS_CREATE Permission to create an instance of the resource (such as a file); data can be written to the resource as the resource is created.
ACCESS_EXEC Permission to execute the resource.
ACCESS_DELETE Permission to delete the resource.
ACCESS_ATRIB Permission to modify the resource's attributes (such as the date and time when a file was last modified).
ACCESS_PERM Permission to modify the permissions (read, write, create, execute, and delete) assigned to a resource for a user or application.
ACCESS_ALL Permission to read, write, create, execute, and delete resources, and to modify their attributes and permissions.
How can i parse shi502_permissions and get values of these flags ?
Thank you very much.
|
|
|
|
|
Hi Akin,
Could you send over the code (and the steps to cause the permission)? I've never encountered this before, and would like to observe it under a debugger.
Jeff
|
|
|
|
|
Even though my MFC application contains a manifest which makes its buttons have the XP style, this doesn't work for the buttons in an HTML dialog box.
Does anyone know how to make the buttons in a CHTMLDialog have the XP style?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Is there anyway to detect a cdrom being ejected?
I've tried RegisterDeviceNotification with various different parameters but still no WM_DEVICECHANGE message received when user eject the CD.
|
|
|
|
|
Here is some rough code of device notification:
void CMyDlg::OnDeviceNotify()
{
CString cs;
HDEVNOTIFY *hdn = NULL;
bool bDevInterResult = DoRegisterDeviceInterface(SOME_GUID, hdn) != 0;
if (bDevInterResult)
{
cs.Format("Device notification : %d", bDevInterResult);
MessageBox(cs);
}
else
{
MessageBox("Device Notification Registration failed");
}
}
BOOL CMyDlg::DoRegisterDeviceInterface(GUID InterfaceClassGuid, HDEVNOTIFY *hDevNotify)
{
DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
char szMsg[80];
ZeroMemory(&NotificationFilter, sizeof(NotificationFilter) );
NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
NotificationFilter.dbcc_classguid = InterfaceClassGuid;
hDevNotify = (void **)RegisterDeviceNotification(GetSafeHwnd(),
&NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE);
if (!*hDevNotify)
{
wsprintf(szMsg, "RegisterDeviceNotification failed: %d\n",
GetLastError());
MessageBox((const char*)GetSafeHwnd(),szMsg, MB_OK);
return FALSE;
}
return TRUE;
}
BOOL CMyDlg::OnDeviceChange(UINT nEventType, DWORD dwData)
{
MessageBox("Device Change Occurred");
DEV_BROADCAST_HDR *lpdbh= (DEV_BROADCAST_HDR *)dwData;
switch (nEventType)
{
case DBT_DEVICEARRIVAL:
MessageBox("New Device Arrived");
break;
case DBT_DEVICEREMOVECOMPLETE:
MessageBox("Device Removed");
break;
}
return TRUE;
}
|
|
|
|
|
Yes, I've tried that. It works fine if I set it to a disk GUID and then pull out a USB flash drive, but does not work if i set it to a CDROM GUID or a Volume GUID and then eject the CD.
|
|
|
|