منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[كود] تعديل هذا الكود اذا امكن - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [كود] تعديل هذا الكود اذا امكن (/showthread.php?tid=1322)



تعديل هذا الكود اذا امكن - أسامة - 22-12-13

مثلآ
كود :
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 امامى ولا يكون لى الحرية فى استخدام اى شيء هل يمكن التعديل عليه


RE: تعديل هذا الكود اذا امكن - mamas1 - 22-12-13

أعتقد
يجب عليك إضافة
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 



RE: تعديل هذا الكود اذا امكن - أسامة - 23-12-13

(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 

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


RE: تعديل هذا الكود اذا امكن - ناجي إبراهيم - 23-12-13

السلام عليكم...

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

سلام.


RE: تعديل هذا الكود اذا امكن - أسامة - 23-12-13

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

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

سلام.

اعلم اخى لاكن هل توجد طريقة غير التيمر


RE: تعديل هذا الكود اذا امكن - mamas1 - 23-12-13

آه إعتقدت أنك قلت أن الحاسوب يهنج ...
كما قال الأخ ناجي إبراهيم ستظهر المفكرة
لكن يمكنك فقط تصغير أبعاد النوتباد لتكون لديك الحرية


RE: تعديل هذا الكود اذا امكن - smss - 23-12-13

اكتب مباشره علي ملف
ثم افتحه متي تريد عن طريق
PHP كود :
import system.IO
public class form1
private sub click)
file.writealltext(path,text)
end sub 
وبيمشي الحال


RE: تعديل هذا الكود اذا امكن - Abdullah0991 - 24-12-13

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 


جرب هذا الكود !



RE: تعديل هذا الكود اذا امكن - أسامة - 24-12-13

شكرآ لكل من ساهم فى مساعدتى