Powerbuilder crash when calling API function Openfile()

lul_Handle = gu_ext.OpenFile(ls_file, lstr_FileInfo, 2)
To get the handle of the file I use command above...
Most of the time, the first time I run the script it works, the second time
I get a powerbuilder crash...
Anyone any idea?

The function is declared in the user object gu_ext
Function ulong OpenFile (ref string filename, ref s_fileopeninfo of_struct,
ulong action) LIBRARY "KERNEL32.DLL"

Any ideas?

Thanks



0
ICE
6/26/2003 12:12:06 PM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

8 Replies
736 Views

Similar Articles

[PageSpeed] 30

Don't forget to free the handle afterwards with
Private Function Long CloseHandle(Long hObject) Library "kernel32"

CloseHandle(lul_Handle)

Have you done this?

"ICE" <ICE@nospam.com> wrote in message news:OuCZx19ODHA.218@forums-2-dub...
> lul_Handle = gu_ext.OpenFile(ls_file, lstr_FileInfo, 2)
> To get the handle of the file I use command above...
> Most of the time, the first time I run the script it works, the second
time
> I get a powerbuilder crash...
> Anyone any idea?
>
> The function is declared in the user object gu_ext
> Function ulong OpenFile (ref string filename, ref s_fileopeninfo
of_struct,
> ulong action) LIBRARY "KERNEL32.DLL"
>
> Any ideas?
>
> Thanks
>
>
>


0
Bruce
6/26/2003 1:07:34 PM
This is a multi-part message in MIME format.

------=_NextPart_000_00B5_01C33BF7.D8187BF0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Yes, I've done that..=20
Sometimes I have it the first time I RUN too

drwatson Logfile says this :

Toep: e:\pb8\BUILD\NT\PT80.EXE (PID=3D1260)
Tijd: 26-6-2003 @ 15:23:09.755
Uitzonderingsnummer: c0000005 (schending van toegang) "access violation"



"Bruce H." <Bruce@nospam.com> schreef in bericht =
news:#Q9jKW#ODHA.215@forums-2-dub...
> Don't forget to free the handle afterwards with
> Private Function Long CloseHandle(Long hObject) Library "kernel32"
>=20
> CloseHandle(lul_Handle)
>=20
> Have you done this?
>=20
> "ICE" <ICE@nospam.com> wrote in message =
news:OuCZx19ODHA.218@forums-2-dub...
> > lul_Handle =3D gu_ext.OpenFile(ls_file, lstr_FileInfo, 2)
> > To get the handle of the file I use command above...
> > Most of the time, the first time I run the script it works, the =
second
> time
> > I get a powerbuilder crash...
> > Anyone any idea?
> >
> > The function is declared in the user object gu_ext
> > Function ulong OpenFile (ref string filename, ref s_fileopeninfo
> of_struct,
> > ulong action) LIBRARY "KERNEL32.DLL"
> >
> > Any ideas?
> >
> > Thanks
> >
> >
> >
>=20
>=20

------=_NextPart_000_00B5_01C33BF7.D8187BF0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Yes, I've done that.. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sometimes I have it the first time I =
RUN=20
too</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>drwatson Logfile says this =
:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Toep: e:\pb8\BUILD\NT\PT80.EXE =
(PID=3D1260)<BR>Tijd:=20
26-6-2003 @ 15:23:09.755<BR>Uitzonderingsnummer: c0000005 (schending van =

toegang) <EM>"access violation"<BR></EM></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Bruce H." &lt;</FONT><A=20
href=3D"mailto:Bruce@nospam.com"><FONT face=3DArial=20
size=3D2>Bruce@nospam.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
schreef in=20
bericht </FONT><A href=3D"news:#Q9jKW#ODHA.215@forums-2-dub"><FONT =
face=3DArial=20
size=3D2>news:#Q9jKW#ODHA.215@forums-2-dub</FONT></A><FONT face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; Don't forget =
to free the=20
handle afterwards with<BR>&gt; Private Function Long CloseHandle(Long =
hObject)=20
Library "kernel32"<BR>&gt; <BR>&gt; CloseHandle(lul_Handle)<BR>&gt; =
<BR>&gt;=20
Have you done this?<BR>&gt; <BR>&gt; "ICE" &lt;</FONT><A=20
href=3D"mailto:ICE@nospam.com"><FONT face=3DArial=20
size=3D2>ICE@nospam.com</FONT></A><FONT face=3DArial size=3D2>&gt; wrote =
in message=20
</FONT><A href=3D"news:OuCZx19ODHA.218@forums-2-dub"><FONT face=3DArial=20
size=3D2>news:OuCZx19ODHA.218@forums-2-dub</FONT></A><FONT face=3DArial=20
size=3D2>...<BR>&gt; &gt; lul_Handle =3D gu_ext.OpenFile(ls_file, =
lstr_FileInfo,=20
2)<BR>&gt; &gt; To get the handle of the file I use command =
above...<BR>&gt;=20
&gt; Most of the time, the first time I run the script it works, the=20
second<BR>&gt; time<BR>&gt; &gt; I get a powerbuilder crash...<BR>&gt; =
&gt;=20
Anyone any idea?<BR>&gt; &gt;<BR>&gt; &gt; The function is declared in =
the user=20
object gu_ext<BR>&gt; &gt; Function ulong OpenFile (ref string filename, =
ref=20
s_fileopeninfo<BR>&gt; of_struct,<BR>&gt; &gt; ulong action) LIBRARY=20
"KERNEL32.DLL"<BR>&gt; &gt;<BR>&gt; &gt; Any ideas?<BR>&gt; &gt;<BR>&gt; =
&gt;=20
Thanks<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; <BR>&gt;=20
</FONT></BODY></HTML>

