Solved

Diable Common file items

Posted on 1998-09-12
16
154 Views
Last Modified: 2012-05-04
I'm writing a program in which I must have the delete, rename, cut, copy, paste items disabled/tracked so that I can keep the user from doing these actions. How Can I do this in vb5 or C++?
0
Comment
Question by:naallen
  • 6
  • 6
  • 2
  • +1
16 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1434556
I've got a Delphi code, for this but don't know how to do it in VB/C++

Actually if you have C++ Builder I can show you how to do that....

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1434557
Would you please tell me what's pointer that points to nothing ...in Delphi that would be NIL
In C++ that would be NULL....what about in C++ Builder...is it NULL??

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1434558
Are you using C++ Builder???
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 5

Expert Comment

by:dirtdart
ID: 1434559
Declare Function GetSystemMenu Lib "user32" Alias "GetSystemMenu" (ByVal hwnd As Long, ByVal bRevert As Long) As Long

Declare Function EnableMenuItem Lib "user32" Alias "EnableMenuItem" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long

Use GetSystemMenu to get a handle to the system menu that pops up on right click.  Once you've gotten the handle, Use EnableMenuItem with wEnable set to MF_DISABLED to disable the menu.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1434560
Create a PopUp menu and do this.......
to disable the system menu use this,,,,

Form.PopUpMenu = YourComponentMenu

to enable it use this....

Form.PopUpMenu = null

Regards,
Viktor Ivanov
0
 

Author Comment

by:naallen
ID: 1434561
Dirtdart, please provide an example of the enableMenuItem line and explain to me what the index numbers for the items to be disabled are.
0
 
LVL 5

Expert Comment

by:dirtdart
ID: 1434562
I'm sorry.  Please reject my answer.  I didn't fully test it before posting.  Tehcnically, the calls will work to disable the system menu, but there is no way to capture the system menu popping up (that I can find) from VB.  The click event is not fired when the user right clicks and brings up the system menu, and the MouseUp event doesn't fire until the system menu disappears.  Wish I could help you more.
0
 

Author Comment

by:naallen
ID: 1434563
By his request.
0
 

Author Comment

by:naallen
ID: 1434564
By his request.
0
 

Expert Comment

by:bennys
ID: 1434565
can you give some more details ?
do you want to display a file list ? explorer-like ?
what do you want to prevent the user from doing ?
(opening a pop-up menu ? pressing DEL ? )
0
 

Author Comment

by:naallen
ID: 1434566
i want to keep the user from seeing the right click in explorer dialog boxes, or anything that accesses file functions. If possible, I would like the whole function disabled.
0
 

Accepted Solution

by:
bennys earned 100 total points
ID: 1434567
you can't do that through the common dialog control.
(a small tour in its documentation will tell you that.)
the best solution i see is to write this dialog yourself.
its not that much work and you can control anything there.
if you do that , you can also limit the dialog to the only
features you need there.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1434568
I told you what to do...Assign a dummy popup menu to the diaolgs' system menu.....

//Viktor
0
 

Author Comment

by:naallen
ID: 1434569
Victor, does this work for all dialog boxes calling file fuctions?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1434570
Yes, it works if you have create the app.....This disables the system menu only to your app...

//Vik
0
 

Author Comment

by:naallen
ID: 1434571
i know how to do that, but how do i diable the same functions globally? In anything that calls them. A system wide api or something.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question