mysleep proc
Is this an ideia ?
;mysqlinit:
;INVOKE mysql_init,NULL
;mov db_connect,eax
;INVOKE mysql_real_connect,db_connect,offset hostname,offset u_root,offset pw_buffer,0,0,0,0
;INVOKE mysql_errno,db_connect
;.if eax == 2003 ;errno mysql 'Server does not run'
;INVOKE MessageBox,NULL,offset Error_connect,offset AppName,MB_ICONERROR ;Msg 'Server does not run'
;INVOKE ShellExecute,main_hwnd,offset fOpen,offset mysql_startfile,NULL,NULL,SW_HIDE
;mysql_startfile db "mysql_start.exe",0
;Here I need 3 seconds before trying again - the server needs it
;call mysleep
;jmp mysqlinit
;==========
mysleep proc
;two_ints db "%u%u",0
;goodforall dd ?
;buffer_tmp 10 up(?),0
;====Aktuelle Sekunde Millisekunde
INVOKE GetLocalTime,offset systemTime
movsx eax,systemTime.wSecond
movsx ecx,systemTime.wMilliseconds
add eax,3
INVOKE wsprintf,offset buffer_tmp,offset two_ints,eax,ecx
INVOKE crt_atoi,offset buffer_tmp
mov goodforall,eax ;Endvalue to check
chkthesec:
INVOKE GetLocalTime,offset systemTime
movsx eax,systemTime.wSecond
movsx ecx,systemTime.wMilliseconds
INVOKE wsprintf,offset buffer_tmp,offset two_ints,eax,ecx
INVOKE crt_atoi,offset buffer_tmp
.if eax >= goodforall ;Cmp ends
jmp outchk
.else
jmp chkthesec
.endif
outchk:
ret
mysleep endp
What's wrong with invoke Sleep, 3000??
Obviously the sleep function stops the whole program for a defined time.
I only want some seconds between start_mysql (takes 2,3 seconds) and trying to check the password again
Use a timer.
Yes hutch,
I do that.
But this will not change much.
Perhaps it is more "standard".
Thanks
Sounds like you should be looking at threads and signalling back to the main program thread when the connection status has changed and to what status (disconnected, no internet, connected, incorrect login details etc etc)
Excuse my noobish question, but this statement puzzles me;
.if eax == 2003
INVOKE something
but where's the .else and / or the .endif part? I see some serious logical flaw here that leads to infinite loop... but maybe I am wrong. I know nothing about mysql.
Quote from: coder on January 29, 2017, 12:04:34 PMbut where's the .else and / or the .endif part?
The .if is commented out. If it wasn't, the assembler would confirm your doubts with a fat error message 8)
jj2007
ok then. I hope it's just a pseudo. But even if it is, it still scares me to see multiple instances of the database are loaded in an infinite loop (if it is even possible at all with mysql).
To all you guys,
I resolved it . Everything runs perfectly...
The only problem I am still having ...
Does someone know how to translate this goasm syntax
;Start the button IDs at one so we don't use 0 (we'll have to dec in order to get the right menu)
TbBtns TBBUTTON <0,1,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE | TBSTYLE_DROPDOWN,0,0,0>
TBBUTTON <1,2,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE | BSTYLE_DROPDOWN,0,0,1>
TBBUTTON <3,3,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE | BSTYLE_DROPDOWN,0,0,2>
TBBUTTON <4,4,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE | BSTYLE_DROPDOWN,0,0,3>
into something which might work ?
It's an array of structures, almost the same in all languajes.
BSTYLE_DROPDOWN is undefined 8)
TbBtns TBBUTTON <0,1,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,0>
TBBUTTON <1,2,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,1>
TBBUTTON <3,3,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,2>
TBBUTTON <4,4,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,3>
Twell ???
Exactely what I wrote.
Does not compile
Writing "does not compile" is a no-no. Every compiler spits out error messages, and it would be extremely helpful to show them here. Btw did you use BSTYLE_DROPDOWN as posted above, or TBSTYLE_DROPDOWN?
My test:.model flat
TBBUTTON STRUCT
iBitmap DWORD ?
idCommand DWORD ?
fsState BYTE ?
fsStyle BYTE ?
; bReserved BYTE 6 DUP (?) ; x64
; bReserved BYTE 2 DUP (?) ; x86
bReserved DWORD ?
dwData DWORD PTR ?
iString DWORD PTR ?
TBBUTTON ENDS
TBSTATE_ENABLED = 4h
TBSTYLE_DROPDOWN = 8h
TBSTYLE_AUTOSIZE = 10h
BTNS_DROPDOWN = TBSTYLE_DROPDOWN
LPSTR typedef PTR BYTE
.data
;Start the button IDs at one so we don't use 0 (we'll have to dec in order to get the right menu)
TbBtns TBBUTTON <0,1,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,0>
TBBUTTON <1,2,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,1>
TBBUTTON <3,3,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,2>
TBBUTTON <4,4,TBSTATE_ENABLED,TBSTYLE_AUTOSIZE OR TBSTYLE_DROPDOWN,0,0,3>
END
so check your header or at least tell us what header file you use and what compiler?