Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Diable Common file items

Posted on 1998-09-12
16
155 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

838 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