|
when i pass value for the sfo.pFrom="d:\\Test\\*.txt\0" it delete the file. But i dont know where my software will install. I have also used to get the path by "GetModuleFileName (hMod, szName, sizeof(szName))" and i store path in a 3rd variable. When i used 3rd variable in "sfo.pFrom=3rd variable" It not works.
---------------------------------
char true_path[100];
//returns the path where .exe install---------
TCHAR szName [MAX_PATH];
HMODULE hMod = GetModuleHandle (NULL);
GetModuleFileName (hMod, szName, sizeof(szName));
Return_Path(true_path, szName); //returns the path with double slash like D:\\Test\\
//Remove the files from specified Foleder-------------------
SHFILEOPSTRUCT sfo;
sfo.pTo = NULL;
sfo.hwnd = NULL;
sfo.wFunc = FO_DELETE;
sfo.pFrom = true_path;
sfo.fFlags = FOF_FILESONLY | FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
SHFileOperation(&sfo);
modified on Friday, October 24, 2008 9:36 AM
|
|
|
|
|
Please post code for
1. Where you store the value in "3rd Variable"
2. And where you can SHFileOperation
Regards,
Sandip.
|
|
|
|
|
Sk Mohiuddin wrote: Return_Path(true_path, szName); //returns the path with double slash like D:\\Test\\
Only string literals should have double backslashes.
Sk Mohiuddin wrote: sfo.pFrom = true_path;
Is this double \0 terminated?
Sk Mohiuddin wrote: SHFileOperation(&sfo);
What does this return?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I'm Trying to make some operation on a map. Unfortunately I have to make a massive use of pointers I'm not very expert In their use. I define the map in this way:
map<string,list><celement*>*> m_Layers;
In this map I want to change the key associated with two list. So The task I want to do is this:
if there is two entry one has a string called string1 and a list called list1, the other has string string2 and list list2. I want to change the key associated with the two lists so string1 is associated with list2 and string2 is associated to list1. I have thought to save the lists of interests in two extern lists and then to re-insert them with the key changed but I'm not able to erase the list present in the map because I use the pointer in a bad way the code I do (I Know that is wrong) is this:
<br />
string layerName = "layer1"<br />
map<string,list><celement*>*>::iterator mapIter = m_Layers.find(layerName);<br />
string levelToDown = mapIter->first;<br />
list<celement*>* listaToDown = mapIter->second;<br />
mapIter--;<br />
string levelToUp = mapIter->first;<br />
list<celement*>* listaToUp = mapIter->second;<br />
m_Layers.erase(mapIter);<br />
m_Layers.erase(m_Layers.find(levelToUp));<br />
pair<string,list><celement*>*> entry = pair<string,list><celement*>*>(levelToDown,listaToUp);<br />
entry = pair<string,list><celement*>*>(levelToUp,listaToDown);<br />
<br />
|
|
|
|
|
You are more likely to receive help if you post code that compiles, the following doesn't:
map<string,list><celement*>*>
Laan82 wrote: I have to make a massive use of pointers I'm not very expert In their use
I'll give you the same advice I do to others, and then you can ignore it also. Learn basics and fundamentals ( pointers is a basic in C/C++) before you move on to things like STL and developing applications.
led mike
|
|
|
|
|
led mike wrote: I'll give you the same advice I do to others, and then you can ignore it also.
LMAO, great sig material.
|
|
|
|
|
led mike wrote: Learn basics and fundamentals ( pointers is a basic in C/C++) before you move on to things like STL and developing applications.
So much for my "cart before the horse" theory.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I should have known that was you.
led mike
|
|
|
|
|
Dear Friends,
Is there any API to get list of installed products in Windows?
Regards,
Krishnakumar
|
|
|
|
|
No. Even Windows doesn't know what's installed. You could just copy an app into a folder somewhere - the OS doesn't have to know anything about it.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
I mean that, the list that is shown in the 'add/remove programs' in control panel.
|
|
|
|
|
Krishnakumartg wrote: I mean that, the list that is shown in the 'add/remove programs' in control panel.
That would be on HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Phil J Pearson wrote: You could just copy an app into a folder somewhere - the OS doesn't have to know anything about it.
But that doesn't count as an "installation", does it?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
It depends who's counting!
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Good Afternoon !
I have opened a handle of a COM port using CreateFile()
COMPortHandle = CreateFile ("COM1", GENERIC_READ | GENERIC_WRITE, 0,\
0, OPEN_EXISTING, 0, 0);
Now after that i do some other tasks.
Now i want to check the status of the handle i.e COMPortHandle
and close it if still opened, how to do it?
I do it in this manner, but i think it is not correct
if (COMPortHandle != NULL)
{
CloseHandle (COMPortHandle);
}
|
|
|
|
|
What do you mean by 'still opened' ? If you didn't close the handle yourself and if the CreateFile function succeeded, then your handle will still be opened. If you want to check if CreateFile was successfull, take a look at the documentation[^]: it returns INVALID_HANDLE_VALUE if it failed.
|
|
|
|
|
Hi
I want to have a scroll bar for a group-box control.
This is not possible bcoz the windows-os does not provide one , hence i was thinking of using a vertical-scroll control , but i was not successful.
Hence i thought of using a html page where in i can have a template and i can populate the values in the html page as i want programmatically.
I know this can be done in MFC , but i dont know whether the same can be done in win32 also.
Could any one help me
|
|
|
|
|
What I've done in the past is a bit complex, but a lot simpler than wiring up an HTML control - especially in Win32.
1/ Make a big overall window. Maybe a dialog box... The choice is up to you.
2/ Place a group control on it. This is just decoration.
3/ Place a vertical scroll bar next to, or just inside the right edge of the group box.
4/ Handle messages from WM_VSCROLL in your parent (eg) dialog.
5/ Create a child window taking up most of the space inside the group control. We'll call it PaneParent. This is blank, and does nething interesting except...
6/ Create a child window (call it Pane) inside the above child window. This Pane can be very large, and was also a modeless dialog box (with the WS_CHILD style set).
7/ When the scroll bar is used, move the Pane window about inside PaneParent. PaneParent will clip the Pane, so you only see a part of it.
Caveats - you'll also want the CONTROL and CONTROLPARENT styles set, to help the TABbing about.
None of this is easy, but it's OK if you break it into simpler bits. Make a dummy dialog with "I'm the top!", "I'm the middle!" and so on static controls on it until you have things working a bit more. But it's still easier than handling callback interfaces from an embedded browser control...
Iain.
|
|
|
|
|
gayatri.neelema wrote: I want to have a scroll bar for a group-box control.
Isn't a group box supposed to be static? How did you get this bad idea?
Why do you want to keep in so many things such that you will need a scroll bar? Not only will it require extra coding efforts, but it will look terrible. Ever heard of a tab control?
gayatri.neelema wrote: I know this can be done in MFC , but i dont know whether the same can be done in win32 also.
Yes.
gayatri.neelema wrote: Could any one help me
No, not for attaching a scroll-bar to a group box.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
How can we a tab control be useful,
I am clueless about it.
I have lots of data to be displayed in a dialog , could you please help me
|
|
|
|
|
Rajesh's idea is a good one - mine was just telling you how to do something.
But his point is good. If you really have tons of stuff there, can you break it into sections? If so, read up on property sheets / property pages. Window's uses those in the control panel.
And MFC has CPropertyPage/Sheets all ready and waiting for you when you come back from reading.
Iain.
|
|
|
|
|
gayatri.neelema wrote: could you please help me
Of course yes, but read up on tab control (there are plenty of samples all over the internet) and if you encounter a trouble, come back and post what do you need help with.
It is not a very daunting task, if you ask me.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Create a group box with WS_VSCROLL style.
|
|
|
|
|
Hi,
I am working on an mfc application and implementing chat module. In chat module i need to give the function of sending emoticons. I am using a button with text emticons and when i click it i am opening a dialog box which is having several smiley.
Now the problem is that I want open the DialogBox having emoticons just above the button having text as emoticons. How can i position my DialogBox at just top of the button.
Thanks In Advance.
Dhiraj Kumar Saini
|
|
|
|