954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

API Help

I'm trying to use input from a text edit box to delete a file. The input from the textbox will be the file location and the delete button will use DeleteFile() to delete the file.

[img]http://img436.imageshack.us/img436/5578/deleteboxvn0.png[/img]

Do you know what I mean?

Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1
 

Yes. We understand what you mean. But where do you have the problem?

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 
Yes. We understand what you mean. But where do you have the problem?

I want to use the text that was put in the textbox(the file location) to be used in the DeleteFile function.

DeleteFile(FileName)

In FileName I want the text that the user input to be used. Just like I would use cin.

Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1
 

Use GetWindowText to copy the text in the edit box, and call DeleteFile for that text.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Thanks a lot man.

Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1
 

"The GetWindowText function copies the text of the specified window's title bar"

Thats not what I want.

Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1
 

If you read further it says that if it is a control it copies the text of the control.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 
If you read further it says that if it is a control it copies the text of the control.


You're right. lol. I over read. Sorry.

Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1
 

Okay, Im still confused. Can anyone else help?

Quan Chi2
Junior Poster in Training
67 posts since Jul 2005
Reputation Points: 14
Solved Threads: 1
 

Okay then. Try sending the EM_GETLINE Message. That surely ought to work.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 
Okay, Im still confused. Can anyone else help?



How about this :

len = GetWindowTextLength(GetDlgItem(yourwindowhwnd, yourtextboxtID));
if(len > 0)
{
int i;
char* buf;
buf = (char*)GlobalAlloc(GPTR, len + 1);
GetDlgItemText(yourwindowhwnd, yourtextboxID, buf, len + 1);

string filename = buf;
GlobalFree((HANDLE)buf);
}

Han1977
Newbie Poster
7 posts since Aug 2006
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You