Ir para conteúdo
Fórum Script Brasil
  • 0

Como lidar com a classe pFrame em TWebBrowser


LuloNet

Pergunta

Olá pessoal.

Tenho um site:

...

<div id="pFramePA" class="pFrame">

<div class="pFrameTitulo">Informe o Período de Apuração (MMAAAA) </div>

<div class="pFrameConteudo">

<input class="pa" type="text">

</div>

</div>

</div>

...

Pergunta: Como faço para acessar e informar dados para o campo "pa"?

Desde já obrigado pela ajuda e dicas.

lulonet@gmail.com

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Veja se consegue entender como funciona a classe pFrame ..... um exemplo em Delphi e um em C++

{****************************************************************************** 
 * Copyright (C) 2002 Christian Bendl , TerRoshak@gmx.de              *
 *                                          *
 * This program is free software; you can redistribute it and/or modify          *
 * it under the terms of the GNU General Public License as published by          *
 * the Free Software Foundation; either version 2 of the License, or          *
 * (at your option) any later version.                          *
 *                                          *
 * This program is distributed in the hope that it will be useful,          *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 * GNU General Public License for more details.                      *
 *                                          *
 * You should have received a copy of the GNU General Public License          *    
 * along with this program; if not, write to the Free Software              *
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
 *                                          *
 ******************************************************************************}

unit pframe;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus;

type
  TPageFrame = class(TForm)
    Memo1: TMemo;
    Panel1: TPanel;
    Edit1: TEdit;
    PopupMenu1: TPopupMenu;
    Copy1: TMenuItem;
    VirtualDosBox1: TMenuItem;
    Accessallowed1: TMenuItem;
    procedure FormResize(Sender: TObject);
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Accessallowed1Click(Sender: TObject);
  private
   myguid : TGUID;
   actualpath : string;
    { Private declarations }
  public
  procedure Setmyguid(guid : tguid);
  procedure GetFileList(Path: string; FileList : TStrings);
    { Public declarations }
  end;

implementation

uses Main;

{$R *.dfm}

procedure TPageFrame.GetFileList(Path: string; FileList : TStrings);
var
 I: Integer;
 SearchRec: TSearchRec;
label next;
begin
   I := FindFirst(Path + '*.*', faAnyFile, SearchRec);
   while I = 0 do
   begin
    if (SearchRec.Attr = faDirectory) then filelist.add('\' + SearchRec.Name)
    else filelist.add(SearchRec.Name);
     next:
     I := FindNext(SearchRec);
   end;
end;

procedure TPageFrame.Setmyguid(guid : tguid);
begin
 myguid := guid;
end;

procedure TPageFrame.FormResize(Sender: TObject);
begin
 edit1.width := Panel1.Width -6;
end;

procedure TPageFrame.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if (key = 13) then
 begin
  form1.SendPageByGuid(myguid,edit1.text);
  edit1.text := '';
  key := VK_OEM_CLEAR;
 end;
end;

procedure TPageFrame.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 Form1.DelPage(myguid);
 Action := caFree;
end;

procedure TPageFrame.Accessallowed1Click(Sender: TObject);
begin
 if accessallowed1.checked then accessallowed1.checked := false
 else accessallowed1.checked := true;
end;

end.
=============================================
#include "stdafx.h"    
#include "PEDemo.h"    
   
#include "MainFrm.h"    
#include "ChildFrm.h"    
#include "codeview.h"    
#include "pegrpapi.h"    
   
#ifdef _DEBUG    
#define new DEBUG_NEW    
#undef THIS_FILE    
static char THIS_FILE[] = __FILE__;   
#endif    
   
   
/////////////////////////////////////////////////////////////////////////////    
// theApp    
   
BEGIN_MESSAGE_MAP(theApp, CWinApp)   
    //{{AFX_MSG_MAP(theApp)    
    ON_COMMAND(ID_APP_ABOUT, OnAppAbout)   
    ON_COMMAND(ID_FILE_NEW, OnFileNew)   
    ON_UPDATE_COMMAND_UI(ID_HELP_INDEX, OnUpdateHelpIndex)   
    ON_COMMAND(ID_HELP_INDEX, OnHelpIndex)   
    ON_COMMAND(ID_HELP, OnHelp)   
    ON_COMMAND(ID_MANUAL, OnManual)   
    ON_COMMAND(ID_COMMONQUESTIONS, OnCommonquestions)   
    ON_COMMAND(ID_ENDUSERHELP, OnEnduserhelp)   
    //}}AFX_MSG_MAP    
END_MESSAGE_MAP()   
   
/////////////////////////////////////////////////////////////////////////////    
// theApp construction    
   
theApp::theApp()   
{   
    // TODO: add construction code here,    
    // Place all significant initialization in InitInstance    
}   
   
/////////////////////////////////////////////////////////////////////////////    
// The one and only theApp object    
   
theApp theApp;   
   
/////////////////////////////////////////////////////////////////////////////    
// theApp initialization    
   
BOOL theApp::InitInstance()   
{   
    // Standard initialization    
    // If you are not using these features and wish to reduce the size    
    // of your final executable, you should remove from the following    
    // the specific initialization routines you do not need.    
   
#ifdef _AFXDLL    
    Enable3dControls();         // Call this when using MFC in a shared DLL    
#else    
    Enable3dControlsStatic();   // Call this when linking to MFC statically    
#endif    
   
    AfxInitRichEdit();   
   
    // Change the registry key under which our settings are stored.    
    // such as the name of your company or organization.    
    SetRegistryKey(_T("Gigasoft, Inc."));   
   
    // To create the main window, this code creates a new frame window    
    // object and then sets it as the application's main window object.    
   
    CMDIFrameWnd* pFrame = new CMainFrame;   
    m_pMainWnd = pFrame;   
   
    // create main MDI frame window    
    if (!pFrame->LoadFrame(IDR_MAINFRAME))   
        return FALSE;   
   
    // try to load shared MDI menus and accelerator table    
    //TODO: add additional member variables and load calls for    
    //  additional menu types your application may need.     
   
    HINSTANCE hInst = AfxGetResourceHandle();   
    m_hMDIMenu  = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_PEDEMOTYPE));   
    m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_PEDEMOTYPE));   
   
    // The main window has been initialized, so show and update it.    
    pFrame->ShowWindow(SW_SHOWMAXIMIZED);   
    pFrame->UpdateWindow();   
   
    OnAppAbout();   
       
    OnFileNew();   
       
    return TRUE;   
}   
   
