Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VB macros

  • 06-03-2006 12:18pm
    #1
    Closed Accounts Posts: 18


    Does anybody know if it is possible to create a macro in VB6, and when i click run on that macro it is able to access other programs?

    For example i want to create a macro in vb and when i run the macro i want a c compiler to load up and program a chip

    thanks


Comments

  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    you can't create macros
    but you can use sendkeys to access other programs menus etc


  • Closed Accounts Posts: 18 suzie06


    How would I go about that tho???????????


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    By reading up about Sendkeys?

    Incidentally, your description doesn't make it clear if you want to run a macro inside the VB6 Design Environment, or somewhere else like in a program written in VB.

    jc


  • Closed Accounts Posts: 18 suzie06


    yea i want to be able to run the macro in vb at design time, is sendkey the only answer to this??
    I appreciate your patience as i am new to macros


  • Closed Accounts Posts: 884 ✭✭✭NutJob


    Iv done this kinda stuff before alot for work :-(

    Allapi network has a list of system api calles that are handy for findwindow and have examples.
    http://www.mentalis.org/agnet/apiguide.shtml

    The VBA in word and excel is a cut dow version of vb.

    The easy way is to use the FindWindowA() API to locate the window and use sendkeys.

    Anything more complicated will hurt badly.


    The easy Vb way is to use the vb shell to run the process as a child process and then sendkeys to that (less cool but easy)



    Toughest and other options include OLE nasty and API work with windows messages reallllll nasty overkill

    For api stuff the allapi network has samples


    Hope that helps


  • Advertisement
  • Closed Accounts Posts: 18 suzie06


    thank you nutjob, is sendkeys easy to use? are there any tutorials that may help me?


    szlonergan@yahoo.ie


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen




  • Closed Accounts Posts: 884 ✭✭✭NutJob


    hwnd = Shell("notepad", vbNormalFocus)
    AppActivate "notepad"
    SendKeys "This is a test string", 100


    Keycodes with bad example
    Use AppActivate for safety sake
    http://www.developerfusion.co.uk/show/57/


  • Closed Accounts Posts: 18 suzie06


    [Link to possibly unsafe attachment removed]

    Thank you so much nutjob, i tried out your test code but got the above error, did i do something wrong??
    would this work:

    Private Sub Form_Load()
    hWnd = Shell("i put my visual c compiler here.exe", vbNormalFocus)
    AppActivate "i put my visual c compiler here.exe"
    SendKeys "if i put my c code here", 100

    End Sub


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    amen wrote:
    you can't create macros

    Well......

    if its for the design environment (i.e. the Visual Studio IDE) then there's nothing to stop one writing an AddOn to do exactly what one wants....

    Shell an app....feed it parameters or whatever....the whole shebang. Addons are great.

    Anticipating the obvious first question...

    Yes, Addons are easy to write and easy to use.....if you read up on them first.


  • Advertisement
  • Closed Accounts Posts: 884 ✭✭✭NutJob




  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    suzie06.

    What did you try when you got the error message? What did your research into the error tell you?

    There are strict rules about the extent to which someone can seek help with homework. We are not going to hand-hold someone all the way through a project. After all, we don't want to end up working along someone who got their qualifications that way.

    Follow the guidelines about homework posts, or you will be permanently banned from this forum.

    Also, don't post attachments to potentially dangerous file types like .doc
    Granted the people here should know better than to open it in such a way as to allow a malware macro to run, but you should know better than to post it too.


Advertisement