Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

OK, all you smart coders out there. I have been able to code a number of Visual Basic executable routines to do special things to control my home security system program, but have gotten stumped on what seems like it should be the easiest thing I've ever tried.

When my video cameras see motion I want to send a WM_USER message to my security program that is setup to recognize such notices. The camera program can call any executable when motion is detected, so I want a simple VB program that just sends a Windows message, using I believe.

SendMessage("PowerHome", WM_USER, 3445, 5)

where "PowerHome" is the handle for the running target window process, and the later two are the parameters to be passed to PowerHome to fire the trigger using Trigger Type WM_USER.

No matter what I have tried, I either compile with a Syntax error, or an Expected end of Statement error.

Since I think this should be just a few lines of code and don't want to prejudice any suggestions, could anyone post a complete VB program code stream?

I'm running this in a 64-bit Windows 7 environment, which I think makes a difference. I also really need a complete program, as the devil is in the details and my many attempts have failed, so I am missing something basic.

share|improve this question
2  
"PowerHome" is a string, not a window handle. You will first need to get the window handle. Look into FindWindow and FindWindowEx. PInvoke.net may be helpful to you. –  Ripster May 15 '13 at 13:54
    
WM_COPYDATA is the message to pass arbitrary data around (support.microsoft.com/kb/176058 <- would need to be made 64bit friendly if 64bit office) –  Alex K. May 15 '13 at 14:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.