/////////////////////////////////////////////////////////////////////////////    
// theApp message handlers    
   
int theApp::ExitInstance()    
{   
    //TODO: handle additional resources you may have added    
    if (m_hMDIMenu != NULL)   
        FreeResource(m_hMDIMenu);   
    if (m_hMDIAccel != NULL)   
        FreeResource(m_hMDIAccel);   
   
    return CWinApp::ExitInstance();   
}   
   
void theApp::OnFileNew()    
{   
    CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);   
   
    // create a new MDI child window    
    pFrame->CreateNewChild( RUNTIME_CLASS(CChildFrame), IDR_PEDEMOTYPE, m_hMDIMenu, m_hMDIAccel);   
   
    CWnd* pParent = AfxGetMainWnd();   
    if (pParent) {pParent->SetWindowText("ProEssentials v5");}   
}   
   
/////////////////////////////////////////////////////////////////////////////    
// CAboutDlg dialog used for App About    
   
class CAboutDlg : public CDialog   
{   
public:   
    CAboutDlg();   
   
// Dialog Data    
    //{{AFX_DATA(CAboutDlg)    
    enum { IDD = IDD_ABOUTBOX };   
    //}}AFX_DATA    
   
public:   
    int m_nTimer;   
    CRichEditCtrl m_Edit;   
           
    // ClassWizard generated virtual function overrides    
    //{{AFX_VIRTUAL(CAboutDlg)    
    public:   
   
    virtual BOOL PreTranslateMessage(MSG* pMsg);   
    protected:   
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support    
    //}}AFX_VIRTUAL    
   
// Implementation    
protected:   
    //{{AFX_MSG(CAboutDlg)    
    virtual void OnOK();   
    virtual BOOL OnInitDialog();   
    afx_msg void OnTimer(UINT nIDEvent);   
    //}}AFX_MSG    
    DECLARE_MESSAGE_MAP()   
};   
   
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)   
{   
    //{{AFX_DATA_INIT(CAboutDlg)    
    //}}AFX_DATA_INIT    
}   
   
void CAboutDlg::DoDataExchange(CDataExchange* pDX)   
{   
    CDialog::DoDataExchange(pDX);   
    //{{AFX_DATA_MAP(CAboutDlg)    
    //}}AFX_DATA_MAP    
}   
   
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)   
    //{{AFX_MSG_MAP(CAboutDlg)    
    ON_WM_TIMER()   
    //}}AFX_MSG_MAP    
END_MESSAGE_MAP()   
   
