Win API in C# .

Posted by Pramodmca09 under C# on 10/22/2009 | Views : 1872 | Status : [Member] | Replies : 2
I want to build an application. Where I will have datagrid on my Form . I want to send 6th row data to window of another application like SAP window. On click Event of button all 5 columns from 6th row of datagrid, data should get copied to 5 text boxex of My SAP window . I have VB6 application with code I want convert it in to Visual C#. Please Help....




Responses

Posted by: Vuyiswamb on: 10/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
VB6 is Dead, i dont have anything that is related to VB6. lets see , post the Code, we will convert the code for you.

Thank you for posting at Dotnetfunda
[Administrator]

Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pramodmca09 on: 10/23/2009 [Member] Starter

Up
0
Down
Public Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Command1_Click()
row = 6

lpClassName$ = "#32770" 'Class ID for SAP Window
lpCaption$ = "Maintain Serial Numbers" 'Window Title of SAP Window
mHwnd = FindWindow(lpClassName$, lpCaption)
resAPI = SetForegroundWindow(mHwnd)
resAPI = SetForegroundWindow(mHwnd)

p = 0
Do While p < (3 * 4)
DoEvents
' p = p + 1
Loop

For i = 0 To 24
dispcol (i)
Next i
MsgBox("done")
End Sub

Private Sub dispcol(i As Integer)
r = 6
Dim tim
Dim tim1

mtxt = Trim(fg1.TextMatrix(r, i))

''SendKeys fron + CStr(count1), True
k = 0

Do While k < 1
DoEvents
Loop

SendKeys mtxt

k = 0
Do While k < 1
DoEvents

Loop

SendKeys "{Down}", True
resAPI = SetForegroundWindow(mHwnd)
resAPI = SetForegroundWindow(mHwnd)
End Sub


Also I did not get Why
k=0
Do While k<1
DoEvents
Loop

Since k will be 0 always how loop will get break There is Timer in Application is there any realtion with Timer.

Private Sub Timer1_Timer()
p = p + 1
If p > (3 * 4) Then
p = 0
End If

k = k + 1
If k > 1 Then
k = 0
End If

End Sub



Please tell me flow ....If you can. I'm not getting it I will be thatnk full ....

Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response