Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 10:45

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Problem mit ControlCommand

Discussion on Problem mit ControlCommand within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,973
Problem mit ControlCommand

Moin,

es ist zum Haare raufen... Ich habe eine simple ComboBox und möchte, sobald etwas in der ComboBox ausgewählt wird, mit der Auswahl weiterarbeiten. Das funktioniert auch soweit.

Jetzt möchte ich jedoch mittels ControlCommand etwas spezielles extrahieren und stelle mich dabei etwas blöde an...

Code:
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; GUI start
$Form1 = GUICreate("Form1", 160, 55, -1, -1)
$Combo1 = GUICtrlCreateCombo(" ", 8, 16, 145, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
; GUI ende

; PID-Liste start
$List = ProcessList()
For $i = 1 To $List[0][0]
	GUICtrlSetData($Combo1, 'PID: ' & $List[$i][1])
Next
; PID-Liste ende

; Bla....
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch
WEnd

; WM-Command
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
	Local $nNotifyCode = BitShift($wParam, 16)
	Local $nID = BitAND($wParam, 0xFFFF)
	Local $hCtrl = $lParam

	Switch $nID
		Case $Combo1
			Switch $nNotifyCode
				Case $CBN_SELCHANGE
					MsgBox(0, 0, $List[ControlCommand(" ", "PID: ", $nID, "FindString", GUICtrlRead($nID)) + 1][1])
			EndSwitch
	EndSwitch

	Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_COMMAND
Wie kriege ich aus der Auswahl die PID?! Der Mist beschäftigt mich unnötigerweise schon seit Wochen.
Whoknowsit is offline  
Old 12/02/2011, 16:17   #2
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
warum nicht mit standard autoit funktionen arbeiten?
Code:
GUICreate("Form1", 160, 55, -1, -1)
$Combo = GUICtrlCreateCombo(" ", 8, 16, 145, 25, 0x200043)
GUISetState(@SW_SHOW)

$List = ProcessList()
for $i = 1 to $List[0][0]
  GUICtrlSetData($Combo, 'PID: ' & $List[$i][1])
next

While 1
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $Combo
			MsgBox(0, 'blubb', GUICtrlRead($Combo))
	EndSwitch
WEnd
lolkop is offline  
Thanks
1 User
Old 12/02/2011, 16:23   #3


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,973
Geht weniger um den Inhalt der ComboBox als um die Tatsache, dass ich von der Auswahl nur die PID und nicht das "Drumrum" brauche. Ich dachte, mit ControlCommand wäre ich da ganz gut bedient.
Whoknowsit is offline  
Old 12/02/2011, 16:39   #4
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
auch da gibts wieder 2 einfache möglichkeiten^^

beim durchlaufen der prozessliste alles in einem array speichern, und später so auf die pid kommen, oder einfach per stringoperationen^^
lolkop is offline  
Thanks
1 User
Old 12/02/2011, 17:15   #5


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,973
Quote:
stringoperationen
Was schlägst du vor? _StringBetween? Alles in Allem sollte das Ganze selbstverständlich performant bleiben.
Whoknowsit is offline  
Old 12/02/2011, 17:45   #6
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
naja steht ja immer das gleiche da recihts doch die ersten par zeichn zu entfernen...

Code:
GUICreate("Form1", 160, 55, -1, -1)
$Combo = GUICtrlCreateCombo(" ", 8, 16, 145, 25, 0x200043)
GUISetState(@SW_SHOW)

$List = ProcessList()
for $i = 1 to $List[0][0]
  GUICtrlSetData($Combo, 'PID: ' & $List[$i][1])
next

While 1
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $Combo
			MsgBox(0, 'blubb', StringTrimLeft(GUICtrlRead($Combo),5))
	EndSwitch
WEnd
lolkop is offline  
Thanks
1 User
Old 12/02/2011, 18:17   #7


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,973
Wasn heute los mit mir?! Danke ^^
Whoknowsit is offline  
Reply


Similar Threads Similar Threads
[Hilfe]Ungelöstes Server Erstell Problem, ausführliche Problem Schilderung
09/15/2011 - Flyff Private Server - 8 Replies
Hey Com! Ich hoffe, dass dieser Thread nicht als Spamthread angesehen wird, da ich ja gestern schon einen zu diesem Thema eröffnet habe. Sorry wenn ich euch mit dem Thema nerve, aber ich sitze nun schon 4 Tage über dem Problem, und finde einfach keine Lösung. Nun werde ich hier allerdings eine ausführlichere Beschreibung des Problems geben. Mein Problem ist, dass ich den Windows Mssql Server 2008/2005 aus Sedrika's TuT nicht installieren kann, da sobald ich ihn immer installiere...
[Problem]Habe ein Problem und zwar spinnt mein VPC etwas(ohne Grund)?!
07/28/2011 - Metin2 Private Server - 10 Replies
Also wie schon gesagt meins Server spinnt wodurch kiks usw. kommen :( ich lade euch die Screens in den Anhang, mit der Hoffnung, dass ihr mir helfen könnt :) wäre echt sehr nice :)



All times are GMT +2. The time now is 10:45.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.