// App command to run the dialog    
void theApp::OnAppAbout()   
{   
    CAboutDlg aboutDlg;   
    aboutDlg.DoModal();   
}   
   
/////////////////////////////////////////////////////////////////////////////    
// theApp message handlers    
   
   
void theApp::OnUpdateHelpIndex(CCmdUI* pCmdUI)    
{pCmdUI->Enable(TRUE);}   
   
void theApp::OnHelpIndex()    
{   
    // TODO: Add your command handler code here    
    CMDIFrameWnd* p = (CMDIFrameWnd*) AfxGetMainWnd();   
    ::WinHelp(p->m_hWnd, "peonlref.hlp", HELP_CONTENTS, 0);   
}   
   
void theApp::OnHelp()    
{   
    CWnd* pHasFocus;   
   
    CMDIFrameWnd* p = (CMDIFrameWnd*) AfxGetMainWnd();   
    pHasFocus = p->GetFocus();   
   
    CChildFrame* pWnd = (CChildFrame*) p->MDIGetActive();   
    CCodeView* pCodeView = (CCodeView*) pWnd->m_pCodeView;   
   
    if (pCodeView == pHasFocus)   
        pCodeView->GetPEHelp();   
    else   
    {   
        HWND h = ::GetFocus();   
        DWORD dwHelpID = PEgethelpcontext(h);   
   
        if (dwHelpID)   
        {   
            ::WinHelp(p->m_hWnd, "pegraphs.hlp", HELP_CONTEXT, dwHelpID);   
        }   
        else   
        {   
            /* a non-ProEssentials controls has the focus */   
            ::WinHelp(p->m_hWnd, "pegraphs.hlp", HELP_CONTENTS, dwHelpID);   
        }   
    }   
   
}   
   
void theApp::OnManual()    
{   
    CMDIFrameWnd* p = (CMDIFrameWnd*) AfxGetMainWnd();   
    ::WinHelp(p->m_hWnd, "peonlref.hlp", HELP_CONTEXT, 205);   
}   
   
void theApp::OnCommonquestions()    
{   
    CMDIFrameWnd* p = (CMDIFrameWnd*) AfxGetMainWnd();   
    ::WinHelp(p->m_hWnd, "peonlref.hlp", HELP_CONTEXT, 2);   
}   
   
void theApp::OnEnduserhelp()    
{   
    CMDIFrameWnd* p = (CMDIFrameWnd*) AfxGetMainWnd();   
    ::WinHelp(p->m_hWnd, "pegraphs.hlp", HELP_CONTENTS, 0);   
}   
   
void CAboutDlg::OnOK()    
{   
    // TODO: Add extra validation here    
    KillTimer(m_nTimer);   
    CDialog::OnOK();   
}   
   
BOOL CAboutDlg::PreTranslateMessage(MSG* pMsg)    
{   
    // TODO: Add your specialized code here and/or call the base class    
   
    if (pMsg->message == WM_KEYDOWN)   
    {   
        OnOK();   
    }   
   
    if (pMsg->message == WM_LBUTTONDOWN)   
    {   
        OnOK();   
    }   
       
    return CDialog::PreTranslateMessage(pMsg);   
}   
   
