Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2004, 04:38 PM
Chesso Chesso is offline
Senior Member
 
Join Date: May 2004
Location: Sydney, Australia
Posts: 1,199
Default Error Incompatible Types String And PansiChar using FindWindow API.

Hey im trying to set the tet of a Edit control to a String and pass it to the FindWindow API as the windowname to get the handle but i get Incompatible Type error when trying to run the app.

How can i fix this?
Reply With Quote
  #2  
Old 05-28-2004, 10:14 PM
AREF AREF is offline
Senior Member
 
Join Date: Feb 2001
Posts: 285
Default RE: Error Incompatible Types String And PansiChar using FindWindow API.

Hello

You must do a type cast. like this:

var
S:String;
Begin
S:=Edit1.Text;
FindWindow(Pchar(S) , emptyParam);

Hope it hepls.


Aref
Reply With Quote
  #3  
Old 05-30-2004, 01:06 AM
Chesso Chesso is offline
Senior Member
 
Join Date: May 2004
Location: Sydney, Australia
Posts: 1,199
Default RE: Error Incompatible Types String And PansiChar using FindWindow API.

Ok i did this and it seems to be working fine.

FindWidnow(Nil, Pchar(Variable));

Is there anything extra/at all i should know about Pchar().
Reply With Quote
  #4  
Old 05-30-2004, 01:39 AM
AREF AREF is offline
Senior Member
 
Join Date: Feb 2001
Posts: 285
Default RE: Error Incompatible Types String And PansiChar using FindWindow API.

Hi

Pchar is a null-terminated string type which Delphi uses due to compatibility issues with Windows APIs.
You should reffer to Delphi help to get to know all functions related to Pchar , then click to accept my answer

Aref
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.