|
See SHFileOperation/rmdir or deletefile.
|
|
|
|
|
have you only checked the API Documentation[^] ?
"lpPathName : The path of the directory to be removed. This path must specify an empty directory, and the calling process must have delete access to the directory. "
down further the page, you can see this :
"To recursively delete the files in a directory, use the SHFileOperation[^] function."
next time, google before asking please
|
|
|
|
|
I like to Delete folder in any case even if other applications or other users are accessing the same folder. Forcefully i like to delete the Folder. I receive Error 32 when the function SHFileOperation(). Can any one tell me how can i acheive this.
|
|
|
|
|
hi
I need to write a program that needs to "steel" the data that appers on a control box of a diffrent program.
I saw how the SPY programs here are built but they all need a user interface to point to that control.
I want to go throgh all the process that are running and check if what i want is there and then get it's handle.
Visual studio spy++ does something like that. but how???
please help me i am trying to fins a solution for a long time.
Thank you
|
|
|
|
|
Do you want to make a program like SPY++?
|
|
|
|
|
i want i program that will tell me what is the value in the calculator(for example) text box. the UI shouls be output only.
the way i thought of doing this was to go through all the process and when i reach to right one check it's window handle's. but i don't how to get the process's list and how to get the handles from the process.
|
|
|
|
|
For start you can use EnumWindows for get handle for each process and for more functions that you will be help them see Process and Thread Functions[^].
|
|
|
|
|
YS8888 wrote: i want i program that will tell me what is the value in the calculator(for example) text box.
Or maybe a password text box??
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think its not possible for all programs. 
|
|
|
|
|
YS8888 wrote: I need to write a program that needs to "steel"
Since your intentions are so honest, I'm going to help you: have a look at EnumWindows [^] function.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Try something like this:
#include "stdafx.h"
#include <tchar.h>
#include <malloc.h>
#include <windows.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
HWND hwndCalc = FindWindow(_T("SciCalc"), _T("Calculator"));
if (hwndCalc == NULL)
{
cerr << "Couldn't find the Calculator window!" << endl;
return -1;
}
HWND hwndEdit = FindWindowEx(hwndCalc, NULL, _T("Edit"), NULL);
if (hwndEdit == NULL)
{
cerr << "Couldn't find the Calculator's edit control!" << endl;
return -2;
}
int len = SendMessage(hwndEdit, WM_GETTEXTLENGTH, 0, 0);
if (len == 0)
{
cerr << "Text empty?!?" << endl;
return -3;
}
LPTSTR pBuffer = static_cast<LPTSTR>(_alloca((len+1)*sizeof(TCHAR)));
int res = SendMessage(hwndEdit, WM_GETTEXT, len+1, reinterpret_cast<LPARAM>(pBuffer));
if (res == 0)
{
cerr << "Text empty?!?" << endl;
return -4;
}
#ifdef UNICODE
wcout << _T("Calculator's result: ") << pBuffer << endl;
#else
cout << _T("Calculator's result: ") << pBuffer << endl;
#endif
return 0;
}
It's a console application.
Steve
|
|
|
|
|
Hi i am quite new in MFC but know C++ programing and done work in VC 6 using win32 console application now switching to MFC. So please tell me how can i add images button? How can i change the colors of dialouge boxes. I shall be very thankfull to you.
Regards:
Xohaib Shirani
|
|
|
|
|
CImage m;
m.Load(_T("c:\\1.jpg"));
m_Button.SetBitmap(m.detach());
but if you want to use of bitmaps you can use of LoadImage.
|
|
|
|
|
Dear i tell you that i am quite new in MFC so plz guide me where i have to put this code
CImage m;
m.Load(_T("c:\\1.jpg"));
m_Button.SetBitmap(m.detach());
??
Regards:
Xohaib Shirani
|
|
|
|
|
So you need to more info,Ok.
First you must load your image with LoadImage or CImage class or GDI+,...
After load your image you will be have a handle to that image file then you can use of this handle at control that you want to use it.
For example I guess you have a Static control and you want to insertimage to it:
//(1)Declare a variable of CImage
#include "atlImage.h"
CImage m;
//(2) load image file (you need to path of file
m.Load(_T("c:\\1.jpg"));
//(3) set control to that image file
m_Static.SetBitmap(m.detach());
|
|
|
|
|
Do you have any idea to change the colors of dialoge boxes??
I ask too much question?? Hmmm... Sory bro need to learn...
Regards:
Xohaib Shirani
|
|
|
|
|
Yeah I have an Idea WM_CTLCOLOR is your answer. 
|
|
|
|
|
Start by browsing this website. I know there are multiple articles on fancy buttons, and some on changing backgrounds for all sorts of things.
Expand the "desktop development" part on the left, the look under "button controls", and "dialog and windows".
It will take you a while to find what you are looking for, but you'll trip over many other good things along the way.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Hi
I am building my tool in VC++ 2008 and it is non /clr based. I want the code that converts string to char* and it should be non clr based.
I set project property "Common language runtime" as "No Common language runtime".
http://support.microsoft.com/kb/311259[^]
This link provides me solution to my problem but for that i have to set project property "Common language runtime" as a "Common language runtime support" which i don't want. Because if i change it gives me an error
fatal error C1113: #using failed on 'h:\bipin\b.e\kpit proj\copy control\temp\dllproject\debug\dllproject.lib'
Here is my code
string snos;
c1.ReadPhysicalDriveInNTWithZeroRights(snos);
fuction reads hard disk serial number and stores it into "snos".
Thanking you.
|
|
|
|
|
I think you asked this question and delete your question,right(one hours ago)?
|
|
|
|
|
I though ur not getting it. so i deleted my previous question.
you want what exactly ?
convert a C++ string (std::string) to a C style string (char*) ?
ya toxcct i want that.
|
|
|
|
|
|
|
the std::string class has a c_str() function which returns a char*...
std::string str = "Hello World";
char psz[20] = {0};
::strcpy(str.c_str(), psz);
|
|
|
|
|
so you think deleting your previous post and reposting it exactly the same again will change something ?
just wondering : why are you insisting that much about the CLR thing ?
you want what exactly ?
convert a C++ string (std::string) to a C style string (char*) ?
or you want to get the HDD serial number anyway ?
BTW, where are you taking this function from ?
|
|
|
|