launch vb exe with xp_cmdshell

launch vb exe with xp_cmdshell

Post by Mario Deni » Wed, 17 Apr 2002 03:06:26



Here's my code:

A form with a textbox call Text1.

Text1.LinkTopic = "Commence|system"
Text1.LinkMode = vbLinkManual
Text1.LinkExecute "[FireTrigger(""ao"")]"

Only that 3 little lines. I made an exe.
 It works perfectly when I launch it from the DOS prompt, but it doesn't
when I launch it with xp_cmdshell(sql Server).
I think that is because of the form.
Do you know if I can do the same without a form?

 
 
 

launch vb exe with xp_cmdshell

Post by Gert E.R. Draper » Wed, 17 Apr 2002 14:08:43


DDE does not work without forms, it is based on sending Windows messages

In C++ you would have to do this:
 if (!PostMessage(hwndServerDDE, WM_DDE_REQUEST,  (WPARAM) hwndClientDDE,
PackDDElParam(WM_DDE_REQUEST, CF_TEXT, atomItem)))

So you will have to re-architect and use a more appropriate technology than
DDE


Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright ? SQLDev.Net 1991-2002 All rights reserved.


Quote:> Here's my code:

> A form with a textbox call Text1.

> Text1.LinkTopic = "Commence|system"
> Text1.LinkMode = vbLinkManual
> Text1.LinkExecute "[FireTrigger(""ao"")]"

> Only that 3 little lines. I made an exe.
>  It works perfectly when I launch it from the DOS prompt, but it doesn't
> when I launch it with xp_cmdshell(sql Server).
> I think that is because of the form.
> Do you know if I can do the same without a form?


 
 
 

launch vb exe with xp_cmdshell

Post by Mario Deni » Wed, 17 Apr 2002 22:09:51


I heard that I could do it with a class instead of a form? Do you know how?

If  I use C++, do I have to use a form too?

Do you a more appropriate technology to communicate form SQL server to
another apllication?

Thank you



> DDE does not work without forms, it is based on sending Windows messages

> In C++ you would have to do this:
>  if (!PostMessage(hwndServerDDE, WM_DDE_REQUEST,  (WPARAM) hwndClientDDE,
> PackDDElParam(WM_DDE_REQUEST, CF_TEXT, atomItem)))

> So you will have to re-architect and use a more appropriate technology
than
> DDE


> Please reply only to the newsgroups.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use.
> Copyright ? SQLDev.Net 1991-2002 All rights reserved.



> > Here's my code:

> > A form with a textbox call Text1.

> > Text1.LinkTopic = "Commence|system"
> > Text1.LinkMode = vbLinkManual
> > Text1.LinkExecute "[FireTrigger(""ao"")]"

> > Only that 3 little lines. I made an exe.
> >  It works perfectly when I launch it from the DOS prompt, but it doesn't
> > when I launch it with xp_cmdshell(sql Server).
> > I think that is because of the form.
> > Do you know if I can do the same without a form?

 
 
 

launch vb exe with xp_cmdshell

Post by Mario Deni » Wed, 17 Apr 2002 22:11:06


Still me,
Do you know if I could do it without a form with VB.net?



> DDE does not work without forms, it is based on sending Windows messages

> In C++ you would have to do this:
>  if (!PostMessage(hwndServerDDE, WM_DDE_REQUEST,  (WPARAM) hwndClientDDE,
> PackDDElParam(WM_DDE_REQUEST, CF_TEXT, atomItem)))

> So you will have to re-architect and use a more appropriate technology
than
> DDE


> Please reply only to the newsgroups.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use.
> Copyright ? SQLDev.Net 1991-2002 All rights reserved.



> > Here's my code:

> > A form with a textbox call Text1.

> > Text1.LinkTopic = "Commence|system"
> > Text1.LinkMode = vbLinkManual
> > Text1.LinkExecute "[FireTrigger(""ao"")]"

> > Only that 3 little lines. I made an exe.
> >  It works perfectly when I launch it from the DOS prompt, but it doesn't
> > when I launch it with xp_cmdshell(sql Server).
> > I think that is because of the form.
> > Do you know if I can do the same without a form?

 
 
 

launch vb exe with xp_cmdshell

Post by Jon Campbel » Thu, 18 Apr 2002 00:15:27


Ok,

Here is a code snippet to help define the xp_cmdshell:

--Some declarations

--Call HitProcess.exe

here)/p(password here)






--End Code Snippet

The print statement send the output to a log file that we
use when running a job.  As you can see this is just one
way to call the executable.  The executable has no forms
and uses class objects that expose their properties and
methods.  However, we don't need to instantiate a com
object within SQL because the executable does just one
thing.

I don't recommend using this feature for anything other
than running standalone executables that run outside of
the normal SQL stream.  Once the executable is finished
then control is returned to the next statement in the
Stored Procedure.  

The problem with calling the dos command shell is that you
have very limited control over the events that occur until
after the program has completed execution.  Another method
is to instantiate a COM object from a stored procedure.  
The methods and properties of the COM object are exposed
and can be referenced in code.  However, this method is
also limited somewhat by the sp_OACreate stored procedure
supplied my MS in the master's database.

Hope this helps a little,

Jon

Quote:>-----Original Message-----
>I heard that I could do it with a class instead of a

form? Do you know how?

>If  I use C++, do I have to use a form too?

>Do you a more appropriate technology to communicate form
SQL server to
>another apllication?

>Thank you




>> DDE does not work without forms, it is based on sending
Windows messages

>> In C++ you would have to do this:
>>  if (!PostMessage(hwndServerDDE, WM_DDE_REQUEST,  

(WPARAM) hwndClientDDE,
Quote:>> PackDDElParam(WM_DDE_REQUEST, CF_TEXT, atomItem)))

>> So you will have to re-architect and use a more

appropriate technology

- Show quoted text -

>than
>> DDE


>> Please reply only to the newsgroups.
>> This posting is provided "AS IS" with no warranties,
and confers no
>rights.
>> You assume all risk for your use.
>> Copyright ? SQLDev.Net 1991-2002 All rights reserved.



>> > Here's my code:

>> > A form with a textbox call Text1.

>> > Text1.LinkTopic = "Commence|system"
>> > Text1.LinkMode = vbLinkManual
>> > Text1.LinkExecute "[FireTrigger(""ao"")]"

>> > Only that 3 little lines. I made an exe.
>> >  It works perfectly when I launch it from the DOS

prompt, but it doesn't

- Show quoted text -

Quote:>> > when I launch it with xp_cmdshell(sql Server).
>> > I think that is because of the form.
>> > Do you know if I can do the same without a form?

>.

 
 
 

1. launch exe with xp_cmdshell

Here's my code:

A form with a textbox call Text1.

Text1.LinkTopic = "Commence|system"
Text1.LinkMode = vbLinkManual
Text1.LinkExecute "[FireTrigger(""ao"")]"

Only that 3 little lines. I made an exe.
 It works perfectly when I launch it from the DOS prompt, but it doesn't
when I launch it with xp_cmdshell.
I think that is because of the form.
Do you know if I can do the same without a form?

2. Adding data to an access field

3. xp_CMDShell to launch VB App

4. Portnumber and replication

5. using xp_cmdshell to launch VB or .bat file

6. Where can i get souce of pgsqlODBC.

7. vb exe launch with shell

8. BUG ? Need Help Urgent

9. Launching VB exe from Novell 4.11 Server

10. launching an EXE from within a VB DLL

11. launching an EXE from a VB DLL

12. xp_cmdshell to run vb.exe

13. xp_cmdshell to execute VB EXE