Jump to content

Simgelere Sadece 1 Kere Clık Nasıl Yaparım?


 Share

Recommended Posts

  • 2 hafta sonra ...

paşalar büyük sıkıntılar var başımda, onları bir atlatayım yardımcı olucam hepinize, az kaldı.

 

Hocam sen yeter ki olur de ben beklerim. İşlerimin düzelmesi umudunu da bu işe bağladım desem yalan olmaz. Eğer farklılık yakalayamazsam diğer kafelerin arasında ezilip gidicem.

Link to comment
Share on other sites

xButton.SetEnabled(this, false)
File.Run("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\", SW_SHOWNORMAL, true)
xButton.SetEnabled(this, true)

Kullandığım bu kod simgeye tıkladığımda programın tek bir tane açılmasını sağlıyor ama program kapatılmadığı sürece diğer tüm simgeler deaktif oluyor diğerlerini kullanamıyorum.

Link to comment
Share on other sites

xButton.SetEnabled(this, false)
File.Run("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\", SW_SHOWNORMAL, false)
xButton.SetEnabled(this, true)

Böyle deneyiniz.

Edited by reyiz
Link to comment
Share on other sites

xButton.SetEnabled(this, false)
File.Run("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\", SW_SHOWNORMAL, false)
xButton.SetEnabled(this, true)

Böyle deneyiniz.

 

Olmadı, kaç kere tıklarsam o kadar chrome açıldı :D

Link to comment
Share on other sites

Tamam da siz diğer simgelerin devre dışı kalmasından şikayet ettiniz ben de onu düzelttim.

Diğer kodları ellemedim.

Onun için ayrı kod gerekiyor.

İstediğinizi gerçekleştirmek için de ayrı kod hazırlıyorum konuya bakmayı unutmayın arada.

Edited by reyiz
Link to comment
Share on other sites

Chrome butonuna aşağıdaki kodu koymanız gerekiyor:

 

instances_of_file = 0;
file_to_check_for = "chrome.exe";
processes = Window.EnumerateProcesses();

for j, file_path in pairs(processes) do
    file = String.SplitPath(file_path);
    if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
        instances_of_file = instances_of_file + 1;
    end
end

if instances_of_file > 0 then
    -- Eğer Chrome açık ise çalışacak kod
else
File.Run("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\", SW_SHOWNORMAL, false)
end

Elektrik kesintisi sebebiyle cevap veremedim, kusuruma bakmayın.

Edited by reyiz
Link to comment
Share on other sites

O kadar uğraş veriyorsunuz çok sağ olun ama hocam bu da olmadı.

 

Peki alternatif olarak şöyle bir şey olabilir mi ? Butonlar tek değil de iki defa tıkladığımızda belirlediğimiz exe yi çalıştırsa yada kısayol u çalıştırsa mümkün olur mu ? Tek tıklama ile çalışmasın da çift tıklamayla çalışsın. En azından masaüstüne aşina olan insanları da zorlamamış olurduk.

Link to comment
Share on other sites

Ben çift tıklamayı hesaba katmamıştım. Daha önce program açıksa tekrardan açılmasını engellemek için kod yazmıştım.

Program tıklar tıklamaz hemen açılmadığı için çift tıklamada iki kere açıyor. Başına Application.Sleep(1000) ekleyerek çözebilirsiniz. Tabi timer fonksiyonu kullanmak daha uygun olacaktır diye düşünüyorum.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...