Autor Beitrag
freshness
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43

Win XP Pof, Vista
Delphi 2006
BeitragVerfasst: Do 17.03.05 18:37 
ich möchte, dem hinttext einer TNA den Wert einer string-variable zuweisen.
Wie geht das ?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
with IconData do
    begin
      cbSize := SizeOf (TNOTIFYICONDATA);
      Wnd := Handle;
      uID := 1;
      uFlags := NIF_ICON + NIF_TIP;
      hIcon := LoadIcon (0, IDI_INFORMATION);
      szTip := 'help';
// so gehts leider nicht szTip := helptext;
    end;
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: Do 17.03.05 18:50 
kannst du nicht mal den fehler posten??
hab keine lust deswegen extra nen neues projekt anzufangen...

kann das vllt sein das "szTip" vom typ pchar sein muss??
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Do 17.03.05 18:51 
ausblenden Delphi-Quelltext
1:
szTip := PChar(helptext);					
freshness Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43

Win XP Pof, Vista
Delphi 2006
BeitragVerfasst: So 20.03.05 19:51 
Titel: Fehlermeldung
die Fehlermeldung bei der Variante:

ausblenden Delphi-Quelltext
1:
 IconData.szTip:= helptext ; // helptexttyp = string					


Inkompatible Typen: 'Array' und 'String'

Warum ist IconData.szTip ein Array ?? und wie kann ich dem einen stringwert zuweisen ?
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: So 20.03.05 20:15 
Das steht in der Hilfe:

Zitat:

typedef struct _NOTIFYICONDATA {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
TCHAR szTip[64];
DWORD dwState;
DWORD dwStateMask;
TCHAR szInfo[256];
union {
UINT uTimeout;
UINT uVersion;
};
TCHAR szInfoTitle[64];
DWORD dwInfoFlags;
GUID guidItem;
} NOTIFYICONDATA, *PNOTIFYICONDATA;

szTip
Pointer to a null-terminated string with the text for a standard ToolTip. It can have a maximum of 64 characters including the terminating NULL.

For Version 5.0 and later, szTip can have a maximum of 128 characters, including the terminating NULL.


Das heißt "szTip" ist ein array of char mit 64 zeichen.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: So 20.03.05 20:25 
Titel: Re: Fehlermeldung
freshness hat folgendes geschrieben:
Warum ist IconData.szTip ein Array ?? und wie kann ich dem einen stringwert zuweisen ?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  NewTip: String;
begin

  NewTip := 'Hello World!';
  StrLCopy(IconData.szTip, PChar(NewTip), SizeOf(IconData.szTip) - 1);
  Shell_NotifyIcon(NIM_MODIFY, @IconData);

end;

_________________
Ciao, Sprint.
freshness Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43

Win XP Pof, Vista
Delphi 2006
BeitragVerfasst: So 20.03.05 20:27 
Titel: stirng to array of Char
Wie kann ich eine Stringvariable in ein array of Char mit 64 Zeichen umwandeln ?
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: So 20.03.05 20:28 
Titel: Re: Fehlermeldung
user profile iconSprint hat folgendes geschrieben:
freshness hat folgendes geschrieben:
Warum ist IconData.szTip ein Array ?? und wie kann ich dem einen stringwert zuweisen ?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  NewTip: String;
begin

  NewTip := 'Hello World!';
  StrLCopy(IconData.szTip, PChar(NewTip), SizeOf(IconData.szTip) - 1);
  Shell_NotifyIcon(NIM_MODIFY, @IconData);

end;


Steht doch da??
freshness Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43

Win XP Pof, Vista
Delphi 2006
BeitragVerfasst: So 20.03.05 20:40 
Titel: das nenn ich eine Hilfe
Danke an sprint für die Hilfe. :D
Das nenn ich eine hilfreiche Unterstützung.
konstruktiver Code statt Zitate aus der Dephihilfe.

thx
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: So 20.03.05 20:43 
Durch Code schnippsel lernst du aber nichts.
Hättest du die Hilfe weiter durchsucht wüsstest du auch wie man einem Array einen Stringwert zuweist!!