Recent

Author Topic: [Solved] WinPE - select drive or directory problem  (Read 3432 times)

Harald

  • Newbie
  • Posts: 3
[Solved] WinPE - select drive or directory problem
« on: March 26, 2016, 03:48:50 pm »
Hi, I'm trying to develop an application for Winpe 5.x (created with win 8.1).


I try to use the TselectDirectoryDialog component. because I want the user to select a drive & a Folder.
in Windows 8.1 i works great, but in WinPE it does not work.
The select folder dialog opens, but the treeview is not visible therefor i can not not select the folder or see which drive exist.

So I tried the TOpenDialog this component works, however in delphi i get filename with drive & path but in lazarus only filename.


Any one a solution for this ?
« Last Edit: March 29, 2016, 12:32:16 am by Harald »

Harald

  • Newbie
  • Posts: 3
Re: WinPE - select drive or directory problem
« Reply #1 on: March 29, 2016, 12:23:18 am »
Searched for this for weeks.

Have now found a solution by playing with some components.

The only component seemed to work for this was a TShellTreeView from Misc-page.

So with some help I created a new component that acts like a dialog, based on this TShellTreeView.

Its not as Functional and beautiful as TDirectoryEdit or TSelectDirectoryDialog and the Right-click-, create new folder do not work.
But that's ok for me.

I hope this info is helping others.


marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7458
Re: [Solved] WinPE - select drive or directory problem
« Reply #2 on: March 29, 2016, 10:41:18 am »
Since you don't mention Delphi version. I assume you tested with the most recent?

It could be that winpe only supports a very old version of comctl (e.g. original 2000 or XP), and that Lazarus tries to enable something newer based on version checks.

Harald

  • Newbie
  • Posts: 3
Re: [Solved] WinPE - select drive or directory problem
« Reply #3 on: March 29, 2016, 11:48:42 pm »
thanks marcov for reply.

i have tested with delphi7 , xe6, xe8, xe10 (xe all trialversion).
TOpenDialog is only thing that worked in lazarus and delphi. browseforfolder or selectdirectory functions also not working.
Could be comctl-problem but i like to stick with original winpe.

Where's the fun if not learning the hard way. Now I already found at least four or five way's to open a dialogbox for selecting a folder.
else i would still be stuck with one.


Also found some strange behaviour with my application on winpe.
doesn't matter if i use lazarus or one of the delphi versions.
Some times correctly written procedures like click events etc do not work anymore in winpe after new build. even some procedures wich were not altered.
Here for I found also a solution : always write everything between a try...finally(except)..end for winPE.

example: next sometimes work and sometimes not in winpe

procedure Tform1.button1.click...
begin
   label.text := 'some text';
end;

next always work in winpe

procedure Tform1.button1.click...
begin
  try
    label.text := 'some text';
  finally
  end;
end;

Needed me a week to find out. Even one of my friends ( a professional programmer) could not believe this.
I speak of weeks because i started my little project in june 2015 and is almost ready.
I now restarted the project and i am trying to clean up my code and trying to let it look more professional without nasty workarounds like '*.' in TOpenDialog if i like to select a drive or folder.

I'm just a beginner in programming, sometimes with proffessional help. :D

Hopefully i was of somehelp.