Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1421 connectés 

  FORUM HardWare.fr
  Programmation

  [Prog Windows] CreatWindows et Fenetre fille de sasie de texte ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Prog Windows] CreatWindows et Fenetre fille de sasie de texte ?

n°73216
barbarella
Posté le 18-11-2001 à 03:27:57  profilanswer
 

salut,
 
ben sous BC5 j'avais pris l'habitude de faire ça, mais apparement VC6 n'en veut pas :
 
    EditWin = CreateWindow("EDIT","",
              WS_CHILD | WS_VISIBLE | WS_BORDER |
              WS_VSCROLL | // ES_READONLY |
              ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
              0, 150, 250, 250, hWnd,NULL,
              hInstance, NULL);
 
En fait l'écriture d'un texte se fait bien dans la fenetre (pour le point de départ) mais elle ne s'arrete pas au bord de cette fenetre fille mais a celle de la mère ?  
 
Bon comme j'suis pas expert en prog windows, il est possible que je me sois planté dès le départ que c'est seulement BC5 qui acceptait mes conneries.
 
Toujours est-il je veux afficher un texte dans un fenetre (fille ou mère) et ce texte peut-être très long et il me faut la barre de scroling Vertical pour pouvoir monter ou descendre le texte.
 
merci

mood
Publicité
Posté le 18-11-2001 à 03:27:57  profilanswer
 

n°73220
HelloWorld
Salut tout le monde!
Posté le 18-11-2001 à 05:29:27  profilanswer
 

tu veux dire que le texte de ton edit box continu en dehors de celui ci jusqu'au bord de la fenetre maman ?
je suis en pleine autoformation a win32, mais il me semble que le seul moyen pour qu'une fenetre fille ecrive comme ca sur ca maman est que la maman lui autorise (avec le style CS_PARENTDC ou CS_CLASSDC, mais j'en suis pas ur)
peux-tu donner le code de creation de ton hWnd, et en particulier le RegisterClass


---------------
FAQ fclc++ - FAQ C++ - C++ FAQ Lite
n°73232
barbarella
Posté le 18-11-2001 à 11:28:25  profilanswer
 

oui,
 
c'est ce qui se passe sous VC6, donc voici une partie du code  
 
 
ATOM MyRegisterClass(HINSTANCE hInstance)
{
 WNDCLASSEX wcex;
 
 wcex.cbSize = sizeof(WNDCLASSEX);  
 
 
   
  wcex.style   = CS_HREDRAW | CS_VREDRAW;
 wcex.lpfnWndProc = (WNDPROC)WndProc;
 wcex.cbClsExtra  = 0;
 wcex.cbWndExtra  = 0;
 wcex.hInstance  = hInstance;
 wcex.hIcon   = LoadIcon(hInstance, (LPCTSTR)IDI_PROJECT152);
 wcex.hCursor  = LoadCursor(NULL, IDC_ARROW);
 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
 wcex.lpszMenuName = (LPCSTR)IDC_PROJECT152;
 wcex.lpszClassName = szWindowClass;
 wcex.hIconSm  = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
 
 return RegisterClassEx(&wcex);
}
 
//
//   FUNCTION: InitInstance(HANDLE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;
 
   hInst = hInstance; // Store instance handle in our global variable
 
   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
 
   if (!hWnd)
   {
      return FALSE;
   }
 
 
    EditWin = CreateWindow(WS_EX_LTRREADING,"EDIT","",
              WS_CHILD | WS_VISIBLE | WS_BORDER |
              WS_VSCROLL | // ES_READONLY |
              ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
              0, 150, 200, 250, hWnd,NULL,
              hInstance, NULL);
 
 ShowWindow(hWnd, nCmdShow);
 UpdateWindow(hWnd);
 
 
 return TRUE;
}
 
//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND - process the application menu
//  WM_PAINT - Paint the main window
//  WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
 int wmId, wmEvent;
 PAINTSTRUCT ps;
 HDC hdc;
 TCHAR szHello[MAX_LOADSTRING];
 LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
 
 switch (message)  
 {
  case WM_COMMAND:
   wmId    = LOWORD(wParam);  
   wmEvent = HIWORD(wParam);  
   // Parse the menu selections:
   switch (wmId)
   {
    case IDM_ABOUT:
       DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
       break;
    case IDM_EXIT:
       DestroyWindow(hWnd);
       break;
    default:
       return DefWindowProc(hWnd, message, wParam, lParam);
   }
   break;
  case WM_PAINT:
   hdc = BeginPaint(hWnd, &ps);
   // TODO: Add any drawing code here...
   RECT rt;
   GetClientRect(hWnd, &rt);
   DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
   EndPaint(hWnd, &ps);
   break;
  case WM_DESTROY:
   PostQuitMessage(0);
   break;
  default:
   return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}
 
// Mesage handler for about box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
 switch (message)
 {
  case WM_INITDIALOG:
    return TRUE;
 
  case WM_COMMAND:
   if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)  
   {
    EndDialog(hDlg, LOWORD(wParam));
    return TRUE;
   }
   break;
 }
    return FALSE;
}
 
