Improve company productivity with a Business Account.Sign Up

x
?
Solved

Diable Common file items

Posted on 1998-09-12
16
Medium Priority
?
163 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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
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 200 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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

595 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