Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2003, 01:18 AM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Synchronization Problem

Dear friends,

     I m worrying abt a problem from a long time.I tried in many way to solve this problem.Please help me to solve the problem.The problem is

   When we are running our application, if we contact any other application(For ex Dos application) i want to synchronize my application with other application invoked by my application.For example using [u]shell</u> function we can call other exe files.But the call will be asynchronus.Here i want my application to be syncronized with the called application.

               Here on method i have that is.
          with [u]CreateProcess</u> Api and [u]WaitForSingleObject</u> Api i had achived my need.But this is not working if my application is installed on WinXp.These are working well if i run this on Winnt or 2000.

       This an urgent requirement for me.Please help me to solve my problem friends

          Thanking you in advance

B.V.Kumar.

B.V.Kumar
__________________
B.V.Kumar
 
Old July 10th, 2003, 01:27 AM
Authorized User
 
Join Date: May 2003
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just check out your parameters, which you are passing to your
create process function. As sometime it creates problem on win98 too

Quote:
quote:Originally posted by bveerendrakumar
 Dear friends,

     I m worrying abt a problem from a long time.I tried in many way to solve this problem.Please help me to solve the problem.The problem is

When we are running our application, if we contact any other application(For ex Dos application) i want to synchronize my application with other application invoked by my application.For example using [u]shell</u> function we can call other exe files.But the call will be asynchronus.Here i want my application to be syncronized with the called application.
    
             Here on method i have that is.
         with [u]CreateProcess</u> Api and [u]WaitForSingleObject</u> Api i had achived my need.But this is not working if my application is installed on WinXp.These are working well if i run this on Winnt or 2000.

     This an urgent requirement for me.Please help me to solve my problem friends

         Thanking you in advance

B.V.Kumar.

B.V.Kumar
Deepesh Jain
VB,VBA & .NET Specialist
Wiley Support Team
 
Old July 10th, 2003, 05:18 AM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Deepesh Jain,

        Here i m giving my entire code.This code is written to take backup from database using export uitily of oracle. Please take a look at that and let me know the problem.

Option Explicit

Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long

Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long


Public Type SECURITY_ATTRIBUTES
        nLength As Long
        lpSecurityDescriptor As Long
        bInheritHandle As Long
End Type

Public Type PROCESS_INFORMATION
        hProcess As Long
        hThread As Long
        dwProcessId As Long
        dwThreadId As Long
End Type

Public Type STARTUPINFO
        cb As Long
        lpReserved As String
        lpDesktop As String
        lpTitle As String
        dwX As Long
        dwY As Long
        dwXSize As Long
        dwYSize As Long
        dwXCountChars As Long
        dwYCountChars As Long
        dwFillAttribute As Long
        dwFlags As Long
        wShowWindow As Integer
        cbReserved2 As Integer
        lpReserved2 As Long
        hStdInput As Long
        hStdOutput As Long
        hStdError As Long
End Type

Public Const INFINITE = &HFFFF ' Infinite timeout
Public Const SW_SHOWDEFAULT = 10
Public Const NORMAL_PRIORITY_CLASS = &H20
Public Const HIGH_PRIORITY_CLASS = &H80
Public Const SW_HIDE = 0
Public Const SW_MAXIMIZE = 3
Public Const SW_MINIMIZE = 6
Public Const SW_NORMAL = 1
Public Const STARTF_USESHOWWINDOW = &H1

Public Function Spawn()
Dim Proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO
Dim A As SECURITY_ATTRIBUTES
Dim B As SECURITY_ATTRIBUTES
Dim Rc As Long
Dim n As Long
Start.dwFlags = STARTF_USESHOWWINDOW
Start.wShowWindow = SW_MAXIMIZE

    'initialize STATRTUPINFO type
    Start.cb = Len(Start)

    'Start the shelled application
 Rc = CreateProcess(vbNullString, "d:\oracle\ora92\bin\exp.exe bnr/bnrsys@orcl file=test.dmp rows=y", _
A, B, 1, HIGH_PRIORITY_CLASS, 0, vbNullString, Start, Proc)

    'Wait for shelled appication to finish
    Rc = WaitForSingleObject(Proc.hProcess, INFINITE)

    'close the handle
    Rc = CloseHandle(Proc.hProcess)
End Function

This is written in module and i m calling it thru from.
Pls help me

Thanking you in advance.

B.V.Kumar





Similar Threads
Thread Thread Starter Forum Replies Last Post
data synchronization abdulweb General .NET 0 August 26th, 2007 12:20 AM
data relations synchronization igalk474 ADO.NET 0 July 21st, 2007 05:36 AM
--Javascript Synchronization-- tal Javascript 2 June 29th, 2007 11:33 AM
XML Synchronization prashant_dnmmkpk Biztalk 0 January 17th, 2005 09:16 AM
Synchronization Problem(Urgent) bveerendrakumar VB How-To 0 July 8th, 2003 01:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.