------=_NextPart_000_00B5_01C33BF7.D8187BF0--

0
ICE
6/26/2003 1:30:16 PM
I need the filehandle to be able to use the API GetFileTime, I need the
creationtime of files...


<John_Vanleeuwe> schreef in bericht
news:AF64B388B5E21AFD004F5DA185256D51.004EFF1085256D51@webforums...
> Can you please tell us why you are using the API openfile ? What's the
need
> in your program ? Maybe we can find a workaround for your problem without
> api calls.
>
> HTH
> John Vanleeuwe (mede-belg)


0
ICE
6/26/2003 2:12:33 PM
This should do it fot you.

$PBExportHeader$w_filetimestamp.srw
forward
global type w_filetimestamp from Window
end type
type st_2 from statictext within w_filetimestamp
end type
type sle_timestamp from singlelineedit within w_filetimestamp
end type
type st_1 from statictext within w_filetimestamp
end type
type sle_filename from singlelineedit within w_filetimestamp
end type
type cb_1 from commandbutton within w_filetimestamp
end type
end forward

type FileTime from structure
 ulong  dwLowDateTime
 ulong  dwHighDateTime
end type

type WIN32_Find_DataA from structure
 unsignedlong  dwfileattributes
 filetime  ftcreationtime
 filetime  ftlastaccesstime
 filetime  ftlastwritetime
 unsignedlong  nfilesizehigh
 unsignedlong  nfilesizelow
 unsignedlong  dwreserved0
 unsignedlong  dwreserved1
 character  cfilename[260]
 character  calternatefilename[14]
end type

type SystemTime from structure
 uint  wYear
 uint  wMonth
 uint  wDayOfWeek
 uint  wDay
 uint  wHour
 uint  wMinute
 uint  wSecond
 uint  wMilliseconds
end type

global type w_filetimestamp from Window
int X=1056
int Y=484
int Width=2016
int Height=436
boolean TitleBar=true
string Title="Get File Timestamp"
long BackColor=78682240
boolean ControlMenu=true
boolean MinBox=true
boolean MaxBox=true
boolean Resizable=true
st_2 st_2
sle_timestamp sle_timestamp
st_1 st_1
sle_filename sle_filename
cb_1 cb_1
end type
global w_filetimestamp w_filetimestamp

type prototypes
Function ulong FindFirstFile (string lpFileName, ref WIN32_FIND_DATAA
lpFindFileData) Library "KERNEL32.DLL" Alias for "FindFirstFileA"
Function boolean FileTimeToSystemTime (ref FILETIME lpFileTime, ref
SYSTEMTIME lpSystemTime) Library "KERNEL32.DLL"
Function boolean FileTimeToLocalFileTime (ref FILETIME lpFileTime, ref
FILETIME lpLocalFileTime) Library "KERNEL32.DLL"

end prototypes

type variables

end variables

on w_filetimestamp.create
this.st_2=create st_2
this.sle_timestamp=create sle_timestamp
this.st_1=create st_1
this.sle_filename=create sle_filename
this.cb_1=create cb_1
this.Control[]={this.st_2,&
this.sle_timestamp,&
this.st_1,&
this.sle_filename,&
this.cb_1}
end on

on w_filetimestamp.destroy
destroy(this.st_2)
destroy(this.sle_timestamp)
destroy(this.st_1)
destroy(this.sle_filename)
destroy(this.cb_1)
end on

type st_2 from statictext within w_filetimestamp
int X=78
int Y=180
int Width=677
int Height=76
boolean Enabled=false
string Text="File Modified Timestamp:"
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=67108864
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

type sle_timestamp from singlelineedit within w_filetimestamp
int X=882
int Y=180
int Width=754
int Height=92
BorderStyle BorderStyle=StyleLowered!
boolean AutoHScroll=false
long TextColor=33554432
long BackColor=78682240
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

type st_1 from statictext within w_filetimestamp
int X=78
int Y=84
int Width=315
int Height=76
boolean Enabled=false
string Text="Select File:"
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=67108864
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

