|
If you launch it by using the CreateProcess api, one of the parameters is a PROCESS_INFORMATION structure. This gets filled in with the THREAD HANDLE of the primary thread for the newly lauched app. After the CreateProcess call returns, wait for the app to initialize by calling WaitForInputIdle(). When this returns, then you should be able to simulate a keystroke with the PostThreadMessage api, passing the new app's main thread handle as the parameter.
Good Luck!
onwards and upwards...
|
|
|
|
|
Hi.
Does anyone know if there is a DirectX application wizard for use with the VC++ .NET version.
I am looking for something similar to the app wizard that is available for use under VC++ 6 ?.
Thanks.
James
|
|
|
|
|
;PDear All,
Is there any API which may simulate Deltree command.
I am developing a application for Windows 2000/NT/XP in which i want to remove all contents of a given folder .
Or any alternate way to achieve the same ?
Thanks
Rohit
|
|
|
|
|
Rohit Divas wrote:
Or any alternate way to achieve the same ?
Yes. You'll have to recursively go through the folders, delete each file, and then finally delete the folder. Of course, if a folder contains subfolders, then you'll need to go through that folder and delete all the files and subfolders in it etc., hence the recurson.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
try this:
#include <string><br />
#include <iostream><br />
<br />
#include <conio.h><br />
<br />
<br />
int DeleteDirectory(const std::string &refcstrRootDirectory)<br />
{<br />
std::string strFilePath;
std::string strPattern;
HANDLE hFile;
WIN32_FIND_DATA FileInformation;
<br />
<br />
strPattern = refcstrRootDirectory + "\*.*";<br />
hFile = ::FindFirstFile(strPattern.c_str(), &FileInformation);<br />
if(hFile != INVALID_HANDLE_VALUE)<br />
{<br />
do<br />
{<br />
if(FileInformation.cFileName[0] != '.')<br />
{<br />
strFilePath.erase();<br />
strFilePath = refcstrRootDirectory + "\" + FileInformation.cFileName;<br />
<br />
if(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)<br />
{<br />
// Delete subdirectory<br />
int iRC = DeleteDirectory(strFilePath);<br />
if(iRC)<br />
return iRC;<br />
}<br />
else<br />
{<br />
// Set file attributes<br />
if(::SetFileAttributes(strFilePath.c_str(),<br />
FILE_ATTRIBUTE_NORMAL) == FALSE)<br />
return ::GetLastError();<br />
<br />
// Delete file<br />
if(:eleteFile(strFilePath.c_str()) == FALSE)<br />
return ::GetLastError();<br />
}<br />
}<br />
} while(::FindNextFile(hFile, &FileInformation) == TRUE);<br />
<br />
// Close handle<br />
::FindClose(hFile);<br />
<br />
DWORD dwError = ::GetLastError();<br />
if(dwError != ERROR_NO_MORE_FILES)<br />
return dwError;<br />
else<br />
{<br />
// Set directory attributes<br />
if(::SetFileAttributes(refcstrRootDirectory.c_str(),<br />
FILE_ATTRIBUTE_NORMAL) == FALSE)<br />
return ::GetLastError();<br />
<br />
// Delete directory<br />
if(::RemoveDirectory(refcstrRootDirectory.c_str()) == FALSE)<br />
return ::GetLastError();<br />
}<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
<br />
int main()<br />
{<br />
std::string strDirectoryToDelete = "c:mydir";<br />
<br />
// Delete 'c:mydir' and its subdirectories<br />
int iRC = DeleteDirectory(strDirectoryToDelete);<br />
if(iRC)<br />
{<br />
std::cout << "Error " << iRC << endl;<br />
return -1;<br />
}<br />
<br />
// Wait for keystroke<br />
_getch();<br />
<br />
return 0;<br />
}
|
|
|
|
|
SHFileOperation() will help you!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Rickard Andersson18 wrote:
SHFileOperation()
I thought of that, but does SHFileOperation() do a recursive delete on an nonempty folder?
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
<edit> Problem Sorted </edit>
Regards,
Brian Dela
|
|
|
|
|
Hi !
Your question is not clear... Is this an Installshield question ? I do not understand what you mean with I have Launch Conditions in place that determine if the resgistry entry is there but how to I get the folder to install in the path indicated in the registry entry?. In Installshield, I seem to remember that you can use VB registry commands to achieve that.
What I suggest you is to use Innosetup, since it will take you approximatively 5 minutes to achieve that
~RaGE();
|
|
|
|
|
Rage wrote:
Is this an Installshield question ?
I created a SetupProject through Visual Studio .NET 2003 so it's INstallShield based.
Regards,
Brian Dela
|
|
|
|
|
Sorted
Regards,
Brian Dela
|
|
|
|
|
I want to use OpenSSL in my current socket application and i want to remove the MFC socket i.e MFC dependency. Where can i get sample code for OpenSSL or the documentation which tell me what steps needs to follow while using OpenSSL. Thanks For your Help.
|
|
|
|
|
I want to make the combobox with bitmap list.
Instead of using "AddString" function,
how can I make the list with bitmap.
|
|
|
|
|
You'll have to use an owner-draw combo box (set the CBS_OWNERDRAWFIXED or CBS_OWNERDRAWVARIABLE style).
This[^] article describes exactly this.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Code:
m_list.Create(IDB_BITMAP1,40,10,RGB(255,255,255));
//m_list is CImageList type member variable
m_Lang.SetImageList(&m_list);
//m_Lang is combobox control member variable
Umm... I'm very poor at visual c++.
I wrote those two lines for getting bitmap list.
But the bitmap image is not appeared.
How can I do?
|
|
|
|
|
I assume you're using CComboBoxEx because CComboBox does not have a SetImageList() function.
Have you associated an image with each item?
COMBOBOXEXITEM cbItem;
cbItem.mask = CBIF_IMAGE;
cbItem.iItem = nItem;
cbItem.iImage = nImageIndex;
m_Lang.SetItem(&cbItem);
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
A sentence is like below:
lpwndpos->flags &= ~SWP_SHOWWINDOW;
What is the meaning of "&"?
Thanks
|
|
|
|
|
Is it has the same meaning as below?
lpwndpos->flags = &(~SWP_SHOWWINDOW);
|
|
|
|
|
Aleon666 wrote:
Is it has the same meaning as below?
lpwndpos->flags = &(~SWP_SHOWWINDOW);
No. In the first question that you posted '&' is the binary operation AND.
lpwndpos->flags &= ~SWP_SHOWWINDOW is the same as
// pseudo code
lpwndpos->flags = lpwndpos->flags AND (NOT SWP_SHOWWINDOW)
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
The "&=" is an abbreviation of: lpwndpos->flags = (lpwndpos->flags & (~SWP_SHOWWINDOW)). So this is a bit AND operator.
The "~" means you invert all the bits that are in SWP_SHOWWINDOW (all 0 becomes 1 and all 0 becomes 1).
So this sentence just means you will put the bits specified by SWP_SHOWWINDOW (all the bits that are 1 in this constant) at 0 in lpwndpos->flags.
Hope this is clear enough !
|
|
|
|
|
I see.
Thank you very much!
|
|
|
|
|
|
|
Hi Guys,
I am writing a windows service to start / stop certain utility applications. The utilities are in Vb (Please don't ask me why a background process was programmed in vb, I don't know that myself). I used CreateProcess to start them, that was fine.
Now the problem arises when I want to stop them. I can't use TerminateProcess because the applications may be in the middle of something and I want to wait till they finish the job at hand. So I decided to use messages.
I tried PostThreadMessage. The problem I have was that on the utilities' side, if I used GetMessage then it waits for the message which makes the application hang and if I used PeekMessage then in some cases it was missing the Message altogether.
Finally I thought of using a dummy subclassed form and sending the message to to form. It's working now, but it seems like a mess to me. I'm pretty sure there's a better way. Any suggestions?
thanks.
P
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Take a look two or three messages down "how do i Detect if an external program has finished excuting(shellexec)?" and read Rage's and cmk's messages. I think, they apply to you as well.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|