BOOL CAboutDlg::OnInitDialog()    
{   
    CDialog::OnInitDialog();   
       
    CString dialogtext;   
    dialogtext = "\nGigasoft is pleased to introduce ProEssentials v5\n\n";   
   
    dialogtext += "The following demo contains three panes:\n\n";   
    dialogtext += "1) Top-Left pane is a tree control listing examples.  Each control type starts with a simple example and is followed by more complex examples that build upon the simple example.  Be sure to study and the simple examples before moving to the more complex examples.\n\n";   
    dialogtext += "2) Top-Right pane is a Code Window showing code for the selected example.  You can choose between VB.NET, C, Visual Basic, and Delphi formatted code.  Click a BLUE property or function within the Code Window and Press F1 for help on that item (note that currently the VB.NET code window does not support F1, we will be adding this shortly as we also transition to HTML help).  You can also use the Code Window to copy and paste code into your projects.\n\n";   
    dialogtext += "3) Bottom pane is an actual control after the code in Code Window is executed.  You can interact with these controls as described below to produce a huge variety of output.  The competition regularly provides demos with staticly sized controls and properties.  If comparing products, be sure to compare how image quality is maintained dependent upon control size, shape, and user customizations.\n\n\n";   
   
    dialogtext += "User interface for ProEssentials controls:\n\n";   
    dialogtext += "1) Double clicking control in bottom pane will launch a customization dialog or toggle auto-rotation of 3D images.\n\n";   
    dialogtext += "2) Right Button clicking will launch a popup menu.\n\n3) Left Button click and drag will zoom 2D charts.";   
    dialogtext += "  Use the 'z' key or Right-Click and use popup menu to undo the zoom.\n\n";   
    dialogtext += "4) For 3D Scientific Graphs, drag scrollbar thumb-tags to rotate images quickly.\n\n";   
       
    dialogtext += "Other important things to know about demo and ProEssentials product:\n\n";   
    dialogtext += "1) Use the Help menu to get more help on developer features.  Included in the help menu are Commonly Asked Questions.\n\n";   
    dialogtext += "2) When searching our developer help file, build the help search index with the maximum content option.  This provides the most powerful tool to help find what you're looking for.\n\n";   
    dialogtext += "3) The ProEssentials product comes with source code for this demo in VB.NET, Visual C++, Visual Basic, Delphi, and Builder projects.  This allows you to experiment with these examples in your language of choice.\n\n\n";   
       
    dialogtext += "Thank you again for reading this information.  We want your ProEssentials experience to be as efficient as possible.\n\n";   
   
    dialogtext += "To contact Gigasoft:\nphone 817 431 8470\nfax 817 431 9860\nemail info@gigasoft.com.\nIf you have any questions, give us a call or send us an email.\n\n";   
   
    dialogtext += "ProEssentials(TM) is a trademark of Gigasoft, Inc.\n";   
    dialogtext += "Gigasoft(R) is a registered trademark of Gigasoft, Inc.\n";   
   
    CRect rect;   
    GetClientRect(rect);   
   
    WINDOWPLACEMENT wp;   
    CWnd* pWnd = GetDlgItem(IDC_PLACEHOLDER);   
    pWnd->GetWindowPlacement(&wp);   
    rect = wp.rcNormalPosition;    
   
    m_Edit.Create(ES_MULTILINE|WS_VISIBLE|WS_VSCROLL|WS_BORDER, rect, this, 1);   
    m_Edit.SetReadOnly(TRUE);   
   
    CHARFORMAT cf;   
    strcpy(cf.szFaceName, "Arial");   
   
    cf.cbSize = sizeof(cf);   
    cf.dwMask = CFM_SIZE | CFM_FACE;   
    cf.yHeight = 170;   
   
    m_Edit.SetDefaultCharFormat(cf);   
   
    m_Edit.SetWindowText(dialogtext);   
   
    // TODO: Add extra initialization here    
   
    m_nTimer = 0;   
    //m_nTimer = SetTimer(1, 500, NULL);    
   
    return TRUE;  // return TRUE unless you set the focus to a control    
                  // EXCEPTION: OCX Property Pages should return FALSE    
}   
   
void CAboutDlg::OnTimer(UINT nIDEvent)    
{   
    // TODO: Add your message handler code here and/or call default    
    CWnd* p = this;   
    p->FlashWindow(TRUE);   
    CDialog::OnTimer(nIDEvent);   
}

abraço

Link para o comentário
Compartilhar em outros sites

  • 0

Opa,eae beleza?

você pode fazer assim, usando webbrowser:

webbrowser.oleobject.document.all.tags('input').item('p').value := 'value';
ou com idHttp:
var
data:TStringList;
begin
data:= TStringList.Create;
ts.Add('p=valor');
idhttp1.Post('http://www.site.com.br/enviar.php',data); 
end;

Recomendo uso do idHttp..

Abrass.

Editado por Dr_H0us3
Link para o comentário
Compartilhar em outros sites

  • 0

Obrigado pela dica sobre o pFrame.

Lamento muito mas ainda não consegui compreender corretamente o funcionamento.

Não quero ser incomodo para os colegas.

Poderia informar um site com ajudo ou mais alguma informação sobre o pFrame.

Fico no aguardo e obrigado pessoal.

Link para o comentário
Compartilhar em outros sites

  • 0

O Código é esse:

WebBrowser1.OleObject.Document.All.Tags('input').item('pa').value := 'Escreva aqui';

Você tem um campo do tipo text, ou seja, ele é um input, pa deveria ser o nome do seu campo input... daí é só você escrever um texto a frente ou associar à uma variavel ou sei lá... adapte as suas nescessidades...

P.S. Como percebi você tem só a classe do campo texto, você terá que altera-lo para:

<input class="pa" name="pa" type="text">

Abraços

Editado por Douglas_Soares
Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...