Results 1 to 13 of 13

Thread: change the command enable properties from false to true in runtime?

  1. #1

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    Resolved 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
    Attached Files Attached Files
    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


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  2. #2
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

    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..
    Attached Files Attached Files

  3. #3

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    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


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  4. #4
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

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

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: change the command enable properties from false to true in runtime?

    Quote Originally Posted by xray
    and i need to change the property in runtime by using other program ...
    Is this other program yours?

    If not, why the need to disable a button?

  6. #6
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

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

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: change the command enable properties from false to true in runtime?

    Quote 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.

  8. #8
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

    Re: change the command enable properties from false to true in runtime?

    I tried that too many times.. The main app I've adultered is Simply Accounting.. Too complex for a freecell guru of a business owner..

  9. #9
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    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.

  10. #10
    Hyperactive Member
    Join Date
    Aug 2006
    Location
    TeXaS
    Posts
    497

    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

  11. #11

    Thread Starter
    Hyperactive Member xray's Avatar
    Join Date
    Jun 2003
    Location
    EgYpT
    Posts
    312

    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


    ---- Great Sites For You -------------------

    If you want to know some small things about islam ?

  12. #12
    Hyperactive Member
    Join Date
    Aug 2006
    Posts
    367

    Re: change the command enable properties from false to true in runtime?

    Well then you're probably only going to crash it.. Contact the company that wrote/sold it if you have a legit registration issue..

  13. #13
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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.
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width