Class: Win32::StartupInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/Win32/Process.rb

Overview



This class contains the startup info that is passed to Win32::Process.Create It tells how the process should be created and where it should appear

Constant Summary collapse

STARTF_USESHOWWINDOW =

constsFor: “Startup Information Flags” (from WinBase.h)

0x00000001
STARTF_USESIZE =
0x00000002
STARTF_USEPOSITION =
0x00000004
STARTF_USECOUNTCHARS =
0x00000008
STARTF_USEFILLATTRIBUTE =
0x00000010
STARTF_RUNFULLSCREEN =
0x00000020
STARTF_FORCEONFEEDBACK =
0x00000040
STARTF_FORCEOFFFEEDBACK =
0x00000080
STARTF_USESTDHANDLES =
0x00000100
STARTF_USEHOTKEY =
0x00000200
FOREGROUND_BLUE =
0x0001
FOREGROUND_GREEN =
0x0002
FOREGROUND_RED =
0x0004
FOREGROUND_INTENSITY =
0x0008
BACKGROUND_BLUE =
0x0010
BACKGROUND_GREEN =
0x0020
BACKGROUND_RED =
0x0040
BACKGROUND_INTENSITY =
0x0080
SW_HIDE =

constsFor: “Show Window values” (from WinUser.h)

0
SW_SHOWNORMAL =
1
SW_NORMAL =
1
SW_SHOWMINIMIZED =
2
SW_SHOWMAXIMIZED =
3
SW_MAXIMIZE =
3
SW_SHOWNOACTIVATE =
4
SW_SHOW =
5
SW_MINIMIZE =
6
SW_SHOWMINNOACTIVE =
7
SW_SHOWNA =
8
SW_RESTORE =
9
SW_SHOWDEFAULT =
10
SW_FORCEMINIMIZE =
11
SW_MAX =
11

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p_pDesktop = nil, p_strTitle = nil, p_x = nil, p_y = nil, p_width = nil, p_length = nil, p_xCountChars = nil, p_yCountChars = nil, p_fillAttribute = nil, p_showWindow = nil, p_stdin = nil, p_stdout = nil, p_stderr = nil) ⇒ StartupInfo


class methodsFor: “initialization”



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/Win32/Process.rb', line 117

def initialize(
		p_pDesktop = nil, p_strTitle = nil,
		p_x = nil, p_y = nil, p_width = nil, p_length = nil,
		p_xCountChars = nil, p_yCountChars = nil,
		p_fillAttribute = nil,
		p_showWindow = nil,
		p_stdin = nil, p_stdout = nil, p_stderr = nil)
	@desktop           = p_pDesktop
	@title             = p_strTitle
	@flags             = 0
	self.x             = p_x
	self.y             = p_y
	self.width         = p_width
	self.length        = p_length
	self.xCountChars   = p_xCountChars
	self.yCountChars   = p_yCountChars
	self.fillAttribute = p_fillAttribute
	self.showWindow    = p_showWindow
	self.stdin         = p_stdin
	self.stdout        = p_stdout
	self.stderr        = p_stderr
end

Instance Attribute Details

#desktopObject (readonly)


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def desktop
  @desktop
end

#fillAttributeObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def fillAttribute
  @fillAttribute
end

#lengthObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def length
  @length
end

#showWindowObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def showWindow
  @showWindow
end

#stderrObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def stderr
  @stderr
end

#stdinObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def stdin
  @stdin
end

#stdoutObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def stdout
  @stdout
end

#titleObject (readonly)


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def title
  @title
end

#widthObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def width
  @width
end

#xObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def x
  @x
end

#xCountCharsObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def xCountChars
  @xCountChars
end

#yObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def y
  @y
end

#yCountCharsObject


attributesFor: “window properties”



65
66
67
# File 'lib/Win32/Process.rb', line 65

def yCountChars
  @yCountChars
end

Class Method Details

.sizeofObject


class methodsFor: “Data sizing”



111
112
113
# File 'lib/Win32/Process.rb', line 111

def StartupInfo.sizeof
	return 80 # 16 longs and 2 words
end

.unpack(p_pData) ⇒ Object


class methodsFor: “unpacking data”



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/Win32/Process.rb', line 142

def StartupInfo.unpack(p_pData)
	pData = p_pData.unpack("L12S2L4")
	return StartupInfo.new(
				pData[ 1], pData[ 2],
				pData[ 3], pData[ 4], pData[ 5], pData[ 6],
				pData[ 7], pData[ 8],
				pData[ 9],
				pData[11],
				pData[14], pData[15], pData[16]
	)
end

Instance Method Details

#packObject


methodsFor: “packing data”



168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/Win32/Process.rb', line 168

def pack
	return [StartupInfo.sizeof,
			0,
			xx(@desktop),
			xx(@title),
			xx(@x), xx(@y), xx(@width), xx(@length),
			xx(@xCountChars), xx(@yCountChars),
			xx(@fillAttribute),
			xx(@flags),
			xx(@showWindow),
			0, 0,
			xx(@stdin), xx(@stdout), xx(@stderr)
			].pack('L12S2L4')
end

#to_sObject


methodsFor: “printing”



231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/Win32/Process.rb', line 231

def to_s
	str = "["
	str += " desktop: #{@desktop}"										if nil != @desktop
	str += " title: #{@title}"											if nil != @title
	str += " x: #{@x} y: #{@y}"											if testf(STARTF_USEPOSITION)
	str += " width: #{@width} length: #{@length}"						if testf(STARTF_USESIZE)
	str += " xCountChars: #{@xCountChars} yCountChars: #{@yCountChars}"	if testf(STARTF_USECOUNTCHARS)
	str += " fillAttribute: #{@fillAttribute}"							if testf(STARTF_USEFILLATTRIBUTE)
	str += " showWindow: #{@showWindow}"								if testf(STARTF_USESHOWWINDOW)
	str += " stdin: #{@stdin} stdout: #{@stdout} stderr: #{@stderr}"	if testf(STARTF_USESTDHANDLES)
	str += " ]"
	return str
end

#xx(val) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/Win32/Process.rb', line 154

def xx(val)
	if RUBY_VERSION >= "1.8.2" then
		if val == nil then
			0
		else
			val
		end
	else
		val
	end
end