void poseS(HWND hwnd,int x, int y,char *ch)
{
HDC dc;
 
   dc = GetDC(hwnd);
   SetBkColor(dc,GetSysColor(COLOR_WINDOW));
   TextOut(dc,x,y,ch,strlen(ch));
   ReleaseDC(hwnd,dc);
}
 
 
void toto()
{
 int i;
 
 char A[100000];
 
 memset(A,0,100000);
 for(i=0;i<10000;i++)
   A[i] = 'A';
 
 poseS(EditWin,30,10,A);
}

 

[edtdd]--Message édité par barbarella--[/edtdd]

n°73233
barbarella
Posté le 18-11-2001 à 11:28:26  profilanswer
 

Bon ben,
 
ceux qui ont une idée m'aideraient bcp :). C'est pour pouvoir démarrrer un cours sur les grands nombres et le calcul de PI. Je souhaiterais réutiliser les codes de mes algos de l'époque ou j'étais chasseur de PI.
 
merci

 

[edtdd]--Message édité par barbarella--[/edtdd]

n°73234
TheJackal
Posté le 18-11-2001 à 11:35:23  profilanswer
 

me dit pas que tu ecris dans le Edit avec TextOut? :heink:  :??:  
sinon je suppose que EditWin a ete declare plus haut

n°73236
barbarella
Posté le 18-11-2001 à 11:39:15  profilanswer
 

Ok,
 
c'est ça, en fait je dois utilser un  
 
 
SetWindowText(EditWin, A);
 
 
merci :)

 

[edtdd]--Message édité par barbarella--[/edtdd]

n°73237
TheJackal
Posté le 18-11-2001 à 11:40:43  profilanswer
 

ben voila :)
 
sinon apres ta d'autre msg a envoyer si tu veux select du text, le remplacer...

n°73238
barbarella
Posté le 18-11-2001 à 11:43:21  profilanswer
 

ben,
 
tu sais l'affichage est hyper simple pour ce programme.
 
- init des variables
- Passe 1,2,3 ...
- conversion bin -> dec
- affichage PI
 
par contre c'est le calcul qui complexe :)

n°73239
TheJackal
Posté le 18-11-2001 à 11:53:34  profilanswer
 

disait au ca ou... je c pas ce que tu veux en faire

n°73243
barbarella
Posté le 18-11-2001 à 12:53:26  profilanswer
 

oui,
 
c'est sympa de toute façon si j'ai un prob a nouveau avec l'interface de win je poste ici. Mais rien qu'a pensé a me replonger dans mes algo de FFT optimisés j'ai une sensation du 'je vais en chier pour me rappeler tout ça' :D Alors je fais le strict minimum pour l'interface pour l'instant

mood
Publicité
Posté le 18-11-2001 à 12:53:26  profilanswer
 

n°73296
HelloWorld
Salut tout le monde!
Posté le 18-11-2001 à 17:21:47  profilanswer
 

Code :
  1. SendMessage(EditWin, WM_SETTEXT, 0, A);


au lieu de ton

Code :
  1. poseS(EditWin,30,10,A);


et a mon avis tout rentrera dans l'ordre


---------------
FAQ fclc++ - FAQ C++ - C++ FAQ Lite
n°73301
TheJackal
Posté le 18-11-2001 à 17:26:56  profilanswer
 

:sarcastic:

n°73307
HelloWorld
Salut tout le monde!
Posté le 18-11-2001 à 17:46:47  profilanswer
 

oups
:lol: :lol:
mieux vaut 2 fois qu'une ...
 
et de toutes façons, pour des composants standards, c'est mieux :na:
 
"SetWindowText changes the text of a given window. Although this function can set the text of regular windows owned by other programs, it cannot change the text of a control owned by a different program. To set the text of those controls, use the WM_SETTEXT message instead."


---------------
FAQ fclc++ - FAQ C++ - C++ FAQ Lite
n°73314
barbarella
Posté le 18-11-2001 à 18:03:16  profilanswer
 

ok,
 
merci pour cette précision :). mais bon ce que je suis en train de récupérer ce n'est pas vraiment ce qu'on peut appeler un composant standard. ça serait plutot composants foutoires :D

 

[edtdd]--Message édité par barbarella--[/edtdd]


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  [Prog Windows] CreatWindows et Fenetre fille de sasie de texte ?

 

Sujets relatifs
ASP / Windows XP : arrive pas a ouvrir ma base de donnee !Optimisation de requetes SQL...y'a un prog qui fait ca tout seul ??
Question simple pour programmer sous windows[HTML][JavaScript] changer le texte affiché sur la page
[Javascript] URGENT - ouverture d'une fenêtre qui reste en avant planGui Windows / Linux
[VB] Placer le curseur dans telle ou telle zone de texte[ c ] Niveaux de priorité d'un prog par rapport a un autre
[HTML/JavaScript] Comment modifier du texte dynamiquement ?Windows, c++ et wav
Plus de sujets relatifs à : [Prog Windows] CreatWindows et Fenetre fille de sasie de texte ?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR