منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : تعديل هذا الكود اذا امكن
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
مثلآ
كود :
SendKeys.Send("Notepad","{S}")
يعنى يرسل الحرف فقط الى Notepad حتى لو Notepade Hide
هذا الكود يعمل على هذه الحاله
كود :
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim hWnd As IntPtr = FindWindow(Nothing, "s - Notepad")
        If hWnd.Equals(IntPtr.Zero) Then
            Return
        Else
            SendKeys.Send("{W}")
            SetForegroundWindow(hWnd)
        End If
    End Sub
المشكله فى هذا الكود عندما يعمل لا استطيع فتح اى شيء اخر يظهر Notepade امامى ولا يكون لى الحرية فى استخدام اى شيء هل يمكن التعديل عليه
أعتقد
يجب عليك إضافة
Application.DoEvents

PHP كود :
Private Sub Timer1_Tick(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Timer1.Tick
        Dim hWnd 
As IntPtr FindWindow(Nothing"s - Notepad")
Application.DoEvents
        
If hWnd.Equals(IntPtr.ZeroThen
            
Return
Application.DoEvents        
Else
            
SendKeys.Send("{W}")
Application.DoEvents 
           SetForegroundWindow
(hWnd)
Application.DoEvents
        End 
If
Application.DoEvents
    End Sub 
(22-12-13, 11:04 PM)mamas1 كتب : [ -> ]أعتقد
يجب عليك إضافة
Application.DoEvents

PHP كود :
Private Sub Timer1_Tick(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Timer1.Tick
        Dim hWnd 
As IntPtr FindWindow(Nothing"s - Notepad")
Application.DoEvents
        
If hWnd.Equals(IntPtr.ZeroThen
            
Return
Application.DoEvents        
Else
            
SendKeys.Send("{W}")
Application.DoEvents 
           SetForegroundWindow
(hWnd)
Application.DoEvents
        End 
If
Application.DoEvents
    End Sub 

شكرآ اخى لاكن نفس المشكله لا يمكننى تحريك او اغلاق اى شيء
السلام عليكم...

طبيعي أنه كلما اشتغل كود الـ Timer ستظهر المفكرة (Notepad) - إذا كانت شغالة - في المقدمة بسبب وجود الدالة SetForegroundWindow.

سلام.
(23-12-13, 01:35 AM)ناجي إبراهيم كتب : [ -> ]السلام عليكم...

طبيعي أنه كلما اشتغل كود الـ Timer ستظهر المفكرة (Notepad) - إذا كانت شغالة - في المقدمة بسبب وجود الدالة SetForegroundWindow.

سلام.

اعلم اخى لاكن هل توجد طريقة غير التيمر
آه إعتقدت أنك قلت أن الحاسوب يهنج ...
كما قال الأخ ناجي إبراهيم ستظهر المفكرة
لكن يمكنك فقط تصغير أبعاد النوتباد لتكون لديك الحرية
اكتب مباشره علي ملف
ثم افتحه متي تريد عن طريق
PHP كود :
import system.IO
public class form1
private sub click)
file.writealltext(path,text)
end sub 
وبيمشي الحال
PHP كود :
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As StringByVal lpWindowName As String) As Integer
    
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWndParent As IntegerByVal hWndChildAfter As IntegerByVal lpClassName As StringByVal lpWindowName As String) As Integer
    
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntegerByVal wMsg As IntegerByVal wParam As IntegerByVal lParam As String) As Integer

    
Public Const WM_SETTEXT = &HC

    
Public Sub SetNotepadText()
        Static 
StringToSend As String ""

        
Dim notepadHwnd FindWindow(Nothing"Untitled - Notepad")
        
Dim editHwnd FindWindowEx(notepadHwnd0"Edit"Nothing)


        
StringToSend &= "Hello World! "

        
SendMessageByString(editHwndWM_SETTEXT0StringToSend)
    
End Sub 


جرب هذا الكود !
شكرآ لكل من ساهم فى مساعدتى