Jump to content

Jtssi

Members
  • Posts

    5
  • Joined

  • Last visited

Jtssi's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hello, in fact I'd like to save everything (position and size of MAIN and TOOL windows), to restore them as they are when I run the script again.
  2. Opt("GUIOnEventMode",1) Opt("WinSearchChildren",1) $guiname = "MAIN" $gui = GUICreate($guiname,IniRead(@ScriptDir & "\test.ini","main","size_x","1200"),IniRead(@ScriptDir & "\test.ini","main","size_y","800"),IniRead(@ScriptDir & "\test.ini","main","pos_x","200"),IniRead(@ScriptDir & "\test.ini","main","pos_y","200"),BitOR(0x00010000,0x00020000,0x00040000)) GUISetOnEvent(-3,"_Exit_",$gui) GUICtrlCreateLabel("",-100,-100,0,0) GUISetState() $guiname_tool = "TOOL" $gui_tool = GUICreate($guiname_tool,IniRead(@ScriptDir & "\test.ini","tool","size_x","200"),IniRead(@ScriptDir & "\test.ini","tool","size_y","100"),IniRead(@ScriptDir & "\test.ini","tool","pos_x","20"),IniRead(@ScriptDir & "\test.ini","tool","pos_y","20"),0x00C00000,-1,$gui) DllCall("user32.dll","int","SetParent","hwnd",$gui_tool,"hwnd",$gui) GUICtrlCreateLabel("",-100,-100,0,0) GUISetState(@SW_SHOW,$gui_tool) While 1 Sleep(100) WEnd Func _Exit_() $pos_main = WinGetPos($guiname) IniWrite(@ScriptDir & "\test.ini","main","pos_x",$pos_main[0]) IniWrite(@ScriptDir & "\test.ini","main","pos_y",$pos_main[1]) IniWrite(@ScriptDir & "\test.ini","main","size_x",$pos_main[2]) IniWrite(@ScriptDir & "\test.ini","main","size_y",$pos_main[3]) $pos_tool = _Win_GetChildPos($guiname,$guiname_tool) IniWrite(@ScriptDir & "\test.ini","tool","pos_x",$pos_tool[0] - $pos_main[0]) IniWrite(@ScriptDir & "\test.ini","tool","pos_y",$pos_tool[1] - $pos_main[1]) IniWrite(@ScriptDir & "\test.ini","tool","size_x",$pos_tool[2]) IniWrite(@ScriptDir & "\test.ini","tool","size_y",$pos_tool[3]) Exit EndFunc Func _Win_GetChildPos($h_parent, $h_child) Local $h_wnd = ControlGetHandle($h_parent, "", $h_child) Return WinGetPos($h_wnd) EndFunc
  3. Hello, I have a big issue with position and dimensions, whether it's the MAIN window or the TOOL sub-window. When I exit the application, `wingetpos` does not correctly save the dimensions: After the 1st save: [main] pos_x=200 pos_y=200 size_x=1214 size_y=814 [tool] pos_x=28 pos_y=51 size_x=206 size_y=129 After the 2nd save: [main] pos_x=200 pos_y=200 size_x=1228 size_y=828 [tool] pos_x=36 pos_y=82 size_x=212 size_y=158 How can I fix this? Thank you for your help.
  4. Hello, I have created functions similar to INI files, and I would like to know how to optimize the code. Do you have any ideas? Thank you. Func _DbWrite_($db_file,$db_table,$db_key,$db_value) _SQLite_Startup() Local $db_query $db_open = _SQLite_Open($db_file) _SQLite_Exec($db_open,'CREATE TABLE IF NOT EXISTS "' & $db_table & '" (key,value);') _SQLite_QuerySingleRow($db_open,'SELECT key FROM "' & $db_table & '" WHERE key="' & $db_key & '";',$db_query) If $db_query[0] == "" Then _SQLite_Exec($db_open,'INSERT INTO "' & $db_table & '" VALUES ("' & $db_key & '","' & $db_value & '");') Else _SQLite_Exec($db_open,'UPDATE "' & $db_table & '" SET value="' & $db_value & '" WHERE key="' & $db_key & '";') EndIf _SQLite_Close($db_open) _SQLite_Shutdown() EndFunc Func _DbRead_($db_file,$db_table,$db_key,$db_value) _SQLite_Startup() Local $db_query $db_open = _SQLite_Open($db_file) _SQLite_Exec($db_open,'CREATE TABLE IF NOT EXISTS "' & $db_table & '" (key,value);') _SQLite_QuerySingleRow($db_open,'SELECT value FROM "' & $db_table & '" WHERE key="' & $db_key & '";',$db_query) _SQLite_Close($db_open) If $db_query[0] == "" Then Return $db_value Else Return $db_query[0] EndIf _SQLite_Shutdown() EndFunc
  5. Hello, is it possible to do like the picture? A section that opens and closes, with a scrollbar on the right? Thanks
×
×
  • Create New...