|
macmac38 wrote:
how can i start another app from my application?
BOOL CreateProcess(
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
macmac38 wrote:
After this i like to call the F4 Button?
You want to call the F4 button? I'm not sure what you mean... You can kill the process using the TerminateProcess function (you got the handle from CreateProcess). If you want to simulate a press to F4 you can use the SendInput or keybd_event functions.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Yep, i can call the .exe now when i press a button in my app. What i like to do is to simulate the pressing of F4 after this.
Because this starts a macro in the opened .exe.
I cannot understand the help for these functions you gave me and do not know which code to use for F4(Hardwareadress, number..???)
Do u have a code snip?
Thanks, Mark
|
|
|
|
|
SendMessage(wndOfStartedApp, WM_KEYDOWN, VK_F4, 0);
The first parameter is the HWND of the app you just started.
Instead of WM_KEYDOWN you might also try WM_KEYUP.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
mmh, i use NULL for HWND when i start the app. Nothing happens..
Thanks, Mark
|
|
|
|
|
It is normal:
the HWND defines which window will receive the message, then if you send the KeyPress to a null window...
you should start your app, then find the window of that app and after that send the message there...
I think that you can also do it better, and in order to do so, you should take a look at CreateProcess(...).
hope this helps.
|
|
|
|
|
But how can i find the window of that app? It is a commercial one. By the way i think i have to wait till the app is up before i send the message there?
Thanks, Mark
|
|
|
|
|
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
|
|
|
|