change the command enable properties from false to true in runtime?
peace be with u
i attach a form that have a 1 command in enable properties = true
and i need to change the property in runtime by using other program ...
how i can solve this case ...
thanks
In the name of allah , the beneficent , the merciful
Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered
Re: change the command enable properties from false to true in runtime?
First off, its kinda senseless to post only compiled code since we can't help you by seeing that.. I ran it, my machine hasn't blown up yet, but learned nothing about your project.. Alot of ppl will refuse to launch your exe out of fear..
As for your question, there are a few options.. Some are elegant like "subclassing" the control (search that on this site) or by applying something like in the included project.. If simplicity and halfass workarounds are sufficient though, consider reprogramming the 1st app to watch a file that the other app can create/write to..
Re: change the command enable properties from false to true in runtime?
thanks..
but it doesn't work ...
i thing the hwnd can help ...
but i don't know how ?
thanks
In the name of allah , the beneficent , the merciful
Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered
Re: change the command enable properties from false to true in runtime?
Scour the site for subclassing examples.. Most ppl don't write their own subclassing code because its really complex.. Alot of ppl need it though, and usually there is a pre-made version of 'almost' what you need..
Hey, another option that might be applicable isn't vb related at all.. There is a great little/powerful scripting language called AutoIt.. For alot of purposes involving subclassing type needs its by far the easiest solution since thats pretty much what its made for.. Hardly any overhead programming like a fullblown language.. Its possible that you could whip up a script that compiles to an exe in a few lines/minutes.. And its free to boot.. Its on the net easy to find..
Re: change the command enable properties from false to true in runtime?
I've had legit reasons to do that.. Some programs can be dangerous in the hands of the computer illiterate..
The Jon Stewart Show illustrated how dangerous Outlook Express can be, in that story about the email deletion scandal..
Re: change the command enable properties from false to true in runtime?
Originally Posted by triggernum5
I've had legit reasons to do that.. Some programs can be dangerous in the hands of the computer illiterate..
The Jon Stewart Show illustrated how dangerous Outlook Express can be, in that story about the email deletion scandal..
Then end user training is necessary, not the manipulation of a third party application.
Re: change the command enable properties from false to true in runtime?
You could always take haxxoring lessons and switch the bit that controls the enabled/disabled of the required button in the compiled source code...that's how most hackers get around security in programs :-P
However, this isn't the forum to discuss that, manipulation of any third party software is illegal and even if it was your own code people would say rewrite it or do it in the source :-P
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
Re: change the command enable properties from false to true in runtime?
here is an example to get you started.
Code:
'this example requires 2 command buttons, command1 and command2
Option Explicit
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal aBOOL As Long) As Long
Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Command1_Click()
Dim CmdToEnable As Long
Dim RetVal As Long
CmdToEnable = Command2.hwnd 'put your object Handle here
RetVal = IsWindowEnabled(CmdToEnable) 'you can check to see the state
RetVal = EnableWindow(CmdToEnable, Not CBool(RetVal)) 'put true/false if you desire
'EnableWindow CmdToEnable, -1 'you can also use it as a sub
If RetVal Then
'it worked, put code here if you wish
End If
End Sub
Re: change the command enable properties from false to true in runtime?
thanks 4 all
why i ask this question ???
coz my company .. buy a sms program but we find in it some thing strange :::
some command is disable >>> and i need to change it ti enable >> coz we buy this program
thanks
In the name of allah , the beneficent , the merciful
Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered
Re: change the command enable properties from false to true in runtime?
I agree with trigger...they're probably disabled with good reason. I assume you have to put in settings which affect those buttons, maybe like the SMS carrier details, and if you're enabling a button that is disabled because the SMS carrier doesn't support it, you're asking for trouble bigtime.
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.