![]() |
Trouble with SendMessage();
1 Attachment(s)
So, I got re-interested in programming again, and I decided to pick back up development of SecureOverwrite. I am having trouble with SendMessage(). Here's what I want to do:
- Have a browse button that calls a browse function - Get file name selected in browse window and send it to my editbox - SecureOverwrite said file. The first and third things on the list I can do, and have done. (Well, my algorithm is just overwriting the file with 0's, one for every byte of the file... I'll work on that later) It's the second that is giving me trouble. When the function gets the file that I have selected in the browse window, it's supposed to send it along to the editbox; I can then overwrite it. Problem is, somewhere along the way the message (filename string) gets "lost". Nothing gets written to the editbox. I would be most grateful if I could be given some hints as to how I might fix this problem. I have attached the code in a .zip file. If you need me to elaborate more on my problem, say so, and I will be glad to. Thank you. :) |
Consider this an early Christmas present (Bah, humbug!); I don't normally look at attachments in this forum, as they indicate that the person asking the question hasn't put in the effort to find a small example that illustrates the problem.
The most obvious offending code (I stopped at this point, so there may be more) is this; :
Buffer[MAX_PATH] = szFileName[MAX_PATH];If you want to copy C-style strings around, use the strcpy() function, not simple assignment. |
Thank you very much, grumpy.
I have this code now: :
:
The MessageBox() in the second code example displays the path that I select in my browse function. If I change IDC_EDITBOX_TEXT to IDC_LISTBOX_TEXT, the message is received just fine. It displays the path in the listbox. This is fine, this is wonderful, this is dandy, but this is not what I want. I want to put the string into my editbox, and for some reason, SendMessage() fails on doing this. (I think) Here is my editbox code: :
What am I doing wrong here? Thanks again. |
I figured out what I was doing wrong! I was using ListBox flags in SendMessage, and I should have been using EditBox flags. :)
|
| All times are GMT -5. The time now is 1:26 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC