08-29-2010, 04:34 PM
hy gintaras
im trying to make my exefile moving itself to a predefined folder on desktop if it is not already saved in that folder.
The code i made works good - when i open the exefile on my C drive it moves itself to the folder on desktop but when open it for example from my D drive or usb stick it just copies it self instead of moving maybe u can tell me what im doing wrong!?
Or is there a better way to do this?
Function Dialog4
Function exemove
best regards
im trying to make my exefile moving itself to a predefined folder on desktop if it is not already saved in that folder.
The code i made works good - when i open the exefile on my C drive it moves itself to the folder on desktop but when open it for example from my D drive or usb stick it just copies it self instead of moving maybe u can tell me what im doing wrong!?
Or is there a better way to do this?
Function Dialog4
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("Dialog4" &Dialog4)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030109 "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,exemove
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
Function exemove
int hwnd = win("Form" "#32770")
int xfind
str myfolder = "$desktop$\My Files"
str currentsaved
currentsaved.getwinexe(hwnd 1)
xfind = find(currentsaved "My Files")
if(xfind = -1)
,mkdir myfolder
,1
,ren currentsaved myfolder
,mes "File moved to folder ''My Files'' on desktop. "
best regards