|
sharanu wrote: which is better concept shall i use....
It all depends on how you are opening the file. In general, you want to open the file exclusively, or deny others read|write access.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i am trying to insert text into notepad.
CWnd *myWnd = FindWindow(_T("Notepad"), _T("Untitled - Notepad"));
if(myWnd)
{
::PostMessage(myWnd->GetSafeHwnd(),WM_CHAR,(BYTE)'a',0x000e0001);
} if i enable the second line, notepad is quitting. how to insert a character? it is not working.
|
|
|
|
|
http://dictionary.reference.com/browse/destroy[^]
Destroy:
1. to reduce (an object) to useless fragments, a useless form, or remains, as by rending, burning, or dissolving; injure beyond repair or renewal; demolish; ruin; annihilate.
You're getting the main window for notepad.exe - so it shouldn't come as a great shock that if you send a DESTROY! message, it closes. What did you expect?
Even if you actually had the text area for notepad, why on earth would you think WM_DESTROY would help you put a character there? I hope I'm missing out on something in your question that you didn't write down.
Your idea of sending a WM_CHAR isn't bad - but you're sending it to the main window for the application. If I use Spy++ on notepad, there are two child windows - a big edit one, and a status bar window. You could get the child window, and try sending the WM_CHAR to that. But that is implementation dependent. For all I know, notepad.exe under Vista is built completely differently. Maybe it uses a richedit window, rather than an edit one? Or Notepad under windows 2000 didn't have subwindows, it just worked as you expected.
I would have a look at WM_PASTE message. It's likely the notepad's parent window would pass it on to the child edit window to handle, and that would paste the contents of the clipboard into notepad. It is harder to set up some text on the clipboard - but there are samples on codeproject - and it would allow you to do more than one letter at a time.
I hope that helps,
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Iain Clarke wrote: Iain Clarke appearing in spite of being begged not to by CPallini.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I was wondering when you'd spot that... I'm going to have to change it now!
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
can u please tell me how to get the handle of notepad's edit window/
|
|
|
|
|
What about EnumChildWindows [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Iain Clarke wrote: I hope I'm missing out on something in your question that you didn't write down.
i mean the destroy msg is working and the wm keydown msg was not working. destroy is commented. paste is not working. any other alternative? thanks for the reply.
|
|
|
|
|
Aljechin wrote: i mean the destroy msg is working
WM_DESTROY is a notification message from the system.
Sending it to a window that actually isn't being destroyed
isn't going to do anything except possibly leave the target
application in an unstable state.
What are you expecting sending that message to do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm not an expert on such operations but
do you have tried it already with a WM_KEY_DOWN?
|
|
|
|
|
baerten wrote: WM_KEY_DOWN
Uhmmm, are you sure the notepad is aware of such a message?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
a plain dump solution, activate the notepad application and generate keyboard event
(keybd_event() API)
modified on Thursday, February 07, 2008 6:54:00 AM
|
|
|
|
|
Hi to all.
I imported some files to resource (under ResourceView tab VC6). Main reason for this is so I don't need to distribute those files with application. In some time I need to load this files from resources and FTP transfer them away... How can I load them to say temp file?
Thanks in advance to all!
|
|
|
|
|
You can use FindResource to get an HRSRC handle to your resource.
Then SizeofResource to get it's size, and LoadResource / LockResource to get a handle on it.
Using that information, you can save the binary data to a temp file, then do whatever you like with it - including using APIs to FTP it somewhere.
Searching for those functions will give you their parameters.
Lastly, if you're using MFC, you may need AfxFindResourceHandle (?) to get the HINSTANCE the resource lives in in your app / dlls.
Good luck,
Iain.
Iain Clarke appearing regardless of CPallini.
|
|
|
|
|
Thanks you very much. I'll try to do so now!
|
|
|
|
|
Now when I loaded resource how I can save it to a file?
I created temp file but what api saves my loaded resource to a file?
THX
|
|
|
|
|
Using LockResource (as I said in my previous post), you can get a void pointer to the data (read only!), and using SizeofResource you get the amount of data.
So, you just need to save this lump of data to a file using WriteFile... Just as you would save any other lumps of data.
Have a look at GetTempFileName to get the filename for a throwaway file,
CreateFile to create it (oddly enough)
and WriteFile to save data into it.
If you look at the documentation for those, you should be good to go.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
hi...
how can i store images to sql database?
how can i retreive image from sql database?
please help me. am trying this for last few days...
but still i didn't get...
thank you...
paulraj
|
|
|
|
|
gnanapaul wrote: but still i didn't get...
There is an SQL forum. Maybe the people there can help you? This sounds more like a database question than a C++ one.
I'd help you if I could, but I have no idea about ODBC etc.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
gnanapaul wrote: how can i store images to sql database?
As a BLOB.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
am using sql 2005.
so there is an image data type only.
can you pls post sample code for image/BLOB.
if you post that will be very usefull for me...
paulraj
|
|
|
|
|
It's been many years since I've used SQL, but surely the concept is still the same. See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi
i have a application to encrypt the data using cstring
if any one of u post very simple encryption and decryption algorithm it will be helpful for me .
with advanced tkanks
francis
Franics K Antony
|
|
|
|
|
There is a CryptAPI in windows which you can use. It will be better than anything *I* can write. And if you're asking the question, it will be better than anything *you* can write either.
Iain.
Modified: Might be CryptoAPI. CryptAPI would be controlling the undead.
Iain Clarke appearing in spite of being begged not to by CPallini.
modified on Thursday, February 07, 2008 4:57:32 AM
|
|
|
|
|
Iain Clarke wrote: CryptAPI would be controlling the undead.
I wonder what functions/methods it would have...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|