//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
void ShowProperties(String FileName)
{
SHELLEXECUTEINFO ShExecInfo ={0};
ShExecInfo.cbSize = sizeof(ShExecInfo);
ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;
ShExecInfo.hwnd = GetDesktopWindow();
ShExecInfo.lpVerb = "properties";
ShExecInfo.lpFile = FileName.c_str();
ShExecInfo.lpParameters = "Szczegóły";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
}
//---------------------------------------------------------------------------
int CONVERT(String litera)
{
for(int i = -113; i <= 255; i++)
{
if(litera == CHAR(i))
return i;
}
return 0;
}
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (OpenDialog1->Execute())
{
Edit1->Text = ExtractFileName(OpenDialog1->FileName);
ShowProperties(OpenDialog1->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
HWND h, h2, h3, h4, h5, h6;
h = FindWindow(NULL,("Właściwości: "+ Edit1->Text).c_str());
if(h == NULL)
{
ShowMessage("Nie odnaleziono okna właściwości pliku");
return;
}
h2 = FindWindowEx(h, 0, "#32770", "Szczegóły");
if (h2 == NULL)
{
ShowMessage("Nie odnaleziono pola #32770");
return;
}
h3 = FindWindowEx(h2, 0, "SysListView32", "Properties");
if (h3 == NULL)
{
ShowMessage("Nie odnaleziono pola SysListView32");
return;
}
h4 = FindWindowEx(h3, 0, "PropertyControlBase", NULL); // doszedłem z tym do ładu
if (h4 == NULL) // chodzi o to że nie wykrywa tego pola jeżeli nie
{ // jest zaznaczone, i tutaj moje pytanie
ShowMessage("Nie odnaleziono pola PropertyControlBase"); // Jak zaznaczyć to pole oraz
return; // Jak poruszać się tych polach góra i dół czy w ogóle się da
}
h5 = FindWindowEx(h4, 0, "SHELLDLL_MVPEditControl", "");
if (h5 == NULL)
{
ShowMessage("Nie odnaleziono pola SHELLDLL_MVPEditControl");
return;
}
h6 = FindWindowEx(h5, 0, "RICHEDIT50W", "");
if (h6 == NULL)
{
ShowMessage("Nie odnaleziono pola RICHEDIT50W");
return;
}
SendMessage(h6, WM_CHAR, VK_BACK, 1); // chcę by mi wyczyściło zawartość pola przed dodawaniem
// jednak nic się nie dzieje
String nazwa = Edit1->Text;
String tekst = nazwa.SubString(1,nazwa.LastDelimiter("-")-2).Trim();
for(int i = 1; i <= tekst.Length(); i++)
{
String tmp = tekst.SubString(i, 1);
WORD a = CONVERT(tmp);
SendMessage(h6, WM_CHAR, (WPARAM)a, 1);
}
}
//---------------------------------------------------------------------------