type sle_filename from singlelineedit within w_filetimestamp
int X=389
int Y=72
int Width=1248
int Height=92
int TabOrder=20
BorderStyle BorderStyle=StyleLowered!
boolean AutoHScroll=false
long TextColor=33554432
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

type cb_1 from commandbutton within w_filetimestamp
int X=1678
int Y=64
int Width=251
int Height=108
int TabOrder=10
string Text="Browse"
int TextSize=-10
int Weight=400
string FaceName="Arial"
FontCharSet FontCharSet=Ansi!
FontFamily FontFamily=Swiss!
FontPitch FontPitch=Variable!
end type

event clicked;string ls_pathname, ls_filename
WIN32_Find_DataA lfd_lpFindFileData, lfd_lpFindFileData_Local
SystemTime lst_lpSystemTime

if GetFileOpenName ("Pick Any File", ls_pathname, ls_filename) > 0 then
 sle_filename.Text = ls_pathname
 FindFirstFile (ls_pathname, lfd_lpFindFileData)
 FileTimeToLocalFileTime(lfd_lpFindFileData.ftlastwritetime,
lfd_lpFindFileData_Local.ftlastwritetime)
 if FileTimeToSystemTime (lfd_lpFindFileData_Local.ftlastwritetime,
lst_lpSystemTime) then
  sle_timestamp.Text = string (datetime(date(lst_lpSystemTime.wyear, &
   lst_lpSystemTime.wmonth,
lst_lpSystemTime.wday),time(lst_lpSystemTime.whour, &
   lst_lpSystemTime.wminute, lst_lpSystemTime.wsecond)), "mm/dd/yyyy
hh:mm:ss")
 end if
end if
end event


"ICE" <ICE@nospam.com> wrote in message news:Ou$AG5#ODHA.349@forums-2-dub...
> I need the filehandle to be able to use the API GetFileTime, I need the
> creationtime of files...
>
>
> <John_Vanleeuwe> schreef in bericht
> news:AF64B388B5E21AFD004F5DA185256D51.004EFF1085256D51@webforums...
> > Can you please tell us why you are using the API openfile ? What's the
> need
> > in your program ? Maybe we can find a workaround for your problem
without
> > api calls.
> >
> > HTH
> > John Vanleeuwe (mede-belg)
>
>


0
Tyler
6/26/2003 2:20:56 PM
Can you please tell us why you are using the API openfile ? What's the need 
in your program ? Maybe we can find a workaround for your problem without 
api calls.

HTH
John Vanleeuwe (mede-belg)
0
John_Vanleeuwe
6/26/2003 2:26:53 PM
I don't call FileOpen so how can they be the same functions? It sounds like
you are getting access volitions which can be caused by other users/programs
having the file open or the existing program keeping a reference to the file
without seeing your code I could not guess at the reason sorry.

Tyler

"ICE" <ICE@nospam.com> wrote in message news:#Hb$H0$ODHA.359@forums-2-dub...
> I'll try that tomorrow, but doesn't anyone know why my code crashes?
> Functions below are the same I use... there was another sample code on
this
> group, supplied in a previous post (as a reply to my question) called
> w_mytest.srw
> Calling the function openfile gives me that crash...
>
>
>
>
> "Tyler Craft" <NoSpamTyler.Craft@gnb.ca> schreef in bericht
> news:eKDw88#ODHA.359@forums-2-dub...
> > This should do it fot you.
> >
> > $PBExportHeader$w_filetimestamp.srw
> > forward
> > global type w_filetimestamp from Window
> > end type
> > type st_2 from statictext within w_filetimestamp
> > end type
> > type sle_timestamp from singlelineedit within w_filetimestamp
> > end type
> > type st_1 from statictext within w_filetimestamp
> > end type
> > type sle_filename from singlelineedit within w_filetimestamp
> > end type
> > type cb_1 from commandbutton within w_filetimestamp
> > end type
> > end forward
> >
> > type FileTime from structure
> >  ulong  dwLowDateTime
> >  ulong  dwHighDateTime
> > end type
> >
> > type WIN32_Find_DataA from structure
> >  unsignedlong  dwfileattributes
> >  filetime  ftcreationtime
> >  filetime  ftlastaccesstime
> >  filetime  ftlastwritetime
> >  unsignedlong  nfilesizehigh
> >  unsignedlong  nfilesizelow
> >  unsignedlong  dwreserved0
> >  unsignedlong  dwreserved1
> >  character  cfilename[260]
> >  character  calternatefilename[14]
> > end type
> >
> > type SystemTime from structure
> >  uint  wYear
> >  uint  wMonth
> >  uint  wDayOfWeek
> >  uint  wDay
> >  uint  wHour
> >  uint  wMinute
> >  uint  wSecond
> >  uint  wMilliseconds
> > end type
> >
> > global type w_filetimestamp from Window
> > int X=1056
> > int Y=484
> > int Width=2016
> > int Height=436
> > boolean TitleBar=true
> > string Title="Get File Timestamp"
> > long BackColor=78682240
> > boolean ControlMenu=true
> > boolean MinBox=true
> > boolean MaxBox=true
> > boolean Resizable=true
> > st_2 st_2
> > sle_timestamp sle_timestamp
> > st_1 st_1
> > sle_filename sle_filename
> > cb_1 cb_1
> > end type
> > global w_filetimestamp w_filetimestamp
> >
> > type prototypes
> > Function ulong FindFirstFile (string lpFileName, ref WIN32_FIND_DATAA
> > lpFindFileData) Library "KERNEL32.DLL" Alias for "FindFirstFileA"
> > Function boolean FileTimeToSystemTime (ref FILETIME lpFileTime, ref
> > SYSTEMTIME lpSystemTime) Library "KERNEL32.DLL"
> > Function boolean FileTimeToLocalFileTime (ref FILETIME lpFileTime, ref
> > FILETIME lpLocalFileTime) Library "KERNEL32.DLL"
> >
> > end prototypes
> >
> > type variables
> >
> > end variables
> >
> > on w_filetimestamp.create
> > this.st_2=create st_2
> > this.sle_timestamp=create sle_timestamp
> > this.st_1=create st_1
> > this.sle_filename=create sle_filename
> > this.cb_1=create cb_1
> > this.Control[]={this.st_2,&
> > this.sle_timestamp,&
> > this.st_1,&
> > this.sle_filename,&
> > this.cb_1}
> > end on
> >
> > on w_filetimestamp.destroy
> > destroy(this.st_2)
> > destroy(this.sle_timestamp)
> > destroy(this.st_1)
> > destroy(this.sle_filename)
> > destroy(this.cb_1)
> > end on
> >
> > type st_2 from statictext within w_filetimestamp
> > int X=78
> > int Y=180
> > int Width=677
> > int Height=76
> > boolean Enabled=false
> > string Text="File Modified Timestamp:"
> > boolean FocusRectangle=false
> > long TextColor=33554432
> > long BackColor=67108864
> > int TextSize=-10
> > int Weight=400
> > string FaceName="Arial"
> > FontCharSet FontCharSet=Ansi!
> > FontFamily FontFamily=Swiss!
> > FontPitch FontPitch=Variable!
> > end type
> >
> > type sle_timestamp from singlelineedit within w_filetimestamp
> > int X=882
> > int Y=180
> > int Width=754
> > int Height=92
> > BorderStyle BorderStyle=StyleLowered!
> > boolean AutoHScroll=false
> > long TextColor=33554432
> > long BackColor=78682240
> > int TextSize=-10
> > int Weight=400
> > string FaceName="Arial"
> > FontCharSet FontCharSet=Ansi!
> > FontFamily FontFamily=Swiss!
> > FontPitch FontPitch=Variable!
> > end type
> >
> > type st_1 from statictext within w_filetimestamp
> > int X=78
> > int Y=84
> > int Width=315
> > int Height=76
> > boolean Enabled=false
> > string Text="Select File:"
> > boolean FocusRectangle=false
> > long TextColor=33554432
> > long BackColor=67108864
> > int TextSize=-10
> > int Weight=400
> > string FaceName="Arial"
> > FontCharSet FontCharSet=Ansi!
> > FontFamily FontFamily=Swiss!
> > FontPitch FontPitch=Variable!
> > end type
> >
> > type sle_filename from singlelineedit within w_filetimestamp
> > int X=389
> > int Y=72
> > int Width=1248
> > int Height=92
> > int TabOrder=20
> > BorderStyle BorderStyle=StyleLowered!
> > boolean AutoHScroll=false
> > long TextColor=33554432
> > int TextSize=-10
> > int Weight=400
> > string FaceName="Arial"
> > FontCharSet FontCharSet=Ansi!
> > FontFamily FontFamily=Swiss!
> > FontPitch FontPitch=Variable!
> > end type
> >
> > type cb_1 from commandbutton within w_filetimestamp
> > int X=1678
> > int Y=64
> > int Width=251
> > int Height=108
> > int TabOrder=10
> > string Text="Browse"
> > int TextSize=-10
> > int Weight=400
> > string FaceName="Arial"
> > FontCharSet FontCharSet=Ansi!
> > FontFamily FontFamily=Swiss!
> > FontPitch FontPitch=Variable!
> > end type
> >
> > event clicked;string ls_pathname, ls_filename
> > WIN32_Find_DataA lfd_lpFindFileData, lfd_lpFindFileData_Local
> > SystemTime lst_lpSystemTime
> >
> > if GetFileOpenName ("Pick Any File", ls_pathname, ls_filename) > 0 then
> >  sle_filename.Text = ls_pathname
> >  FindFirstFile (ls_pathname, lfd_lpFindFileData)
> >  FileTimeToLocalFileTime(lfd_lpFindFileData.ftlastwritetime,
> > lfd_lpFindFileData_Local.ftlastwritetime)
> >  if FileTimeToSystemTime (lfd_lpFindFileData_Local.ftlastwritetime,
> > lst_lpSystemTime) then
> >   sle_timestamp.Text = string (datetime(date(lst_lpSystemTime.wyear, &
> >    lst_lpSystemTime.wmonth,
> > lst_lpSystemTime.wday),time(lst_lpSystemTime.whour, &
> >    lst_lpSystemTime.wminute, lst_lpSystemTime.wsecond)), "mm/dd/yyyy
> > hh:mm:ss")
> >  end if
> > end if
> > end event
> >
> >
> > "ICE" <ICE@nospam.com> wrote in message
> news:Ou$AG5#ODHA.349@forums-2-dub...
> > > I need the filehandle to be able to use the API GetFileTime, I need
the
> > > creationtime of files...
> > >
> > >
> > > <John_Vanleeuwe> schreef in bericht
> > > news:AF64B388B5E21AFD004F5DA185256D51.004EFF1085256D51@webforums...
> > > > Can you please tell us why you are using the API openfile ? What's
the
> > > need
> > > > in your program ? Maybe we can find a workaround for your problem
> > without
> > > > api calls.
> > > >
> > > > HTH
> > > > John Vanleeuwe (mede-belg)
> > >
> > >
> >
> >
>
>


0
Tyler
6/26/2003 4:32:42 PM
I didn't go through all the other responses so I hope I'm not repeating an
unsuccessful idea; this was taken directly from API Guide:

� lpFileName
Points to a null-terminated string that names the file to be opened. The
string must consist of characters from the Windows 3.x character set. The
OpenFile function does not support Unicode filenames.

lul_Handle = gu_ext.OpenFile(ls_file + Char(0), lstr_FileInfo, 2)

Try terminating the variable ls_file

HTH

"ICE" <ICE@nospam.com> wrote in message news:OuCZx19ODHA.218@forums-2-dub...
> lul_Handle = gu_ext.OpenFile(ls_file, lstr_FileInfo, 2)
> To get the handle of the file I use command above...
> Most of the time, the first time I run the script it works, the second
time
> I get a powerbuilder crash...
> Anyone any idea?
>
> The function is declared in the user object gu_ext
> Function ulong OpenFile (ref string filename, ref s_fileopeninfo
of_struct,
> ulong action) LIBRARY "KERNEL32.DLL"
>
> Any ideas?
>
> Thanks
>
>
>


0
Jon
6/26/2003 7:56:37 PM
I'll try that tomorrow, but doesn't anyone know why my code crashes?
Functions below are the same I use... there was another sample code on this
group, supplied in a previous post (as a reply to my question) called
w_mytest.srw
Calling the function openfile gives me that crash...




"Tyler Craft" <NoSpamTyler.Craft@gnb.ca> schreef in bericht
news:eKDw88#ODHA.359@forums-2-dub...
> This should do it fot you.
>
> $PBExportHeader$w_filetimestamp.srw
> forward
> global type w_filetimestamp from Window
> end type
> type st_2 from statictext within w_filetimestamp
> end type
> type sle_timestamp from singlelineedit within w_filetimestamp
> end type
> type st_1 from statictext within w_filetimestamp
> end type
> type sle_filename from singlelineedit within w_filetimestamp
> end type
> type cb_1 from commandbutton within w_filetimestamp
> end type
> end forward
>
> type FileTime from structure
>  ulong  dwLowDateTime
>  ulong  dwHighDateTime
> end type
>
> type WIN32_Find_DataA from structure
>  unsignedlong  dwfileattributes
>  filetime  ftcreationtime
>  filetime  ftlastaccesstime
>  filetime  ftlastwritetime
>  unsignedlong  nfilesizehigh
>  unsignedlong  nfilesizelow
>  unsignedlong  dwreserved0
>  unsignedlong  dwreserved1
>  character  cfilename[260]
>  character  calternatefilename[14]
> end type
>
> type SystemTime from structure
>  uint  wYear
>  uint  wMonth
>  uint  wDayOfWeek
>  uint  wDay
>  uint  wHour
>  uint  wMinute
>  uint  wSecond
>  uint  wMilliseconds
> end type
>
> global type w_filetimestamp from Window
> int X=1056
> int Y=484
> int Width=2016
> int Height=436
> boolean TitleBar=true
> string Title="Get File Timestamp"
> long BackColor=78682240
> boolean ControlMenu=true
> boolean MinBox=true
> boolean MaxBox=true
> boolean Resizable=true
> st_2 st_2
> sle_timestamp sle_timestamp
> st_1 st_1
> sle_filename sle_filename
> cb_1 cb_1
> end type
> global w_filetimestamp w_filetimestamp
>
> type prototypes
> Function ulong FindFirstFile (string lpFileName, ref WIN32_FIND_DATAA
> lpFindFileData) Library "KERNEL32.DLL" Alias for "FindFirstFileA"
> Function boolean FileTimeToSystemTime (ref FILETIME lpFileTime, ref
> SYSTEMTIME lpSystemTime) Library "KERNEL32.DLL"
> Function boolean FileTimeToLocalFileTime (ref FILETIME lpFileTime, ref
> FILETIME lpLocalFileTime) Library "KERNEL32.DLL"
>
> end prototypes
>
> type variables
>
> end variables
>
> on w_filetimestamp.create
> this.st_2=create st_2
> this.sle_timestamp=create sle_timestamp
> this.st_1=create st_1
> this.sle_filename=create sle_filename
> this.cb_1=create cb_1
> this.Control[]={this.st_2,&
> this.sle_timestamp,&
> this.st_1,&
> this.sle_filename,&
> this.cb_1}
> end on
>
> on w_filetimestamp.destroy
> destroy(this.st_2)
> destroy(this.sle_timestamp)
> destroy(this.st_1)
> destroy(this.sle_filename)
> destroy(this.cb_1)
> end on
>
> type st_2 from statictext within w_filetimestamp
> int X=78
> int Y=180
> int Width=677
> int Height=76
> boolean Enabled=false
> string Text="File Modified Timestamp:"
> boolean FocusRectangle=false
> long TextColor=33554432
> long BackColor=67108864
> int TextSize=-10
> int Weight=400
> string FaceName="Arial"
> FontCharSet FontCharSet=Ansi!
> FontFamily FontFamily=Swiss!
> FontPitch FontPitch=Variable!
> end type
>
> type sle_timestamp from singlelineedit within w_filetimestamp
> int X=882
> int Y=180
> int Width=754
> int Height=92
> BorderStyle BorderStyle=StyleLowered!
> boolean AutoHScroll=false
> long TextColor=33554432
> long BackColor=78682240
> int TextSize=-10
> int Weight=400
> string FaceName="Arial"
> FontCharSet FontCharSet=Ansi!
> FontFamily FontFamily=Swiss!
> FontPitch FontPitch=Variable!
> end type
>
> type st_1 from statictext within w_filetimestamp
> int X=78
> int Y=84
> int Width=315
> int Height=76
> boolean Enabled=false
> string Text="Select File:"
> boolean FocusRectangle=false
> long TextColor=33554432
> long BackColor=67108864
> int TextSize=-10
> int Weight=400
> string FaceName="Arial"
> FontCharSet FontCharSet=Ansi!
> FontFamily FontFamily=Swiss!
> FontPitch FontPitch=Variable!
> end type
>
> type sle_filename from singlelineedit within w_filetimestamp
> int X=389
> int Y=72
> int Width=1248
> int Height=92
> int TabOrder=20
> BorderStyle BorderStyle=StyleLowered!
> boolean AutoHScroll=false
> long TextColor=33554432
> int TextSize=-10
> int Weight=400
> string FaceName="Arial"
> FontCharSet FontCharSet=Ansi!
> FontFamily FontFamily=Swiss!
> FontPitch FontPitch=Variable!
> end type
>
> type cb_1 from commandbutton within w_filetimestamp
> int X=1678
> int Y=64
> int Width=251
> int Height=108
> int TabOrder=10
> string Text="Browse"
> int TextSize=-10
> int Weight=400
> string FaceName="Arial"
> FontCharSet FontCharSet=Ansi!
> FontFamily FontFamily=Swiss!
> FontPitch FontPitch=Variable!
> end type
>
> event clicked;string ls_pathname, ls_filename
> WIN32_Find_DataA lfd_lpFindFileData, lfd_lpFindFileData_Local
> SystemTime lst_lpSystemTime
>
> if GetFileOpenName ("Pick Any File", ls_pathname, ls_filename) > 0 then
>  sle_filename.Text = ls_pathname
>  FindFirstFile (ls_pathname, lfd_lpFindFileData)
>  FileTimeToLocalFileTime(lfd_lpFindFileData.ftlastwritetime,
> lfd_lpFindFileData_Local.ftlastwritetime)
>  if FileTimeToSystemTime (lfd_lpFindFileData_Local.ftlastwritetime,
> lst_lpSystemTime) then
>   sle_timestamp.Text = string (datetime(date(lst_lpSystemTime.wyear, &
>    lst_lpSystemTime.wmonth,
> lst_lpSystemTime.wday),time(lst_lpSystemTime.whour, &
>    lst_lpSystemTime.wminute, lst_lpSystemTime.wsecond)), "mm/dd/yyyy
> hh:mm:ss")
>  end if
> end if
> end event
>
>
> "ICE" <ICE@nospam.com> wrote in message
news:Ou$AG5#ODHA.349@forums-2-dub...
> > I need the filehandle to be able to use the API GetFileTime, I need the
> > creationtime of files...
> >
> >
> > <John_Vanleeuwe> schreef in bericht
> > news:AF64B388B5E21AFD004F5DA185256D51.004EFF1085256D51@webforums...
> > > Can you please tell us why you are using the API openfile ? What's the
> > need
> > > in your program ? Maybe we can find a workaround for your problem
> without
> > > api calls.
> > >
> > > HTH
> > > John Vanleeuwe (mede-belg)
> >
> >
>
>


0
ICE
6/29/2003 3:58:12 PM
Reply:

Similar Artilces:

Dr. Watson Application Crash For PowerBuilder 9 on ResetUpdate() function call
App crashes with a Dr. Warson error on the ResetUpdate() command of a PFC inheritted DW (4-6 times/day). The SQLPreview Event seems tobe the last event triggered prior to executing the stored procedure for update. The linkage service and its Of_Update() function were also disabled for testing and updates done through code calling stored procedures and the crash has been traced down to the ResetUpdate() function of the Detail DW. The PBDebug file states crash occurs calling PB system DLL to reset flags. I have never seen this happen before and wondering if anyone has any pointers?...

Calling a PowerBuilder Function...
Hi Everyone, Ok, here's my problem : I've made a HTML Page with CheckBoxes and a button. When I click on the button I want to catch all checkboxes that are checked to delete the entries in a database. So my problem is to give a PwerBuilder function all adequate parameters from within a HTML Page. Please Help !!! Thanx You need to give each checkbox field a name and a value. Something like this: <input type="checkbox" name="question026" value="2"> Then in your PB function, declare your arguments with the same name as the c...

API Calls from PowerBuilder.
Hi all, I have a problem with API calls. I'd like to now how to call api functions in a DLL that have some functions with parameters like this: DLL: function x ( stru_a ) Structure stru_a { char * name, integer * value_1, Double * value_2, .... } I hope somebody can help me. Thank's. Luiz Paes. Search the Help file for Declaring External Functions and then Calling External Functions. This will explain how (and where) to declare and call your API functions. Zane Knight. ...

Better to use API fn call/Powerbuilder fn call ...
I have a rather elementary question. Is there any difference in application performance if I use an API call rather than a PowerBuilder function call ? eg Suppose there is PowerBuilder function 'X' which will bring a window to the foreground. An API function 'Y' does the same. Assuming that I need not prepare/initialize any structure etc to be passed to the API function 'Y', does it make any difference to the app performance if I make an API call instead of the PowerBuilder function call 'X' ? Thx Ganesh The difference would be virtually i...

PowerBuilder API Call Problem
I have a PowerBuilder application running under PB 6.5 and Win NT. I am running a WinAPI function, GetWindowsDirectory. It is initialized by the following declaration: Function long GetWindowsDirectory(String lpBuffer, Long nSize) LIBRARY "kernel32.DLL" Alias For "GetWindowsDirectoryA" In a window function I make a call to GetWindowsDirectory like this: string sWinDir long lReturn long iSysPath lSysPath = 256 sWinDir = space(lSysPath) lReturn = GetWindowsDirectory(sWinDir, lSysPath) lReturn returns 8, but sWinDir is empty. The code works in Visual B...

PowerBuilder and OLEObject Function Calls...
Hello PowerBuilders, I got a OLE Object in which I use one of the Functions to Open a Specific Dialog. Where the user can type in some data. I think after about one minute in the Dialog, PowerBuilder brings up the message "Error calling external Function...". Is it possible to raise the timout, PowerBuilder waits for a correct return out of the function ? I am using PowerBuilder 7 Build 7023... Thanks in Advance, Andreas Eibegger andreas.eibegger@grz.andritz.com The default timeout is 5 minutes. If you want to make it longer than that, look at the SetAutoma...

PowerBuilder API-Call Problem
I have a PowerBuilder application running under PB 6.5 and Win NT. I am running a WinAPI function, GetWindowsDirectory. It is initialized by the following declaration: Function long GetWindowsDirectory(String lpBuffer, Long nSize) LIBRARY "kernel32.DLL" Alias For "GetWindowsDirectoryA" In a window function I make a call to GetWindowsDirectory like this: string sWinDir long lReturn long iSysPath lSysPath = 256 sWinDir = space(lSysPath) lReturn = GetWindowsDirectory(sWinDir, lSysPath) lReturn returns 8, but sWinDir is empty. The code works in Visual...

External function call from Powerbuilder
Hi, I am having trouble in calling the function GetUsernameA() function from the Advapi32.dll. GetUsernameA(string lpBuffer, long lpnsize) The function requires a pointer to a string and pointer to a long as arguements. The PB equivalants to this are string and long. IF I call this function it returns only the size (lpnsize) and not the lpBuffer. Can somebody help me in this. I am stuck with this Thanks in advance Vinod Thomas Vinod -- You need to preallocate space for the name and pass the amount of space in the 'size' argument. Something like this: // func...

Calling a Java function from PowerBuilder
Hi all, We need to call a Java function from within PowerBuilder. I realize PB 6.5 can generate Java code but how do we call the functions? We know we can write an external function call to a C program which can make the call. Is there a better way? Thanks. Andy Egleston Is it a running applet or application that can be listening for requests on a socket? You could use a socket OCX and communicate with it from PB that way. Carson ________________________________________________ Carson Hager Dynamic Data Solutions, Inc. Te...

Powerbuilder
Does anybody have a cross reference list of the PowerBuilder powerscript to obsolete windows API calls?? Has anybody created new functions to handle the new windows API calls?? Thanks, Denise ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp ...

Function call from Powerbuilder DLL
Hi All, I am using poerbuilder(6.5) created DLL(Machine code) and i have following code in VB to call function from that DLL. Private Sub Command1_Click() Dim pbo As New PBCOM.CoMsg Dim ret As Integer ->ret = pbo.of_status(6) 'This line got error message End Sub Error message : Run Time Error 429 ActiveX component cant create object. Here is PB DLL detail: PB COM Server File Name: C:\mdesai\pbcom\PBCOM.dll Interface Definition File Name: C:\mdesai\pbcom\PBCOM.idl PB COM Server Type: In Process Server Object :uo_msg COM ClassName:CoMsg Program ID:PB60CO...

Calling win32api functions from powerbuilder
Hi, I used to use a function called FindWindow in the user.exe windows 3.11 api library. I want to move my app. to a 32 bit app. on windows 95 using pb5.0. How do I declare this function in windows 95 and what library can i find it in? The old declaration syntax was: function int FindWindow (string classname, string window) library "user.exe" Any help will be greatly appreciated. Thanks, Rohit FUNCTION uint FindWindowA (long classname, & string windowname) LIBRARY "user32.dll" Then add code like the following to your application's open e...

How to call MSMQ API from Powerbuilder
Hi all, can someone point me to a site/newsgroup, etc. that explains/shows how to get Powerbuilder to communicate with MSMQ? I am working in a legacy App that now requires to send messages to a MSMQ queue. Any help very appreciated! Don't know about MSMQ, but here's one for MQSeries: http://www.rgagnon.com/howto.html Click on PowerBuilder --> What's New --> Use MQSeriers HTH Greg <Gabriel Gutierrez> wrote in message news:3fa7c6b2.653e.846930886@sybase.com... > Hi all, > > can someone point me to a site/newsgroup, etc. that > e...

Powerbuilder application "crashing" another powerbuilder application
This is a repost of the above subject since there has been some problem for messages posted on the 19th - 22nd July 2002. *************** Hi All, I have an application (App A)built using PB7.0.3 build 10077 and it seems to work fine. However, recently, another application (App B) built using PB 7.0.3 build 10047 as well was installed and it seems to trigger Dr Watson on App A. There is an embedded OCX on a "main" window on App A, which receives triggers from external applications. The OCX will then call another function sitting on another main window. That function w...

Web resources about - Powerbuilder crash when calling API function Openfile() - sybase.powerbuilder.general

PowerBuilder - Wikipedia, the free encyclopedia
PowerBuilder is an integrated development environment owned by Sybase , a division of SAP . It has been in use since 1991, peaking around 1998 ...

Sybase PowerBuilder tool readied for Microsoft's .Net
... Win32 or newer style .Net development After several years of work, Sybase is ready to deliver on the final step in its plan to move PowerBuilder ...

Jim O'Neil (@jimoneil) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Open Directory - Computers: Programming: Languages
about dmoz - dmoz blog - report abuse/spam - help the entire directory only in Programming/Languages Description Top : Computers : Programming ...

The HP Booth Staff (Goons) Owe Me an Apology
... when you might need to use it. For instance, when I was in the WinRunner world there were plugins for driving terminal emulators and powerbuilder ...

Contact Us - Sybase Inc
Thanks for visiting the 主页 section of Sybase.com. Here you will find information about Contact Us. For more information about Business Intelligence, ...

热门搜索 - 我的异常网
... 我的异常网 » 热门搜索 sdpnet2 移动【A111】其它用户原因鉴权失败,是什么意思啊 http:// 192.168.1.102:22578 本网站服务器位于美国,受美国法律保护 MiniUI js 破解 http://192.168.1.103:8080/ powerbuilder ...

Mobile app security: Always keep the back door locked
The best way to keep mobile apps safe is to secure the services they connect to.

10 Tech Skills That Will Instantly Net You A $100,000+ Salary
... that let's developers run Java applications. Java is highly popular language for writing web apps and custom enterprise apps. No. 8: PowerBuilder ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Resources last updated: 12/4/2015 7:31:01 PM