views:

85

answers:

1

i want to call this.. well as good as ShellExecute(Handle, 'open', 'c:\Windows\notepad.exe', nil, nil, SW_SHOWNORMAL) i can call this without issue from within a method of form1

but i just had a procedure "procedure transformdataset();" that i want to call this in and it does not recognise handle... do i just need to make this procedure a method of form1? how do i do that? is that the solution.

+1  A: 

Yes, ShellExecute needs the Window Handle. The most straightforward solution is to pass it in to your method. I find this a bit ugly though so, personally, I'd consider calling ShellExecute when the method returns. If the call is optional (dependent on data), consider returning a status flag from the method that indicates whether the ShellExecute call is required. Either way works, though.

Mark Brittingham
cheers i went for the ugley version but atleast it works thanks :)
Arthur
Ugly is in the eye of the beholder. I hoped you wouldn't take it as anything other than a personal preference. Thanks for marking this as the answer!
Mark Brittingham